Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

NMAP::Scanner hangs, CL is ok.

by petermilanese (Initiate)
on Apr 25, 2013 at 12:19 UTC ( #1030656=perlquestion: print w/ replies, xml ) Need Help??
petermilanese has asked for the wisdom of the Perl Monks concerning the following question:

Greetings-

I have some code that does OS fingerprint/port scans. It uses Nmap::Scanner. For a few particular hosts it will hang on the scan within the module. However, if I execute the nmap line used by the module from the command line it's fine. It seems to only hang when using the Nmap::Scanner module.

For instance - This routine is called:
sub portScan { print "Port Scan - "; $key = shift; my $hostname = $hash{$key}{"Address - FQDN"}; my $scanner = new Nmap::Scanner; $scanner->register_scan_started_event(\&scan_started); $scanner->debug(1); $scanner->register_scan_complete_event(\&scan_ended); $scanner->register_port_found_event(\&port_found); $scanner->scan('-sS -p 1-1024,5555,8000-8200 -O --max-rtt-time +out 100ms --max-retries 2 -T aggressive '. $hostname); $scanner->guess_os(); print "\n"; #print "$hostname - ".$hash{$key}{'Ports Open'} . "\n"; }

On one host it will return immediately and successfully. On another, it will not. It's literally frozen on that execution all night. However. If I pull the command line executed by the module-

#!/usr/bin/perl @OU=`/usr/bin/nmap -v -v -v -sS -p 1-1024,5555,8000-8200 -O --max-rtt- +timeout 100ms --max-retries 2 -T aggressive host.mydomamin.com -oX -` +; print @OU;
It returns immediate output :/ Has anyone run into this? Thanks- Pete

Comment on NMAP::Scanner hangs, CL is ok.
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1030656]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-07-24 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (157 votes), past polls