A simple keylogger that logs keystrokes for a specified duration and saves them to a file.
This keylogger tool captures keystrokes for a user-defined duration and saves the logged keys to a file named keylog.txt
. It uses the pynput
library to listen for keyboard events.
- Keylogging: Capture keystrokes and store them in a buffer.
- Duration Control: Run the keylogger for a specified amount of time.
- File Logging: Save the captured keystrokes to
keylog.txt
. - Real-time Feedback: Display remaining time in the console.
To set up this project, you need to have Python installed on your machine. Follow the steps below:
-
Clone the repository:
git clone https://github.com/Anandkp21/PRODIGY_CS_TASK_04.git
-
Navigate to the project directory:
cd keylogger-tool
-
Install required dependencies:
pip install pynput
-
Run the keylogger:
python keylog.py
-
Run the keylogger script:
python keylog.py
-
Enter the duration:
- You will be prompted to enter the duration for which you want the keylogger to run (in seconds).
-
Keylogger in action:
- The keylogger will start and capture all keystrokes for the specified duration.
- The remaining time will be displayed in the console.
-
Completion:
- After the duration ends, the captured keystrokes will be saved to
keylog.txt
.
- After the duration ends, the captured keystrokes will be saved to
$ python keylog.py
Enter the duration for which you want to run the keylogger (in seconds):
10
Time duration to run: 10 seconds
Remaining time: 9 seconds
Remaining time: 8 seconds
...
Remaining time: 1 second
Keys logged to 'keylog.txt'
$ cat keylog.txt
hello world
This project is licensed under the MIT License. See the LICENSE file for details.