summaryrefslogtreecommitdiffstats
path: root/sploit/rev/elf.py
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2023-03-23 03:45:20 -0400
committerdusoleil <howcansocksbereal@gmail.com>2023-03-23 03:45:20 -0400
commitf388499a625af89e56669a8c76c65da21a7c1b1a (patch)
tree7a6dc96c090fa8abbfff00da26c7d088cd81c7c7 /sploit/rev/elf.py
parent382737c817a172a03b054bcc447437019eabcfb3 (diff)
downloadnsploit-f388499a625af89e56669a8c76c65da21a7c1b1a.tar.gz
nsploit-f388499a625af89e56669a8c76c65da21a7c1b1a.zip
rev: Use json output for get_bin_info()
Grabbing the json and returning that dict directly avoids all of the processing we were doing before. I also added in a small, temporary band-aid for PE files until we add actual support for them. The 'relro' key doesn't exist on PE files, so just default it to '' in ELF. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
Diffstat (limited to '')
-rw-r--r--sploit/rev/elf.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/sploit/rev/elf.py b/sploit/rev/elf.py
index 28cd08d..b1479d6 100644
--- a/sploit/rev/elf.py
+++ b/sploit/rev/elf.py
@@ -147,12 +147,12 @@ class ELF:
# Fancy magic class that provides a psuedo-namespace to get properties of the binary
def __init__(self, bininfo):
self.info = {
- "type" : bininfo.bintype,
- "os" : bininfo.os,
- "baddr" : int(bininfo.baddr,0),
- "arch_string" : bininfo.arch,
- "wordsize" : int(bininfo.bits)//8,
- "endianness" : bininfo.endian,
+ "type" : bininfo['bintype'],
+ "os" : bininfo['os'],
+ "baddr" : bininfo['baddr'],
+ "arch_string" : bininfo['arch'],
+ "wordsize" : bininfo['bits']//8,
+ "endianness" : bininfo['endian'],
}
def __getattr__(self, k):
return self.info[k]
@@ -166,15 +166,14 @@ class ELF:
class __SECINFO__(__BININFO__):
# Fancy magic class that provides a psuedo-namespace to get security properties of the binary
def __init__(self, bininfo):
- bool = lambda s : s == 'true' or s == 'True'
self.info = {
- "stripped" : bool(bininfo.stripped),
- "pic" : bool(bininfo.pic),
- "relro" : bininfo.relro,
- "relocs" : bool(bininfo.relocs),
- "canary" : bool(bininfo.canary),
- "nx" : bool(bininfo.nx),
- "rpath" : bininfo.rpath,
+ "stripped" : bininfo['stripped'],
+ "pic" : bininfo['pic'],
+ "relro" : bininfo.get('relro',''),
+ "relocs" : bininfo['relocs'],
+ "canary" : bininfo['canary'],
+ "nx" : bininfo['nx'],
+ "rpath" : bininfo['rpath'],
}
def retaddr(self, caller, callee):