mirror of
https://github.com/dobin/SuperMega
synced 2026-06-02 17:27:10 +00:00
feature: show all exports on DLLs
This commit is contained in:
@@ -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
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user