feature: show all exports on DLLs

This commit is contained in:
Dobin
2024-04-13 10:28:05 +01:00
parent a95203e2b5
commit f40d527783
2 changed files with 16 additions and 5 deletions
+3 -3
View File
@@ -48,17 +48,17 @@ def project(name):
if os.path.exists(exe_path):
is_built = True
exports = None
exports = []
is_64 = False
is_dotnet = False
# Only when we selected an input file
# when we selected an input file
if project.settings.inject_exe_in != "":
superpe = SuperPe(project.settings.inject_exe_in)
is_64 = superpe.is_64()
is_dotnet = superpe.is_dotnet()
if superpe.is_dll():
exports = [ "", "BZ2_blockSort" ]
exports = superpe.get_exports()
project_dir = os.path.dirname(os.path.abspath(project.settings.inject_exe_out))
log_files = get_logfiles(project.settings.main_dir)
+13 -2
View File
@@ -48,7 +48,7 @@ class SuperPe():
self.ptrSize = 8
def is_dll(self):
def is_dll(self) -> bool:
return self.filepath.endswith(".dll")
@@ -57,7 +57,6 @@ class SuperPe():
def is_dotnet(self) -> bool:
# DotNet or not
# https://stackoverflow.com/questions/45574925/is-there-a-way-to-check-if-an-exe-is-dot-net-with-python-pefile
entry = self.pe.OPTIONAL_HEADER.DATA_DIRECTORY[14]
if entry.VirtualAddress != 0 and entry.Size != 0:
@@ -235,6 +234,18 @@ class SuperPe():
i += 1
def get_exports(self) -> List[str]:
"""Return a list of exported functions (names) from the PE file"""
d = [pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_EXPORT"]]
self.pe.parse_data_directories(directories=d)
if self.pe.DIRECTORY_ENTRY_EXPORT.symbols == 0:
return []
res = []
for e in self.pe.DIRECTORY_ENTRY_EXPORT.symbols:
res.append(e.name.decode())
return res
## Helpers
def get_entrypoint(self) -> int: