Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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

In reply to NMAP::Scanner hangs, CL is ok. by petermilanese

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (7)
    As of 2014-09-23 09:58 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (216 votes), past polls