|
4 | 4 | Source: https://github.com/Al-Azif/ps4-exploit-host
|
5 | 5 | """
|
6 | 6 |
|
| 7 | +from __future__ import print_function |
| 8 | + |
| 9 | + |
| 10 | +import sys |
| 11 | +if sys.version_info.major < 3: |
| 12 | + print('This cannot be run under Python 2') |
| 13 | + try: |
| 14 | + input('Press [ENTER] to exit') |
| 15 | + finally: |
| 16 | + sys.exit() |
| 17 | + |
7 | 18 | import argparse
|
8 | 19 | import hashlib
|
9 | 20 | from http.server import BaseHTTPRequestHandler
|
|
13 | 24 | import os
|
14 | 25 | import re
|
15 | 26 | import socket
|
16 |
| -import sys |
17 | 27 | import threading
|
18 | 28 | import time
|
19 | 29 |
|
@@ -307,25 +317,28 @@ def payload_menu(payloads):
|
307 | 317 | def send_payload(hostname, port, content):
|
308 | 318 | """Netcat implementation"""
|
309 | 319 | soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
310 |
| - timeout = time.time() + 60 |
| 320 | + timeout = time.time() + 15 |
311 | 321 | while True:
|
312 | 322 | result = soc.connect_ex((hostname, port))
|
313 | 323 | if result == 0:
|
314 | 324 | print('>> Connected to PS4')
|
315 | 325 | timed_out = False
|
316 | 326 | break
|
317 | 327 | if time.time() >= timeout:
|
318 |
| - print('>> Netcat service timed out') |
| 328 | + print('ERROR: Payload sender timed out') |
319 | 329 | timed_out = True
|
320 | 330 | break
|
321 | 331 | if not timed_out:
|
322 |
| - soc.sendall(content) |
323 |
| - soc.shutdown(socket.SHUT_WR) |
324 |
| - while True: |
325 |
| - data = soc.recv(1024) |
326 |
| - if not data: |
327 |
| - break |
328 |
| - print('>> Payload Sent!') |
| 332 | + try: |
| 333 | + soc.sendall(content) |
| 334 | + soc.shutdown(socket.SHUT_WR) |
| 335 | + while True: |
| 336 | + data = soc.recv(1024) |
| 337 | + if not data: |
| 338 | + break |
| 339 | + print('>> Payload Sent!') |
| 340 | + except socket.error: |
| 341 | + print('ERROR: Broken Pipe (Out of Memory Error?)') |
329 | 342 | soc.close()
|
330 | 343 |
|
331 | 344 |
|
@@ -418,7 +431,8 @@ def main():
|
418 | 431 | if not args.e_type:
|
419 | 432 | args.e_type = exploit_menu()
|
420 | 433 |
|
421 |
| - if os.path.isdir(os.path.join(EXPLOIT_LOC, args.e_type)) and args.e_type: |
| 434 | + if os.path.isdir(os.path.join(EXPLOIT_LOC, args.e_type)) \ |
| 435 | + and args.e_type: |
422 | 436 | EXPLOIT_LOC = os.path.join(EXPLOIT_LOC, args.e_type)
|
423 | 437 | else:
|
424 | 438 | closer('ERROR: Could not find exploit specified')
|
|
0 commit comments