diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-03-11 09:04:32 -0500 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-03-13 23:27:30 -0400 |
commit | 30004f849d2cbb91432cb2700379e17765eccb03 (patch) | |
tree | 04c951129983b28465b2ca4cf14bac88a707541f | |
parent | cdd6180dacf2fbd380b8a1c2fea38959a2953dbb (diff) | |
download | lib-des-gnux-30004f849d2cbb91432cb2700379e17765eccb03.tar.gz lib-des-gnux-30004f849d2cbb91432cb2700379e17765eccb03.zip |
sploit: add ldd ability to rev module
add helper function to invoke ldd to get a list of libraries that will
be linked to a given ELF
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r-- | tools/sploit/sploit/rev/__init__.py | 4 | ||||
-rw-r--r-- | tools/sploit/sploit/rev/ldd.py | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tools/sploit/sploit/rev/__init__.py b/tools/sploit/sploit/rev/__init__.py index e69de29..c489b98 100644 --- a/tools/sploit/sploit/rev/__init__.py +++ b/tools/sploit/sploit/rev/__init__.py @@ -0,0 +1,4 @@ +from . import ( + ldd +) + diff --git a/tools/sploit/sploit/rev/ldd.py b/tools/sploit/sploit/rev/ldd.py new file mode 100644 index 0000000..60306f1 --- /dev/null +++ b/tools/sploit/sploit/rev/ldd.py @@ -0,0 +1,10 @@ +import re +from subprocess import run +from collections import namedtuple as nt + +def get_libraries(elf): + out = run(['ldd',elf],capture_output=True).stdout.decode('utf-8').split('\n')[:-1] + 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 |