diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-03-11 09:27:00 -0500 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-03-13 23:27:30 -0400 |
commit | f239dd6d622a6c2a18cfee07aa2e2e120eef2deb (patch) | |
tree | 4ed3dd6dcb91e2f5f27c132d00a89fa0dea17e56 /tools | |
parent | 435890fec3cc62d67a154f5f6f4c04e21f81d7a5 (diff) | |
download | lib-des-gnux-f239dd6d622a6c2a18cfee07aa2e2e120eef2deb.tar.gz lib-des-gnux-f239dd6d622a6c2a18cfee07aa2e2e120eef2deb.zip |
sploit: fix r2 module syntax error
forgot to remove the r2 namespace from the calls from back when it was
implemented differently
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/sploit/sploit/rev/r2.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/sploit/sploit/rev/r2.py b/tools/sploit/sploit/rev/r2.py index c133c33..306e026 100644 --- a/tools/sploit/sploit/rev/r2.py +++ b/tools/sploit/sploit/rev/r2.py @@ -12,37 +12,37 @@ def get_elf_symbols(elf): out = {} cmd_syms = 'is~ FUNC ' - out_syms = r2.run_cmd(elf,cmd_syms) + out_syms = run_cmd(elf,cmd_syms) out_syms = [re.split(r'\s+',sym) for sym in out_syms] out_syms = {sym[6]:int(sym[2],0) for sym in out_syms if sym[6].find('.')<0} out.update(out_syms) cmd_syms = 'is~ LOOS ' - out_syms = r2.run_cmd(elf,cmd_syms) + out_syms = run_cmd(elf,cmd_syms) out_syms = [re.split(r'\s+',sym) for sym in out_syms] out_syms = {sym[6]:int(sym[2],0) for sym in out_syms if sym[6].find('.')<0} out.update(out_syms) cmd_syms = 'is~ TLS ' - out_syms = r2.run_cmd(elf,cmd_syms) + out_syms = run_cmd(elf,cmd_syms) out_syms = [re.split(r'\s+',sym) for sym in out_syms] out_syms = {sym[6]:int(sym[2],0) for sym in out_syms if sym[6].find('.')<0} out.update(out_syms) cmd_syms = 'ii~ FUNC ' - out_syms = r2.run_cmd(elf,cmd_syms) + out_syms = run_cmd(elf,cmd_syms) out_syms = [re.split(r'\s+',sym) for sym in out_syms] out_syms = {"_PLT_"+sym[4]:int(sym[1],0) for sym in out_syms} out.update(out_syms) cmd_syms = 'fs relocs;f' - out_syms = r2.run_cmd(elf,cmd_syms) + out_syms = run_cmd(elf,cmd_syms) out_syms = [re.split(r'\s+',sym) for sym in out_syms] out_syms = {"_GOT_"+sym[2][sym[2].rfind('.')+1:]:int(sym[0],0) for sym in out_syms} out.update(out_syms) cmd_strs = 'fs strings;f' - out_strs = r2.run_cmd(elf,cmd_strs) + out_strs = run_cmd(elf,cmd_strs) out_strs = [re.split(r'\s+',sym) for sym in out_strs] out_strs = {sym[2][sym[2].rfind('.')+1:]:int(sym[0],0) for sym in out_strs} out.update(out_strs) @@ -52,14 +52,14 @@ def get_elf_symbols(elf): def get_locals(binary,func): addr = hex(func) cmd_locals = f's {func};af;aafr;aaft;afvf' - out = r2.run_cmd(binary,cmd_locals) + out = 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} return Symtbl(**out) def ret_gadget(binary): cmd_ret = '/R/ ret~ret' - out = r2.run_cmd(binary,cmd_ret) + out = run_cmd(binary,cmd_ret) out = out[0] out = re.split(r'\s+',out) out = out[1] @@ -67,26 +67,26 @@ def ret_gadget(binary): def rop_gadget(binary,gad): cmd_gad = f'"/R/q {gad}"' - out = r2.run_cmd(binary,cmd_gad) + out = run_cmd(binary,cmd_gad) Gad = nt("Gad", "addr asm") out = [Gad(int(gad[:gad.find(':')],0),gad[gad.find(':')+2:]) for gad in out] return out def rop_gadget_exact(binary,gad): - gads = r2.rop_gadget(gad,elf) + gads = rop_gadget(gad,elf) for g in gads: if g.asm[:-1].replace('; ',';') == gad: return g def get_call_returns(binary,xref_from,xref_to): cmd_xrefs = f's {hex(xref_from)};af;axq' - xrefs = r2.run_cmd(binary,cmd_xrefs) + xrefs = run_cmd(binary,cmd_xrefs) xrefs = [re.split(r'\s+',x) for x in xrefs] xrefs = [x for x in xrefs if int(x[2],0)==xref_to] rets = [] CallRet = nt("CallRet", "xref_from xref_to call_addr ret_addr") for x in xrefs: cmd_ret = f's {x[0]};so;s' - ret = r2.run_cmd(binary,cmd_ret) + ret = run_cmd(binary,cmd_ret) rets.append(CallRet(xref_from,xref_to,int(x[0],0),int(ret[0],0))) return rets |