-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.py
executable file
·55 lines (47 loc) · 1.65 KB
/
server.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
# Based on PS4 WebKit exploit
# https://github.com/Fire30/PS4-2014-1303-POC/blob/master/server.py
import BaseHTTPServer
import json
HOST_NAME = '0.0.0.0'
PORT_NUMBER = 80
dump_index = 0
class ExpServer(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
if '/scripts/' in self.path:
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
path = self.path[1:]
self.wfile.write(open(path).read())
else:
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(open('exploit.html').read())
def do_POST(self):
if '/debug/log' in self.path:
data_string = self.rfile.read(int(self.headers['Content-Length']))
self.send_response(200)
self.end_headers()
print data_string
if '/debug/bin' in self.path:
global dump_index
data_string = self.rfile.read(int(self.headers['Content-Length']))
self.send_response(200)
self.end_headers()
f = open('dumps/dump_%s.bin' % dump_index, mode='w')
f.write(data_string)
f.close()
print 'Saved dump to dump_%s.bin' % dump_index
dump_index += 1
def log_message(self, format, *args):
pass
if __name__ == '__main__':
dump_index = 0
server_class = BaseHTTPServer.HTTPServer
httpd = server_class((HOST_NAME, PORT_NUMBER), ExpServer)
try:
httpd.serve_forever()
except KeyboardInterrupt:
pass
httpd.server_close()