diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-03-11 10:15:35 -0500 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-03-13 23:27:30 -0400 |
commit | 352fe42c6e5e4f5996289bc0d9479c1be19c1117 (patch) | |
tree | f2efffd2041b31319fb539ba4d802427d5d69f5e | |
parent | 2340245d685ec19e6517f95c1ff8dc8b9249e873 (diff) | |
download | lib-des-gnux-352fe42c6e5e4f5996289bc0d9479c1be19c1117.tar.gz lib-des-gnux-352fe42c6e5e4f5996289bc0d9479c1be19c1117.zip |
sploit: add ELF helper class to rev
Create a class which encapsulates some basic information about an ELF
file and provides a convenient interface for basic reverse engineering.
In particular, ELF automatically loads the symbol table of the given elf
file and recursively creates ELF objects for any linked libraries.
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r-- | tools/sploit/sploit/rev/__init__.py | 1 | ||||
-rw-r--r-- | tools/sploit/sploit/rev/elf.py | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tools/sploit/sploit/rev/__init__.py b/tools/sploit/sploit/rev/__init__.py index b6a73a2..43cee7b 100644 --- a/tools/sploit/sploit/rev/__init__.py +++ b/tools/sploit/sploit/rev/__init__.py @@ -1,5 +1,6 @@ from . import ( ldd, r2, + elf, ) diff --git a/tools/sploit/sploit/rev/elf.py b/tools/sploit/sploit/rev/elf.py new file mode 100644 index 0000000..a748f10 --- /dev/null +++ b/tools/sploit/sploit/rev/elf.py @@ -0,0 +1,22 @@ +from sploit.rev import ldd, r2 + +class ELF: + def __init__(self, path): + self.path = path + self.sym = r2.get_elf_symbols(self.path) + libs = ldd.get_libraries(self.path) + self.libs = {lib.name:ELF(lib.path) for lib in libs.values() if lib.path} + + def __str__(self): + s = 'ELF: ' + s += self.path + s += '\nSymbol Table' + s += '\n------------' + s += '\n' + s += str(self.sym) + s += '\n------------' + s += '\nLibararies' + s += '\n------------' + for name,lib in self.libs.items(): + s += '\n' + str(name) + ' => ' + str(lib.path) + return s |