You are on page 1of 3

#!

/usr/bin/perl
use Data::Dumper;
use HTTP::Daemon;
use HTTP::Status;
use LWP::UserAgent;
use HTTP::Request::Common;
use MIME::Base64;
my $ua = LWP::UserAgent->new;
$ua->no_proxy();
my $port = $ARGV[0] || 8080;#80
my $d = new HTTP::Daemon(ReuseAddr => 1, LocalAddr=>'localhost',LocalPort=>$port);
print "Proxy: < ", $d->url, " >\n";
my $debug = 0 || $ARGV[1];

#open(F,"<test.png");
#binmode(F);
#$temp_content = join("",<F>);
#close(F);

#$response = $ua->request(POST 'http://127.0.0.1/', Content_Type => 'form-data',


Content => [
# 'pict' => [
# undef,
# 'captcha.png',
# 'Content_Type' => 'image/png',
# 'Content' => $temp_content
# ]
# ]);
#print $response->content . "\n";
#exit;

if($debug == 1){
open(W,">proxydebug.txt");
print W "";
close(W);
}

while(my $c = $d->accept){
while(my $r = $c->get_request){
print "debug: ".$r->url . "\n";
if($r->url eq '/' or $r->url =~ /api.dbcapi.me|
api.deathbycaptcha.com|api.deathbycaptcha.eu|api.dbc.me|deathbycaptcha.eu|
deathbycaptcha.com|deathbycaptcha.ru|2captcha.com|dc.antigate.com|antigate.com|
www.antigate.com|anti-captcha.com|www.anti-captcha.com|decaptcher.com|api.de-
captcher.com|api.de-captcher.info|api.decaptcher-reloaded.com|poster.decaptcher-
reloaded.com|poster.decaptcher.com|poster.de-captcher.com|poster.de-captcher.info|
poster.shanibpo.com|api.captchatronix.com|api.ruokuai.com|ripcaptcha.com|
rucaptcha.com|captchabot.com|captchatypers.com|bypasscaptcha.com|
api.captchatrader.com|www.captchatrader.com|captchatrader.com|www.fasttypers.org|
fasttypers.org|captchabrotherhood.com|www.captchabrotherhood.com/i){#$r->method eq
"GET"
if($debug == 1){
print '2 '.$r->url . " " . $r->url->path . '?' .
$r->url->query . "\n";
open(W,">>proxydebug.txt");
}
#if($debug == 1){
# print W Dumper($r);
#}
my $newquery;
if($r->url->path !~ /^\//){
$newquery = '/';
}
if($r->url->query && length($r->url->query) > 0){
$newquery .= $r->url->path . '?' . $r->url->query;
}else{
$newquery .= $r->url->path;
}
$newquery = '/' unless($newquery);

my $response;
if($r->url eq '/'){#GSA (Special)
my $temp_boundary = $r->headers->header('content-
type');
$temp_boundary =~ s/["']//g;
my($temp_boundary_extract) = ($temp_boundary =~
/boundary=(.*)/);
$temp_boundary_extract .= '--';
my $temp_content1 = (split(/\r\n\r\n/,$r->content))
[1];
my $temp_content = (split(/$temp_boundary_extract/,
$temp_content1))[0];

open(F,"<apikey.txt");
my $apikey_temp = join("",<F>);
close(F);

$response = $ua->request(POST
'http://www.9kw.eu/index.cgi', Content_Type => 'form-data', Content => [
action =>
'usercaptchatradersubmit',#Extended API
apikey => $apikey_temp,
source => '9kw-tunnel-proxy',
base64 => 1,
'file-upload-01' =>
encode_base64($temp_content,'')
]);

#GSA Test Request


# $response = $ua->request(POST
'http://127.0.0.1/gsa_test.gsa', Content_Type => 'form-data', Content => [
# 'action' => "Submit",
# 'pict' => [
# undef,
# 'captcha.png',
# 'Content_Type' => 'image/png',
# 'Content' => $temp_content
# ]
# ]);
my $captchakey = $response->content;
$c->send_response("Content-Type: text/html");
print $c $response->content;
}else{
$response = $ua->request( HTTP::Request->new(
$r->method,
'http://www.9kw.eu' . $newquery,
$r->headers,
$r->content)
);
if($debug == 1){
print W Dumper($response);
}
$c->send_response($response);
}
if($debug == 1){
close(W);
}
}else{
my $response = $ua->request( HTTP::Request->new(
$r->method,
$r->url,
$r->headers,
$r->content)
);
$c->send_response($response);
}
}
}
exit;

You might also like