Monday, November 26, 2012

GET HTTP (Proxy or using IO::Socket)

#!/usr/bin/perl
############################################
#           [+]  Get HTTP
#       Created
#              BY
#                Pretorians
#
###########################################
use LWP::Simple;
use Time::localtime;
use LWP::UserAgent;
use  IO::Socket;
##
print "[+] GET Http \n";
##
##
if (@ARGV == 0) {&usg;}
while (@ARGV > 0) {
$type = shift(@ARGV);
$t = shift(@ARGV);
if ($type eq "-p") {
print "[!] Target: $t\n";
my $ua = LWP::UserAgent->new;
     $ua->agent('Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:16.0) Gecko/20100101 Firefox/16.0');
       $ua->proxy([(http )] => 'socks://127.0.0.1:9050');
        $ua->cookie_jar({});
      my $r = $ua->get("http://$t/") or die ("Unable to get page!");
print $r->content;
}}
##
##
if ($type eq "-n") {
print "[!] Target: $t\n";
my $r = ("http://$t/");
my $socket = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => $t,
PeerPort => 80) || die "|!| Can not connect...\n";
print "connecting to $t\n";
print $socket "GET $t HTTP/1.0\n\n";
$socket->recv(my $data, 1024);
print "$data \n";
close ($socket);
}
##
sub usg(){
print "[!] usg: perl get.pl [-p or -n] \n";
print "[!]  -p: With Proxy\n";
print "[!]  -n: Without Proxy\n";
}
exit ;





I just dump the code in here only.Still the same nothing change..just slot it to make it as an option either choose Get HTTP with proxy or Get HTTP without Proxy.

My main target is only about the HTTP request / date / server name content-type and also a menu to choose either -p or - n :D.Basically for modem.


No comments:

Post a Comment