View Single Post
Old 19.02.2007, 17:08   #9
TheTester
Архивный участник
 
Join Date: Oct 2006
Posts: 112
Default

inside.dpr (sorry for trash in code):
Code:
library inside;

uses
Windows, 
WinSock,
uBlowFish; 

const
WM_COPYDATA=$004A; 
WM_DATA=$0400+256; 
ID_RECV=0; 
ID_SEND=1;
LOOP_PCK=#$04#$01#$01#$01#$7F#$00#$00#$01#$61#$1E#$00#$00#$00#$00#$E2#$05#$88#$13#$01#$00#$00#$00#$00#$00#$92#$0C#$E2#$05#$4B#$BD#$6F#$A5;
title='hLaPEx (LineAge Packets EXplorer by Hint)';

type
TSocket=integer;
TLogData = record
    IP: String[15];
    Port: Cardinal;
  end;

var
old_connect: function(s: TSocket; name: PSockAddr; namelen: Integer): Integer; stdcall;
h:integer;
ws:string;
ImageBase: Cardinal;
FileName: array [0..MAX_PATH - 1] of Char;

function new_connect(s: TSocket; name: PSockAddr; namelen: Integer): Integer; stdcall;
var
  CDS: TCopyDataStruct;
  Data: TLogData;
begin
  Data.IP := inet_ntoa(name.sin_addr);
  Data.Port := ntohs(name.sin_port);
  if not ((Data.Port=2106) or (Data.Port=2222) or ((Data.Port>=5001) and (Data.Port<=5004))) then
      begin
       CDS.cbData := SizeOf(TLogData);
       CDS.lpData := @Data;
       h:=FindWindow(nil,PChar(title));
       if h=0 then MessageBoxA(0,'hLaPEx not found','Interceptor',MB_ICONERROR);
       SendMessage(h, WM_COPYDATA, 0, Integer(@CDS));
       name.sin_port:=htons(7777);
       name.sin_addr.S_addr:=inet_addr('xx.x.0.1');
      end;
  Result := old_connect(s,name,namelen);
end;

begin
h:=FindWindow(nil,PChar(title));
if h=0 then
    begin
     MessageBoxA(0,'hLaPEx not found','Interceptor',MB_ICONERROR);
     exit;
    end;
ImageBase:=GetModuleHandle(nil);
ZeroMemory(@FileName, SizeOf(FileName));
GetModuleFileName(ImageBase, @FileName, SizeOf(FileName));
ws:='wsock32.dll';
if (Pos('L2WALKER.EXE', AnsiUpper(@FileName))<>0) then ws:='ws2_32.dll';
HookProc(PChar(ws),'connect',@new_connect,@old_connect);
end.
Hm. Anymore sources? =)

<rus>Учи ассемблер</rus>
TheTester is offline