Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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
[1nickt]: the tick that can make you a vegetarian
[perldigious]: Your Mother: Yeah, I have a tool for ticks that I use (mostly on my dogs thankfully), but it's just a cheapo one I got from my vets office... it works pretty good though.
erix saw a tick in a natural history museum collected from the scrotum of the curator (it was removed)
[Your Mother]: The exhibit, the tick, or the scrotum?
[erix]: (the man is even a paleontologist )
[1nickt]: erix unfortunately that's there favourite spot. That's why they are usually spotted crawling *up* your leg.
[erix]: ha, the tick and, as it happens, also the curator (now a professor of Paleont.)
[1nickt]: s/there/their/, ugh sorry.
[Your Mother]: Heh. The only one I ever had on me, I caught on my shin, headed north.
erix looks nervously I got away cleanly from my run , it seems :)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (15)
As of 2017-05-24 13:16 GMT
Find Nodes?
    Voting Booth?