in reply to Re^2: Nmap::Scanner breaks my while loop, I think
in thread Nmap::Scanner breaks my while loop, I think

The while loop still ends right there.
Are you sure? Is not it one line later? You should not call
$results->get_host_list();
if $results is empty.

Replies are listed 'Best First'.
Re^4: Nmap::Scanner breaks my while loop, I think
by jantelar (Initiate) on Feb 14, 2012 at 16:19 UTC

    Yes, I am pretty sure. This code:

    print STDERR "\nNetwork $r[0], mask $r[1]\n"; my $scanner = new Nmap::Scanner; my $results; print STDERR "Start Scan\n"; eval{ $results = $scanner->scan("-v -sP $r[0]/$r[1]"); }; print STDERR "Error catched: $@\n" if($@); print STDERR "Scan complete\n";

    Yeilds this output:

    Network xx.xx.xx.xx, mask yy Start Scan Scan complete Network 10.8.165.160, mask 28 Start Scan <nmap-error> <pid="18142"/> <cmdline="'/usr/bin/nmap' -v -v -v -v -sP 10.8.165.160/28 -oX -"/> <nmap-err>RTTVAR has grown to over 2.3 seconds, decreasing to 2.0 </nmap-msg> </nmap-error>

    ie the two last prints are not executed