Skip to content

Commit

Permalink
add suggested changes
Browse files Browse the repository at this point in the history
Signed-off-by: Aryan Rajoria <[email protected]>
  • Loading branch information
aryan-rajoria committed Oct 8, 2024
1 parent c6226dc commit f5ff4de
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions blint/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,24 +907,32 @@ def add_elf_dynamic_entries(dynamic_entries, metadata):
if isinstance(dynamic_entries, lief.lief_errors):
return metadata
for entry in dynamic_entries:
if not hasattr(entry, 'name'):
if entry.tag == lief.ELF.DynamicEntry.TAG.NULL:
continue
if entry.tag in [
lief.ELF.DynamicEntry.TAG.SONAME,
lief.ELF.DynamicEntry.TAG.NEEDED,
lief.ELF.DynamicEntry.TAG.RUNPATH,
lief.ELF.DynamicEntry.TAG.RPATH,
]:
metadata["dynamic_entries"].append(
{
"name": demangle_symbolic_name(entry.name),
"tag": str(entry.tag).rsplit(".", maxsplit=1)[-1],
"value": entry.value,
}
)
# Detect dotnet binary
if "netcoredeps" in entry.name:
metadata["exe_type"] = "dotnetbinary"
if hasattr(entry, 'name'):
metadata["dynamic_entries"].append(
{
"name": demangle_symbolic_name(entry.name),
"tag": str(entry.tag).rsplit(".", maxsplit=1)[-1],
"value": entry.value,
}
)
if "netcoredeps" in entry.name:
metadata["exe_type"] = "dotnetbinary"
elif hasattr(entry, 'runpath'):
metadata["dynamic_entries"].append(
{
"runpath": demangle_symbolic_name(entry.runpath),
"tag": str(entry.tag).rsplit(".", maxsplit=1)[-1],
"value": entry.value,
}
)
return metadata


Expand Down

0 comments on commit f5ff4de

Please sign in to comment.