summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sploit/rev/elf.py4
-rw-r--r--sploit/rev/r2.py3
2 files changed, 4 insertions, 3 deletions
diff --git a/sploit/rev/elf.py b/sploit/rev/elf.py
index 990cfde..28cd08d 100644
--- a/sploit/rev/elf.py
+++ b/sploit/rev/elf.py
@@ -198,8 +198,8 @@ class ELF:
cont (bool): If true, this function will return all of the assembly past
the found gadget up to the next return point.
"""
- return r2.rop_gadgets(self.path, *regexes, cont=cont)
+ return [ self.sym[g] for g in r2.rop_gadgets(self.path, *regexes, cont=cont) ]
def gadget(self, *regexes):
"""Returns the first gadget found that matches the given regex list."""
- return r2.rop_gadget(self.path, *regexes)
+ return self.sym[r2.rop_gadget(self.path, *regexes)]
diff --git a/sploit/rev/r2.py b/sploit/rev/r2.py
index 24ab1f8..7101f07 100644
--- a/sploit/rev/r2.py
+++ b/sploit/rev/r2.py
@@ -80,6 +80,7 @@ def rop_gadgets(binary, *regexes, cont=False):
ilog(f"Searching {binary} for {'; '.join(regexes)} gadgets with r2...")
gadgets = rop_json(binary)
results = []
+ base = int(get_bin_info(binary).baddr, 0)
for gadget in gadgets:
opcodes = gadget['opcodes']
@@ -90,7 +91,7 @@ def rop_gadgets(binary, *regexes, cont=False):
size = end_idx - idx
regexes_use = (regexes + (".*",) * size) if cont else regexes
- offset = opcodes[idx]['offset']
+ offset = opcodes[idx]['offset'] - base
matches = []
for regex in regexes_use: