Nmap Development mailing list archives
Re: Running Nmap several times within the same process
From: David Fifield <david () bamsoftware com>
Date: Wed, 23 Sep 2009 10:22:26 -0600
On Wed, Sep 23, 2009 at 06:53:25AM +0000, Andy Woods wrote:
I'm playing around with a project where I want to run Nmap several times
within the same process.
Currently I'm doing some tests to see if it is possible, or really just a
bad idea.
To make some kind of proof-of-concept I renamed the entry-function main(..)
in main.cc to main_entry(..),
and created a new main(..) function with the following code;
int main(int argc, char *argv[]) {
printf("Starting first scan...\n
printf("----------------------\n");
main_entry(argc, argv);
printf("\n");
printf("Starting second scan...\n");
printf("-------------------------\n");
main_entry(argc, argv);
return 0;
}
The idea is to run two scans in the same process, which I think requires
Nmap to clean up
global memory allocations in the first run to turn out well.
1. TEST (standard arguments)
=================================================================
In this test I passed standard arguments to Nmap, but as you can see
of the results the second scan fails (probably because some global
variables,
or heap allocated pointers are not deleted)
C:\Src\NmapTest\nmap-5.00\mswin32\Debug>nmap.exe -n 192.168.119.1
Starting first scan...
----------------------
Starting Nmap 5.00 ( http://nmap.org ) at 2009-09-23 07:57 Central Europe
Standard Time
Interesting ports on 192.168.119.1:
Not shown: 995 closed ports
PORT STATE SERVICE
135/tcp open msrpc
139/tcp open netbios-ssn
445/tcp open microsoft-ds
912/tcp open unknown
12345/tcp open netbus
MAC Address: 00:50:aa:bb:cc:dd (VMWare)
Nmap done: 1 IP address (1 host up) scanned in 5.16 seconds
Starting second scan..
----------------------
Starting Nmap 5.00 ( http://nmap.org ) at 2009-09-23 07:58 Central Europe
Standard Time
PortList::initializePortMap: portmap for protocol 6 already initialized
QUITTING!
This is probably related to the problem reported at http://seclists.org/nmap-dev/2009/q2/0464.html, where running two scans in a row using the --interactive option would cause an assertion failure. I agree, it looks like some state isn't being reset or initialized properly, but I haven't found out where it is. This is something that should work. It would be helpful if you can find what changes are needed to make it work. David Fifield _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Running Nmap several times within the same process Andy Woods (Sep 22)
- Re: Running Nmap several times within the same process David Fifield (Sep 23)
