'ActivePerl'에 해당되는 글 2건

  1. 2009.09.30 WireShark HTTP파싱 스크립트
  2. 2009.09.30 HTTP요청 스크립트(ActivePerl)

wireshark export packet details-All expanded 에 대한 파싱스크립트

 

* HTTP GET *

==========================================================================================

if( $#ARGV < 0 )
  { die "Supply a file name, please.\n"; }
if( $#ARGV > 0 )
  { die "Too many parameter.\n"; }

$fileName = shift( @ARGV );

if( -d $fileName )
  { die "$fileName is a directory.\n"; }

-e $fileName || die "$fileName is not exist.\n";

-T $fileName || die "$fileName is not a text file.\n";

open( fileHandle, $fileName ) || die "Cannot open $fileName.\n";
$matching = 0;
$i=1;
while($aLine =<fileHandle>)
{
  if($aLine =~/^\s*?GET \//)
  {
    print $i.'.'.$aLine;
    $i = $i+1;
  }
}
close(fileHandle);
==========================================================================================

 

* HTTP Header *

==========================================================================================

if( $#ARGV < 0 )
  { die "Supply a file name, please.\n"; }
if( $#ARGV > 0 )
  { die "Too many parameter.\n"; }

$fileName = shift( @ARGV );

if( -d $fileName )
  { die "$fileName is a directory.\n"; }

-e $fileName || die "$fileName is not exist.\n";

-T $fileName || die "$fileName is not a text file.\n";

open( fileHandle, $fileName ) || die "Cannot open $fileName.\n";
$matching = 0;
$i=0;
while($aLine =<fileHandle>)
{
  if($aLine =~/^\s{4}\\r\\n/)
  {

    $matching = 0;
  }
  if($matching == 1)
  {
    print $i.'.'.$aLine;

   }
  if($aLine =~/Request Version: HTTP\/1\./)
  {
    $matching = 1;
    $i = $i+1;
  }

}
close(fileHandle);

==========================================================================================

'programming > perl' 카테고리의 다른 글

HTTP 파일업로드(Perl)  (0) 2009.12.30
web login dictionary attack  (0) 2009.12.03
HTTP요청 스크립트(ActivePerl) form-data  (0) 2009.11.19
apache log shooter(GET)  (0) 2009.10.11
HTTP요청 스크립트(ActivePerl)  (0) 2009.09.30
Posted by applicationlayer
:

* HTTP GET *

==========================================================================================

use LWP::UserAgent;
$ua = LWP::UserAgent->new;
require HTTP::Request;
require HTTP::Response;
if( $#ARGV != 1 )
  { die "Usage: geturireq.pl [target IP] [FileName]\nEx: geturireq.pl 192.168.1.20 Query.txt\n"; }
$ipaddress = $ARGV[0];
$fileName = $ARGV[1] ;
if( -d $fileName )
  { die "$fileName is a directory.\n"; }
-e $fileName || die "$fileName is not exist.\n";
-T $fileName || die "$fileName is not a text file.\n";
open( fileHandle, $fileName ) || die "Cannot open $fileName.\n";
$i = 1;
while($aLine =<fileHandle>)
{
  $qu = 'http://'.$ipaddress.$aLine;
  $req = HTTP::Request->new(GET => $qu);
  $res = $ua->request($req);
  print $i.'. '.$qu;
  $i=$i+1;
}

==========================================================================================

 

* HTTP Header *

==========================================================================================

use LWP::UserAgent;
$ua = LWP::UserAgent->new;
require HTTP::Request;
require HTTP::Response;
if( $#ARGV != 1 )
  { die "Usage: geturireq.pl [target IP] [FileName]\nEx: geturireq.pl 192.168.1.20 Query.txt\n"; }
$ipaddress = $ARGV[0];
$fileName = $ARGV[1] ;
if( -d $fileName )
  { die "$fileName is a directory.\n"; }
-e $fileName || die "$fileName is not exist.\n";
-T $fileName || die "$fileName is not a text file.\n";
open( fileHandle, $fileName ) || die "Cannot open $fileName.\n";
$i = 1;
while($aLine =<fileHandle>)
{
   $aLine=~/[\w_-]{1,30}(?=:\s)/;
   $fieldname = $&;
  
   $aLine=~/(?<=[\w_-]{4}:\s).+/;
   $fielddata=$&;
  $qu = 'http://'.$ipaddress.'_'.$i;
  $req = HTTP::Request->new(GET => $qu);
  $req->header($fieldname=>$fielddata);
  $res = $ua->request($req);
print $i." OK!\r\n";
$i=$i+1;
print $fieldname."\r\n".$fielddata."\r\n";
}

==========================================================================================

 

* HTTP Post Data *

==========================================================================================

use LWP::UserAgent;
$ua = LWP::UserAgent->new;
require HTTP::Request;
require HTTP::Response;
if( $#ARGV != 1 )
  { die "Usage: geturireq.pl [target IP] [FileName]\nEx: geturireq.pl 192.168.1.20 Query.txt\n"; }
$ipaddress = $ARGV[0];
$fileName = $ARGV[1] ;
if( -d $fileName )
  { die "$fileName is a directory.\n"; }

-e $fileName || die "$fileName is not exist.\n";

-T $fileName || die "$fileName is not a text file.\n";
open( fileHandle, $fileName ) || die "Cannot open $fileName.\n";
$i = 1;
while($aLine =<fileHandle>)
{
  $qu = 'http://'.$ipaddress.'/post_'.$i;
  $req = HTTP::Request->new(POST => $qu);
$req->content_type('application/x-www-form-urlencoded');
$req->content($aLine);
  $res = $ua->request($req);
  print $i."\x0d\x0a";
  $i=$i+1;
}

==========================================================================================

'programming > perl' 카테고리의 다른 글

HTTP 파일업로드(Perl)  (0) 2009.12.30
web login dictionary attack  (0) 2009.12.03
HTTP요청 스크립트(ActivePerl) form-data  (0) 2009.11.19
apache log shooter(GET)  (0) 2009.10.11
WireShark HTTP파싱 스크립트  (0) 2009.09.30
Posted by applicationlayer
: