Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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:


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 -oX -` +; print @OU;
It returns immediate output :/ Has anyone run into this? Thanks- Pete

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1030656]
Front-paged by Corion
and the universe expands...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2017-01-24 06:28 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (203 votes). Check out past polls.