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>)
{
  if($aLine=~/(?<=GET\s).*(?=\sHTTP\/\d\.\d)/)
  {
  $qu = 'http://'.$ipaddress.$&;
  $req = HTTP::Request->new(GET => $qu);
  $res = $ua->request($req);
  print $i.'. '.$qu."\r\n";
  $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
WireShark HTTP파싱 스크립트  (0) 2009.09.30
HTTP요청 스크립트(ActivePerl)  (0) 2009.09.30
Posted by applicationlayer
:

DLL Injector

hooking 2009. 10. 2. 07:16 |

어느 DLL Injector를 보고 동일하게 구현해본 프로그램

OpenProcess>GetModuleHandle>GetProcAddress>VirtualAllocEx>WriteProcessMemory>CreateRemoteThread

'hooking' 카테고리의 다른 글

outputdebugstring사용  (0) 2011.06.25
[펌]메시지훅 예제  (0) 2009.11.02
지뢰찾기 핵  (0) 2009.11.01
hooking_study_1  (0) 2009.10.23
Posted by applicationlayer
:

실행중인 프로세스ID를 얻는 방법중 Toolhelp32를 이용한 방법과 PSAPI를 이용한 방법이 있다.
표준 API함수인 Toolhelp32를 이용하는 방법에 대하여 알아보기로 한다.
사용되는 함수는 다음과 같다.
CreateToolhelp32Snapshot(), Process32First(), Process32Next()


예제소스
#include <tlhelp32.h>

HANDLE hProcessSnap;
PROCESSENTRY32 pe32; //프로세스정보를 저장할 구조체
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
Process32First( hProcessSnap, &pe32 );
    printf( "\n  Process ID        = 0x%08X", pe32.th32ProcessID );
    printf( "\n  Thread count      = %d",   pe32.cntThreads );
    printf( "\n  Parent process ID = 0x%08X", pe32.th32ParentProcessID );
    printf( "\n  Priority base     = %d", pe32.pcPriClassBase );
while(Process32Next( hProcessSnap, &pe32 ))
{
    printf( "\n  Process ID        = 0x%08X", pe32.th32ProcessID );
    printf( "\n  Thread count      = %d",   pe32.cntThreads );
    printf( "\n  Parent process ID = 0x%08X", pe32.th32ParentProcessID );
    printf( "\n  Priority base     = %d", pe32.pcPriClassBase );
}



PROCESSENTRY32 구조 (tlhelp32.h)
 typedef struct tagPROCESSENTRY32
{
    DWORD   dwSize;
    DWORD   cntUsage;
    DWORD   th32ProcessID;          // this process
    DWORD   th32DefaultHeapID;
    DWORD   th32ModuleID;           // associated exe
    DWORD   cntThreads;
    DWORD   th32ParentProcessID;    // this process's parent process
    LONG    pcPriClassBase;         // Base priority of process's threads
    DWORD   dwFlags;
    CHAR    szExeFile[MAX_PATH];    // Path
} PROCESSENTRY32;

 

참조: http://support.microsoft.com/kb/175030/ko

'windows' 카테고리의 다른 글

PIMAGE_IMPORT_DESCRIPTOR  (0) 2010.05.24
WinNT.h  (0) 2010.05.24
GetModuleHandle과 LoadLibrary  (0) 2010.05.11
context switch  (0) 2009.10.01
세그먼트 레지스터  (0) 2009.10.01
Posted by applicationlayer
: