WireShark HTTP파싱 스크립트
programming/perl 2009. 9. 30. 19:01 |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 |