diff --git a/autoRop.py b/autoRop.py index f72e9d6..3811e04 100755 --- a/autoRop.py +++ b/autoRop.py @@ -42,6 +42,7 @@ arg_parser.add_argument("--min_payload", metavar="min", default=32, type=int, he arg_parser.add_argument("--max_payload", metavar="max", default=16384, type=int, help="The maximum payload length to try") arg_parser.add_argument("--input_method", metavar="method", choices=['arg', 'file', 'stdin'], default='arg', help="Method of passing the payload to the target binary") arg_parser.add_argument("--run", action="store_true", default=False, help="Automatically run the ROP on the executable") +arg_parser.add_argument("--interactive", action="store_true", default=False, help="Automatically run the ROP on the executable") args = arg_parser.parse_args() @@ -52,8 +53,9 @@ min_payload = args.min_payload max_payload = args.max_payload run = args.run input_method = args.input_method +interactive = args.interactive -def run_program(payload: str, **kwargs): +def run_program(payload: str, **kwargs) -> process: p = None if input_method == 'arg': p = process([f'./{exec_file}', payload], **kwargs) @@ -82,7 +84,7 @@ def find_offset_inc(low: int, high: int): "--ropFile", rop_file, "--execFile", 'rop_exec_default.json', ], - stdout = subprocess.PIPE + stdout = subprocess.DEVNULL ) with open(rop_file, 'rb') as f: @@ -156,6 +158,10 @@ if run: print() print(f"[ Run Program : ./{exec_file} {rop_file} ]") with open(rop_file, 'rb') as f: - term.init() p = run_program(f.read()) - p.interactive() + + if interactive: + term.init() + p.interactive() + else: + print(p.recvall().decode('utf-8'))