in reply to Making a multi-threaded port scanner in perl?
A good start to help us help you better would be to show us the code that you tried but which did not work for you.
The general approach I would use would be to use a worker model like the following:
sub scan_host { while( my( $ip )= $hosts->dequeue() ) { warn "Scanning '$ip'"; ... do real work $portstatus->enqueue({ host => $ip, status => 'too lazy', }); }; } for( 1..$NUM_THREADS ) { threads->create( \&scan_host ); };
$hosts->end; while(my $result= $portstatus->dequeue()) { print Dumper $result; };
An easier way would be to run the nmap binary and use Nmap::Parser for the results.
|
|---|