summaryrefslogtreecommitdiffstats
path: root/sploit/rev/r2.py
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-03-11 09:19:25 -0500
committerdusoleil <howcansocksbereal@gmail.com>2022-03-13 23:27:30 -0400
commit8e2b4fab035279f18b015374121933b2f937a8fc (patch)
treef2ee9c71a48baf44d6471131ba5b38743a5b70f4 /sploit/rev/r2.py
parent729c5598b3fcb85e52c62bf19d28a7db2647659d (diff)
downloadsploit-8e2b4fab035279f18b015374121933b2f937a8fc.tar.gz
sploit-8e2b4fab035279f18b015374121933b2f937a8fc.zip
sploit: reverse direction of r2 get_locals offsets
rev.r2's get_locals() function returns a Symtbl of offsets representing the local variables on in a stack frame of a particular function. The offsets returned by r2 are based around the base of the stack, but they are increasing in value as they grow from the stack. To properly model memory, they should decrease in value as they grow from the stack. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
Diffstat (limited to 'sploit/rev/r2.py')
-rw-r--r--sploit/rev/r2.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sploit/rev/r2.py b/sploit/rev/r2.py
index cd4684f..c133c33 100644
--- a/sploit/rev/r2.py
+++ b/sploit/rev/r2.py
@@ -54,7 +54,7 @@ def get_locals(binary,func):
cmd_locals = f's {func};af;aafr;aaft;afvf'
out = r2.run_cmd(binary,cmd_locals)
out = [re.split(r':?\s+',var) for var in out]
- out = {var[1]:int(var[0],0)-arch.wordsize for var in out}
+ out = {var[1]:-(int(var[0],0)-arch.wordsize) for var in out}
return Symtbl(**out)
def ret_gadget(binary):