Skip to content

Commit

Permalink
Simplified location for exploit page, better Py2 detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Al-Azif committed Dec 30, 2017
1 parent 91e9e89 commit 64e1660
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,33 @@

from __future__ import print_function

import sys
if sys.version_info.major < 3:
print('This cannot be run under Python 2')
try:
input('Press [ENTER] to exit')
finally:
sys.exit()

import argparse
import hashlib
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
import mimetypes
import os
import re
import socket
from socketserver import ThreadingMixIn
import threading
import time

import FakeDns.fakedns as fakedns
try:
import argparse
import hashlib
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
import mimetypes
import os
import socket
from socketserver import ThreadingMixIn
import sys
import threading
import time

import FakeDns.fakedns as fakedns
except ImportError:
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')
try:
input('Press [ENTER] to exit')
finally:
sys.exit()

SCRIPT_LOC = os.path.realpath(__file__)
CWD = os.path.dirname(SCRIPT_LOC)
Expand Down Expand Up @@ -70,16 +76,14 @@ def do_GET(self):
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(buf.read())
elif self.path.endswith('.PUP'):
elif path.endswith('.PUP'):
path = os.path.join(CWD, 'updates', path)
with open(path, 'rb') as buf:
self.send_response(200)
self.send_header('Content-type', 'text/plain')
self.end_headers()
self.wfile.write(buf.read())
elif re.match('/document/[a-zA-Z\-]{2,5}/ps4/', self.path):
if not path:
path = 'index.html'
elif path == 'index.html' or self.path == '/':
mime = mimetypes.guess_type(path)
if not mime[0]:
mime[0] = 'application/octet-stream'
Expand Down Expand Up @@ -370,7 +374,7 @@ def getch():
def closer(message):
"""Closing method"""
print(message)
if message != '\r>> Exiting...':
if message != '\r>> Exiting... ':
print('Press any key to exit...', end='')
sys.stdout.flush()
if os.name == 'nt':
Expand Down Expand Up @@ -451,7 +455,7 @@ def main():
while True:
pass
except KeyboardInterrupt:
closer('\r>> Exiting...')
closer('\r>> Exiting... ')


if __name__ == '__main__':
Expand Down

0 comments on commit 64e1660

Please sign in to comment.