Last active
August 29, 2015 13:56
-
-
Save visar/9322873 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use LWP::UserAgent; | |
use HTTP::Request::Common qw(POST); | |
use HTTP::Cookies; | |
use MIME::Base64; | |
$| = 1; | |
my $ua = LWP::UserAgent->new( cookie_jar => HTTP::Cookies->new ); | |
my $url = 'http://195.189.206.107:3000/'; | |
while (42) { | |
my $response = $ua->head( $url . 'code.png' ); | |
my $tmp = | |
decode_base64( $ua->cookie_jar->{'COOKIES'}->{'195.189.206.107'}->{'/'} | |
->{'mojolicious'}[1] ); | |
my $string; | |
if ( $tmp =~ m/\"code\":\"(\w*)\"/ ) { | |
$string = $1; | |
} | |
print $string . "\n"; | |
last if ( $string eq 'END' ); | |
$response = $ua->post( $url . 'code', [ 'code' => $string ] ); | |
last if ( $response->content eq 'ERR' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment