Created
December 22, 2012 14:35
-
-
Save kentfredric/4359102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PERL5OPT="-Ilib" perl t/91-hash-random.t | |
1..1 | |
0 0xda21c880 ['193.0.0.0/21'] mine=0 | |
0 0xcb670160 ['193.0.0.0/8'] mine=1 | |
1 0xda21c880 ['193.0.0.0/21'] mine=0 | |
1 0xcb670160 ['193.0.0.0/8'] mine=1 | |
2 0xda21c880 ['193.0.0.0/21'] mine=0 | |
2 0xcb670160 ['193.0.0.0/8'] mine=1 | |
3 0xda21c880 ['193.0.0.0/21'] mine=0 | |
3 0xcb670160 ['193.0.0.0/8'] mine=1 | |
4 0xda21c880 ['193.0.0.0/21'] mine=0 | |
4 0xcb670160 ['193.0.0.0/8'] mine=1 | |
5 0xda21c880 ['193.0.0.0/21'] mine=0 | |
5 0xcb670160 ['193.0.0.0/8'] mine=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Data::Dumper qw( Dumper ); | |
my ( @hashes ) = qw( 0xda21c880 0xcb670160 ); | |
sub in_ps { | |
my ( $it, $hash ) = @_; | |
$ENV{PERL_HASH_SEED} = $hash; | |
system($^X,'-E',<<"EOF"); | |
use Net::Whois::IANA; | |
use Data::Dumper qw( Dumper ); | |
\$Data::Dumper::Terse=1; | |
\$Data::Dumper::Indent=0; | |
my \$instance = Net::Whois::IANA->new(); | |
\$instance->whois_query( -ip => q{193.0.0.135}); | |
printf "%s %s %s mine=%s\n", $it, "$hash", Dumper( \$instance->cidr() ), \$instance->is_mine(q{193.0.8.1}); | |
EOF | |
} | |
for my $i ( 0 .. 5 ){ | |
for my $hash ( @hashes ) { | |
in_ps($i,$hash); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment