in reply to Re^2: IP Iterator
in thread IP Iterator
If you don't want to use an "extra module" then you can do it like this:
#!/usr/bin/perl use warnings; use strict; use Net::Ping; if ( @ARGV != 2 ) { print "ipiterator <startip> <endip> \n"; exit 0; } my ( $start, $end ) = map unpack( 'N', pack 'CCCC', split /\./ ), @ARGV; for my $count ( $start .. $end ) { my $ip = join '.', unpack 'CCCC', pack 'N', $count; print "checking ip: $ip"; my $p = Net::Ping->new( 'icmp', 2 ); print ' ping success' if $p->ping( $ip ); $p->close(); print "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: IP Iterator
by ikegami (Patriarch) on Apr 17, 2008 at 22:29 UTC | |
|
Re^4: IP Iterator
by camlet (Novice) on Apr 18, 2008 at 00:46 UTC |