Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
add parameter for option to pass in ropgadget command
Browse files Browse the repository at this point in the history
  • Loading branch information
d4em0n committed Feb 6, 2020
1 parent 3284b55 commit 626675e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Exrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 626675e

Please sign in to comment.