按键精灵吧 关注:500,099贴子:1,024,716
  • 18回复贴,共1

【知己知彼】游戏如何发现你用第三方之键盘钩子

只看楼主收藏回复

很多人都认为是什么行为捡测,行为捡测也许也有。但是几句简单的代码你前台后台模拟都会给你抓出来。
比如这个程序

手动按字母输入没有任何问题,一但用了其他如按键精灵的keypress 就会

后台也一样


1楼2016-06-01 18:47回复
    上面那个程序源码再简单不过,delphi7的。
    unit Unit1;
    interface
    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls;
    type
    TForm1 = class(TForm)
    Memo1: TMemo;
    Label1: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure meclose(Sender: TObject; var Action: TCloseAction);
    procedure memokeypress(Sender: TObject; var Key: Char);
    private
    { Private declarations }
    public
    { Public declarations }
    end;
    var
    Form1: TForm1;
    hook:integer;
    keyoff:boolean;
    function hookkeyproc(ncode:integer;wparam:wparam;lparam:lparam):lresult;stdcall; //键盘钩子回调函数
    implementation
    {$R *.dfm}
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    memo1.Text := '';
    hook := 0; keyoff := false;
    hook := setwindowshookex(13,@hookkeyproc,hInstance,0); //程序启动时安装钩子
    end;
    function hookkeyproc(ncode:integer;wparam:wparam;lparam:lparam):lresult;stdcall; //回调函数实现
    var
    nkey:array[0..5] of integer;
    begin
    if ncode = 0 then
    begin
    copymemory(@nkey,pointer(lparam),sizeof(nkey));
    if (nkey[2] <> 16) and (nkey[2] <> 144) then //判断标志位
    begin
    keyoff := true;
    end ;
    end ;
    result := callnexthookex(0,ncode,wparam,lparam);
    end ;
    procedure TForm1.meclose(Sender: TObject; var Action: TCloseAction);
    begin
    unhookwindowshookex(hook); //程序关闭时卸载钩子
    end;
    procedure TForm1.memokeypress(Sender: TObject; var Key: Char);
    begin
    if not keyoff then
    begin
    form1.Label1.Caption := '你使用了第三方程序模拟按键';
    end;
    keyoff := false;
    end;
    end.


    2楼2016-06-01 18:48
    回复
      2025-05-28 10:05:16
      广告
      上面键盘钩子能抓到你的keypress 如果再挂个鼠标钩子也能抓到你的leftclick
      当然,如果是硬件模拟或者超级模拟这个就抓不到了


      3楼2016-06-01 18:53
      收起回复
        厉害厉害


        来自WindowsPhone客户端4楼2016-06-01 19:13
        回复
          一句话一个分号好无力…


          IP属地:广东来自iPhone客户端5楼2016-06-01 19:31
          收起回复
            有什么不用按键精灵达到得比如长按某键的功能吗?比如cmd能否实现?


            IP属地:江苏来自Android客户端6楼2016-06-02 02:12
            收起回复
              指狗为鸡大师 精通多个语言呀。
              按键精灵,VB.NET,Delphi……
              精通一个,再学不难。而且可以增强知识面,开阔眼界。


              IP属地:广东来自手机贴吧7楼2016-06-02 16:12
              回复
                这样的话能不能实现后台呢


                8楼2016-11-17 17:08
                收起回复