-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathserver.py
More file actions
82 lines (60 loc) · 2.16 KB
/
server.py
File metadata and controls
82 lines (60 loc) · 2.16 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
#!/usr/bin/python
import BaseHTTPServer
import json
import SocketServer
import SimpleHTTPServer
import platform
import subprocess
import os
import sys
import string
DEVNULL = open(os.devnull, 'wb')
browserPage = '/'
class PS4Console(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
path = self.path[1:]
path = string.replace(path, 'document/en/ps4/', '')
self.wfile.write(open(path).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 '[DEBUG] [LOG] ' + data_string
if '/debug/bin' in self.path:
filename = self.path.split("/")[-1]
dataString = self.rfile.read(int(self.headers['Content-length']))
self.send_response(200)
self.end_headers()
f = open('Dumps/' + filename, mode='wb')
f.write(dataString)
f.close()
print '[DEBUG] Binary has been dumped to %s' % filename
if '/debug/file' in self.path:
filename = self.path.split("/")[-1]
dataString = self.rfile.read(int(self.headers['Content-length']))
self.send_response(200)
self.end_headers()
f = open('Dumps/Files/' + filename, mode='wb')
f.write(dataString)
f.close()
def log_message(self, format, *args):
return
if __name__ == '__main__':
server_class = BaseHTTPServer.HTTPServer
httpd = server_class(('0.0.0.0', 80), PS4Console)
print("Starting fakedns.py. . .")
#subprocess.Popen(["python", "fakedns.py", "-c", "dns.conf"], stdout=DEVNULL, stderr=DEVNULL)
if platform.system() == 'Windows':
os.system("cls")
else:
os.system("clear")
print("Ready!\r\n")
try:
httpd.serve_forever()
except KeyboardInterrupt:
pass
httpd.server_close()