Skip to content

Instantly share code, notes, and snippets.

@visar
Last active August 29, 2015 13:56
Show Gist options
  • Save visar/9322873 to your computer and use it in GitHub Desktop.
Save visar/9322873 to your computer and use it in GitHub Desktop.
#!/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