P has asked for the wisdom of the Perl Monks concerning the following question:
Hi all!
My question is how i can accelerate the scanner? It reads a file that has ips
#!/usr/bin/perl use IO::Socket; my $dir = $ARGV[0]; my @ports = qw(8080 1080 31337 6588 3128 81); my $i = 0; my $time = time; open(READ,"<".$dir.""); while(<READ>) { chomp($_); $i++; print "".$i." · ".$_."\n"; foreach my $port (@ports) { my $is_proxy = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $_, PeerPort => $port, Timeout => 1, ) or next; print "".$i." · ".$_." (".$port.")\n"; $is_proxy->close; last; } } close(READ); my $time_ = time - $time; print "IPs: ".$i." · Time: ".$time_."\n"; exit();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IPs' Scanner
by hardburn (Abbot) on Jan 19, 2004 at 22:07 UTC | |
|
Re: IPs' Scanner
by Abigail-II (Bishop) on Jan 19, 2004 at 22:09 UTC | |
|