summaryrefslogtreecommitdiffstats
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
commit435890fec3cc62d67a154f5f6f4c04e21f81d7a5 (patch)
tree802ba7e5de059f2f2ff78d1f8260b38636c99720
parent461df183a551566c4a24f6f075ebabdd7a59f32f (diff)
downloadlib-des-gnux-435890fec3cc62d67a154f5f6f4c04e21f81d7a5.tar.gz
lib-des-gnux-435890fec3cc62d67a154f5f6f4c04e21f81d7a5.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>
-rw-r--r--tools/sploit/sploit/rev/r2.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/sploit/sploit/rev/r2.py b/tools/sploit/sploit/rev/r2.py
index cd4684f..c133c33 100644
--- a/tools/sploit/sploit/rev/r2.py
+++ b/tools/sploit/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):