Created
May 14, 2013 18:02
-
-
Save parkan/5578074 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
#!/opt/perlbrew/perls/current/bin/perl | |
use utf8; | |
use strict; | |
use warnings; | |
use v5.16; | |
use Algorithm::Permute; | |
use Data::Validate::IP; | |
my @a = qw(0 1 8 16 46 74 96 106 109 126 127 186 192 255); | |
my $p = new Algorithm::Permute(\@a, 4); | |
use LWP::UserAgent; | |
use Data::Dumper; | |
my $ua = LWP::UserAgent->new(); $ua->timeout(1); | |
while (my @res = $p->next) { | |
my $ip = join(".", @res); | |
if(is_public_ipv4($ip)){ | |
my $url = "http://$ip/hackerolympics.json"; | |
my $res = $ua->post( $url, { name => "parkan" } ); | |
if($res->is_success && $res->content_type =~ m/json/i){ | |
print "RESPONSE FROM: $ip\n"; | |
print Dumper($res->decoded_content()); | |
} | |
} else { | |
#print "NOT VALID: $ip\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment