From 626675e8adff79cd3c16cb7a377d68e2dafbe80c Mon Sep 17 00:00:00 2001 From: n0psledbyte Date: Thu, 6 Feb 2020 22:06:11 +0700 Subject: [PATCH] add parameter for option to pass in ropgadget command --- Exrop.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Exrop.py b/Exrop.py index fd90b04..7e7d82b 100644 --- a/Exrop.py +++ b/Exrop.py @@ -3,8 +3,8 @@ from os import popen import code -def parseRopGadget(filename): - cmd = 'ROPgadget --binary {} --multibr --only "pop|xchg|add|sub|xor|mov|ret|jmp|call|syscall|leave" --dump | tail -n +3 | head -n -2'.format(filename) +def parseRopGadget(filename, opt=""): + cmd = 'ROPgadget {} --binary {} --multibr --only "pop|xchg|add|sub|xor|mov|ret|jmp|call|syscall|leave" --dump | tail -n +3 | head -n -2'.format(opt, filename) with popen(cmd) as fp: sample_gadgets = dict() datas = fp.read().strip().split("\n") @@ -22,7 +22,7 @@ def __init__(self, binary): self.binary = binary self.chain_builder = ChainBuilder() - def find_gadgets(self, cache=False): + def find_gadgets(self, cache=False, add_opt=""): if cache: fcname = "./{}.exrop_cache".format(self.binary.replace("/", "_")) try: @@ -32,7 +32,7 @@ def find_gadgets(self, cache=False): return except FileNotFoundError: fc = open(fcname, "wb") - gadgets = parseRopGadget(self.binary) + gadgets = parseRopGadget(self.binary, add_opt) self.chain_builder.load_list_gadget_string(gadgets) self.chain_builder.analyzeAll() if cache: