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

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.


Friday, November 23, 2012

GET HTTP with Simplified Option(proxy / non-proxy)

#!/usr/bin/perl
############################################
#           [+]  Get HTTP
#       Created
#              BY
#                Pretorians
#
###########################################
use LWP::Simple;
use Time::localtime;
use LWP::UserAgent;
##
print "[+] GET Http Modem\n";
##
sub timestamp {
  my $c = localtime;
  return sprintf( "%04d-%02d-%02d_%02d-%02d-%02d",
                  $c->year + 1900, $c->mon + 1, $c->mday,
                  $c->hour, $c->min, $c->sec );
}
print '[+] Date: [' . timestamp() . ']'. "\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 = getprint("http://$t/") or die ("Unable to get page!");
}
##
sub usg(){
print "[!] usg: perl get.pl [-p or -n] \n";
print "[!]  -p: With Proxy\n";
print "[!]  -n: Without Proxy\n";
}
exit ;

Thursday, November 8, 2012

GET HTTP ( LWP with TOR )

#!/usr/bin/perl

use LWP::Simple;
use Time::localtime;
use LWP::UserAgent;
##
print "[+] GET Http Modem\n";
##
sub timestamp {
  my $c = localtime;
  return sprintf( "%04d-%02d-%02d_%02d-%02d-%02d",
                  $c->year + 1900, $c->mon + 1, $c->mday,
                  $c->hour, $c->min, $c->sec );
}

print '[+] Date: [' . timestamp() . ']'. "\n";

##
##

if (@ARGV == 0) {&usg;}
$t = shift(@ARGV);
{
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;
##
sub usg(){
print "[!] usg: perl get.pl  \n";
}
exit ;



p/s : Make sure you install the module of LWP::Protocol::socks to make the tor proxy working.
      
      #cpan install LWP::Protocol::socks

By the way this was simplified just for my own used.Everyone have their own view and style. Please google for more info.

Wednesday, November 7, 2012

GET HTTP (LWP:Simple/Time:LocalTime)

#!/usr/bin/perl

use LWP::Simple;
use Time::localtime;
print "[+] GET Http Modem\n";
##
sub timestamp {
  my $c = localtime;
  return sprintf( "%04d-%02d-%02d_%02d-%02d-%02d",
                  $c->year + 1900, $c->mon + 1, $c->mday,
                  $c->hour, $c->min, $c->sec );
}

print '[+] Date: [' . timestamp() . ']'. "\n";
##
##
if (@ARGV == 0) {&usg;}
$t = shift(@ARGV);
{
print "[!] Target: $t\n";
my $r = getprint("http://$t/") or die ("Unable to get page!");
##
##
}
sub usg(){
print "[!] usg: perl get.pl  \n";
}
exit ;

Tuesday, November 6, 2012

GET HTTP (IO::Socket)

#!/usr/bin/perl

use IO::Socket;

my $url = 'www.google.com';

my $socket = IO::Socket::INET->new(
Proto => 'tcp',
PeerAddr => $url,
PeerPort => 80) || die "|!| Can not connect...\n";

print "connecting to $url\n";
print $socket "GET $url HTTP/1.0\n\n";
$socket->recv(my $data, 1024);
print "$data \n";
close ($socket);

Credit to BufferCode