You can create a keylogger program using Python to capture the keystrokes typed through a computer's keyboard. The keystrokes are saved in a text file, and it records all input. You can use a key logger to monitor activity on your computer.
Video of the Day
Launch IDLE, click the "File" menu and select "New Window" to launch a new window. Press Ctrl and S to launch the "Save As" window. Use "getKeyLogger" as the file name and click "Save."
Add the following line of code to import the "Tkinter" namespace and define the path of the file you want to use to log:
import Tkinter as tk myFile = open("C:/temp/keyFile.txt", "w")
Copy and paste the following code to save every keystroke to the file:
def keypress(event): if event.keysym == 'Escape': main.destroy() keyPressed = event.char myFile.write(keyPressed)
Add the following code to let a user know he can start typing, and that he can press Esc to end the program:
main = tk.Tk() print "Press any key (Escape key to exit):" main.bind_all('
Click the "Windows" start button and type "cmd" in the "search programs and files" box. Press Enter to open the command prompt. Go to "C:\Python