summaryrefslogtreecommitdiffstats
path: root/sploit/rev/ldd.py
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2022-03-14 00:43:15 -0400
committerMalfurious <m@lfurio.us>2022-03-14 00:43:15 -0400
commit616c8b8eadbde6fbb2fe16a6a2167e04f9d16382 (patch)
tree6560d8b5fea2b40d041f52683cd7accc61ce67a5 /sploit/rev/ldd.py
parentdcba5f2b3d13f5142e4e552bdd717286f953bf1a (diff)
parentc493a8f8073702bcdccdbc40bf09931e201c9013 (diff)
downloadnsploit-616c8b8eadbde6fbb2fe16a6a2167e04f9d16382.tar.gz
nsploit-616c8b8eadbde6fbb2fe16a6a2167e04f9d16382.zip
Merge tag 'pull-sploit-rev' of https://github.com/Dusoleil/lib-des-gnux
Add rev for basic reverse engineering * tag 'pull-sploit-rev' of https://github.com/Dusoleil/lib-des-gnux: sploit: Move __attr_filter__ to a general place in util sploit: Filter all magic python members by default in mem module sploit: add stack base pointer to locals symtbl sploit: print hex of addresses in rev logs sploit: add status logging to rev module sploit: lazy load libs for ELF sploit: cache results of external commands sploit: add the rest of r2 functions through elf sploit: typo fix in rev.r2 sploit: cache ELF loads sploit: add ELF helper class to rev sploit: consolidate r2 symbol search calls sploit: fix r2 module syntax error sploit: reverse direction of r2 get_locals offsets sploit: add r2 funcionality to rev module sploit: add ldd ability to rev module sploit: add rev module to sploit
Diffstat (limited to 'sploit/rev/ldd.py')
-rw-r--r--sploit/rev/ldd.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/sploit/rev/ldd.py b/sploit/rev/ldd.py
new file mode 100644
index 0000000..1a28c7c
--- /dev/null
+++ b/sploit/rev/ldd.py
@@ -0,0 +1,13 @@
+from sploit.util import run_cmd_cached
+from sploit.log import ilog
+
+import re
+from collections import namedtuple as nt
+
+def get_libraries(elf):
+ ilog(f'Retrieving linked libraries of {elf} with ldd...')
+ out = run_cmd_cached(['ldd',elf])
+ out = [re.split(r'\s+',lib)[1:] for lib in out]
+ Lib = nt("Lib", "name path addr")
+ out = {l[0]:Lib(l[0],l[0] if l[0][0]=='/' else l[2] if l[1]=='=>' else None,l[-1]) for l in out}
+ return out