Skip to content

Sakthe10/PRODIGY_CS_04

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Simple Keylogger

Create a basic keylogger program that records and logs keystrokes. Focus on logging the keys pressed and saving them to a file. (Note: Ethical considerations and permissions are crucial for projects involving keyloggers.)

Here's a basic keylogger program in Python. This program uses the pynput library to monitor keystrokes and save them to a log file. First, make sure you have the pynput library installed. You can install it using pip.You can do this by running the following command in your terminal of VS Code:

'pip install pynput'

After installing the library, you can run the code. It will start recording your keystrokes and saving them to a file named 'keylog.txt' in the same directory as your Python script.

This program first defines the on_key_press function, which is called whenever a key is pressed. The function gets the current timestamp and writes it to a log file along with the key that was pressed. The main function prints a message to the console indicating that the user can stop logging by pressing Ctrl+C. It then creates a listener using the keyboard.Listener class and passes the on_key_press function as the on_press parameter. This causes the on_key_press function to be called whenever a key is pressed. Finally, the listener is started using the join method.

Note that this program logs all keystrokes, including special keys like Ctrl, Alt, and Shift. It also logs keys that are pressed while the keylogger is running, so it may log unexpected keys if the user interacts with the console while the keylogger is running.

Additionally, it's important to note that creating and using keyloggers can be illegal in some jurisdictions and can be considered a violation of privacy. This code is intended for educational purposes only.

Releases

No releases published

Packages

No packages published

Languages