Thread

Posted on Tue Feb 21 03:53:17 2006 by heckerchris
Multiple Nmap threads
I am playing around with the scan.pl program that Anthony Persaud wrote. I would like to be able to run two instances of nmap at the same time. I am trying to scan a port with one instance (OS detection) then with another instance scan (ping sweep) the next port to see it that port in up. Is this possible? I try to run one instance then when I call the next instance it overwrites the first scan. Thanks. -Chris Hecker
Direct Responses: 1826 | Write a response
Posted on Tue Feb 21 05:35:47 2006 by apersaud in response to 1825
Re: Multiple Nmap threads
This should have been fixed in 1.01.

Check this....

http://search.cpan.org/~apersaud/Nmap-Parser-1.05/Parser.pm#Multiple_Instances_-_(no_less_%27of%27%3B_my_%24self)

If that doesn't work, let me know... something might be wrong.

Thanks,

Anthony Persaud
http://www.anthonypersaud.com
Direct Responses: 1830 | Write a response
Posted on Tue Feb 21 22:55:20 2006 by heckerchris in response to 1826
Re: Multiple Nmap threads
Anthony, I looked at the examples and I tried to make them work but to no avail. Let me try to explain a little better and give some of my source code to figure out if what I'm trying to do is possible. By looking at the code, I'm calling the parsescan and sub host_handler that you created. Then inside of host_handler, I want to call the parsescan and sub host_pingsweep to check and see if the next IP address is up or down. After the host_pingsweep is finished, I want the host_handler function to continue scanning the remaining network for OS detection. So it is essentially, a nested nmap scan which I'm not sure if it is possible. Below the code is my output that shows the original OS scan and the pingsweep scan but it does not return to the OS detection scan. Thank you for all your help. -Chris Hecker
Code: ...... More stuff...... $np->callback(\&host_handler); $np->parsescan($G{nmap},'-sS -sV -O -PI -PT',@ARGV); sub host_handler { my $host = shift; print ' > '.$host->ipv4_addr."\n"; print "\t[+] Status: (".uc($host->status).")\n"; if($host->status eq 'up'){ my $os = $host->os_sig(); tab_print("Hostname(s)",$host->all_hostnames()); tab_print("Uptime",($host->uptime_seconds())." seconds") if($host->uptime_seconds()); tab_print("Last Rebooted",$host->uptime_lastboot()) if($host->uptime_lastboot); tab_print("OS Signatures",$os->name()); $ip_address = $host->ipv4_addr; $input2 = $host->ipv4_addr; $pattern2 = '^\d{1,3}\.\d{1,3}\.\d{1,3}\.'; $ip_address =~ s/$pattern2//s; $ip_address++; $pattern3 = '\d{1,3}$'; $input2 =~ s/$pattern3/$ip_address/s; $np2->callback(\&host_pingsweep); $np2->parsescan($G{nmap},'-sP',$input2); $np2->callback(); #I tried this to try and reset the callback but that didn't work also. print OUTFILE "bind $input2 ".$os->osfamily()."$num\n"; } print "\n\n"; } sub host_pingsweep { my $host2 = shift; my $ping_count=0; do { $ping_count++; print ' > '.$host2->ipv4_addr."\n"; print "\t[+] Status: (".uc($host2->status).")\n"; } until ($host2->status eq 'down' || $ping_count >3); } Actual Run: Using nmap exe for TCP scan and honeyd config. file: /usr/bin/nmap 137.229.49.49 [+] Status: (UP) [+] Hostname(s) : 49-49.wireless.uaf.edu [+] Uptime : 161567 seconds [+] Last Rebooted : Sun Feb 19 14:16:16 2006 [+] OS Signatures : Linux 2.5.25 - 2.6.8 or Gentoo 1.2 Linux 2.4.19 rc1-rc7 [+] TCP Ports : 22 (ssh) OpenSSH 3.9p1 111 (rpcbind) 2 876 (status) 1 137.229.49.50 [+] Status: (UP) 137.229.49.50 [+] Status: (UP) 137.229.49.50 [+] Status: (UP) 137.229.49.50 [+] Status: (UP)
Write a response