summaryrefslogtreecommitdiffstats
path: root/sploit/rev/r2.py
diff options
context:
space:
mode:
Diffstat (limited to 'sploit/rev/r2.py')
-rw-r--r--sploit/rev/r2.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/sploit/rev/r2.py b/sploit/rev/r2.py
index b9df8ad..bd4133e 100644
--- a/sploit/rev/r2.py
+++ b/sploit/rev/r2.py
@@ -127,3 +127,15 @@ def get_call_returns(binary,xref_from,xref_to):
ret = run_cmd(binary,cmd_ret)
rets.append(CallRet(xref_from,xref_to,int(x[0],0),int(ret[0],0)))
return rets
+
+def get_bin_info(binary):
+ ilog(f'Retrieving binary and security info about {binary} with r2...')
+
+ BinInfo = nt("BinInfo", "bintype os arch bits endian baddr canary nx pic relocs relro rpath stripped")
+ cmd_info = 'iI'
+ info = run_cmd(binary, cmd_info)
+ info = [re.split(r'\s+',i,1) for i in info]
+ info = {i[0]:i[1] for i in info}
+ info = [info[f] for f in BinInfo._fields]
+ ret = BinInfo(*info)
+ return ret