Wednesday, November 28, 2012

GET HTTP(Proxy / IO:Socket / HTML::LinkExtor)

Latest update was HTML::LinkExtor as below.

#!/usr/bin/perl
############################################
#           [+]  Get HTTP
#       Created
#              BY
#                Pretorians
#
###########################################
use LWP::Simple;
use Time::localtime;
use LWP::UserAgent;
use  IO::Socket;
use HTML::LinkExtor;
##
print "[+] GET Http By Pretorians \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 ');
       $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);
}
##
##
if ($type eq "-e") {
print "[!] Target: $t\n";
my $r = get("http://$t/");
$LinkExtor = HTML::LinkExtor->new(\&links);
$LinkExtor->parse($r);
sub links
  {
    ($tag, %links) = @_;
      if ($tag eq "a") {
        foreach $key (keys %links) {
          if ($key eq "href") {
    print "$links{$key}\n";
      }
     }
    }
   }
  }
##
##
sub usg(){
print "[!] usg: perl get.pl [-p : -n : -e ] \n";
print "[!]  -p: With Proxy\n";
print "[!]  -n: Without Proxy\n";
print "[!]  -e: Link Extractor\n";
}
exit ;



p/s: Now I already have 3 options:

1: With Proxy
2: Without Proxy using IO:Socket
3: A Link Extractor

  That why i call my blog My Library where I dump and retrieve info backs for further viewing.At the same time I share it with you guys out there :D

No comments:

Post a Comment