Consider using Net::Ping with the 'syn' protocol (and ->ack()</c> method) to overlap your pings. It's far more efficient than a multithreaded solution, and easier to write.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
hey there..thanks for ur reply...pardon me for my lack of knowledge on perl, i did not completely get ur answer :-O
let me rephrase, if there are IP1,IP2,...IP255 alive machines in a subnet, the current way of doing is, wait for scan of IP1 to complete and then start scan of IP2 and so on,This takes a lot of time to complete the scan, i am looking into ways where i can send a scan request to more than one machine simultaneously, Does your answer cover this..can u please elaborate.
| [reply] |
# Like tcp protocol, but with many hosts
$p = Net::Ping->new("syn");
$p->port_number(getservbyname("http", "tcp"));
foreach $host (@host_array) {
$p->ping($host);
}
while (($host,$rtt,$ip) = $p->ack) {
print "HOST: $host [$ip] ACKed in $rtt seconds.\n";
}
| [reply] [d/l] |
Well, i'd written a similar utility to scan around 10,000 devices for ping, I used Threads with semaphore. Since it's windows, be careful about concurrent threads.
The whole operation took around 20 mins. But i had a limitation of memory consumption as well.
Here are the modules i used:
use threads qw(yield);
use Thread::Semaphore;
use Net::Ping;
use Socket;
| [reply] [d/l] |
As its unlikely that you just want to ping the subnet.
I would use nmap for this in a pipe from perl. With the -oX argument for XML output or similar output format to read in.
| [reply] |