text stringlengths 1 93.6k |
|---|
if sys.version_info.major < 3:
|
print("ERROR: This must be run on Python 3")
|
try:
|
input("Press [ENTER] to exit")
|
finally:
|
sys.exit()
|
else:
|
print("ERROR: Import Error")
|
print("Download from the releases page or clone with `--recursive`")
|
try:
|
input("Press [ENTER] to exit")
|
finally:
|
sys.exit()
|
VERSION = "0.5.1"
|
API_URL = "https://api.github.com/repos/Al-Azif/ps4-exploit-host/releases/latest"
|
SCRIPT_LOC = os.path.realpath(__file__)
|
CWD = ""
|
if getattr(sys, "frozen", False):
|
# PyInstaller
|
CWD = os.path.abspath(os.path.dirname(sys.executable))
|
elif __file__:
|
# Script
|
CWD = os.path.dirname(SCRIPT_LOC)
|
EXPLOIT_LOC = os.path.join(CWD, "exploits")
|
PAYLOAD_LOC = os.path.join(CWD, "payloads")
|
UPDATE_LOC = os.path.join(CWD, "updates")
|
THEME_LOC = os.path.join(CWD, "themes")
|
DEBUG_LOC = os.path.join(CWD, "debug")
|
PKG_LOC = os.path.join(CWD, "pkgs")
|
SETTINGS = None
|
MENU_OPEN = False
|
DEBUG_VAR = {}
|
SCRIPT_START = (datetime.datetime.now(datetime.UTC)).strftime("%a, %d %b %Y %H:%M:%S GMT")
|
def UNUSED(variable):
|
return variable
|
class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
|
daemon_threads = True
|
allow_resuse_address = True
|
request_queue_size = 16
|
class MyHandler(BaseHTTPRequestHandler):
|
try:
|
with open(os.path.join(THEME_LOC, "error.html"), "rb") as buf:
|
error_message_format = buf.read().decode("utf-8")
|
except (IOError, PermissionError):
|
pass
|
protocol_version = "HTTP/1.1"
|
def send_response(self, code, message=None):
|
self.log_request(code)
|
self.send_response_only(code, message)
|
def last_mod_time(self, path):
|
return datetime.datetime.utcfromtimestamp(os.path.getmtime(path)).strftime("%a, %d %b %Y %H:%M:%S GMT")
|
def my_send_error(self, code, message=None, explain=None):
|
try:
|
self.send_error(code, message, explain)
|
except:
|
pass # print('ERROR: Broken Pipe')
|
def my_sender(self, mime, content, extra_headers={}):
|
if SETTINGS["Compression_Level"] > 0:
|
gzip = zlib.compressobj(SETTINGS["Compression_Level"], zlib.DEFLATED, zlib.MAX_WBITS | 16)
|
content = gzip.compress(content) + gzip.flush()
|
try:
|
self.send_response(200)
|
self.send_header("Content-Type", mime)
|
if SETTINGS["Compression_Level"] > 0:
|
self.send_header("Content-Encoding", "gzip")
|
self.send_header("Content-Length", len(content))
|
self.send_header("Connection", "keep-alive")
|
for key, value in extra_headers.items():
|
self.send_header(key, value)
|
self.end_headers()
|
self.wfile.write(content)
|
except: # socket.error
|
pass # print('ERROR: Broken Pipe')
|
def empty_response(self):
|
self.my_sender("text/plain", b"", {"Last-Modified": SCRIPT_START}) # TODO: Cache-Control Headers
|
def check_ua(self):
|
for user_agent in SETTINGS["Valid_UA"]:
|
ua_test = re.compile(user_agent)
|
if ua_test.match(self.headers["User-Agent"]):
|
return True
|
return False
|
def ps4_updatelist(self):
|
region = self.path.split("/")[4]
|
try:
|
ps4_version = re.search(r"^Download\/1.00 libhttp\/(.+?) \(PlayStation 4\)$", self.headers["User-Agent"])
|
ps4_net_test = re.match(r"^HttpTestWrapperUser libhttp\/.* \(PlayStation 4\)$", self.headers["User-Agent"])
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.