Skip to content

Commit

Permalink
fixes #911
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Hunhoff committed Mar 21, 2022
1 parent 1b2f0fc commit dd092bb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions capa/features/extractors/ida/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,17 @@ def extract_file_function_names():


def extract_file_format():
format_name = ida_loader.get_file_type_name()
file_info = idaapi.get_inf_structure()

if "PE" in format_name:
if file_info.filetype == idaapi.f_PE:
yield Format(FORMAT_PE), 0x0
elif "ELF64" in format_name:
yield Format(FORMAT_ELF), 0x0
elif "ELF32" in format_name:
elif file_info.filetype == idaapi.f_ELF:
yield Format(FORMAT_ELF), 0x0
elif file_info.filetype == idaapi.f_BIN:
# no file type to return when processing a binary file, but we want to continue processing
return
else:
raise NotImplementedError("file format: %s", format_name)
raise NotImplementedError("file format: %d" % file_info.filetype)


def extract_features():
Expand Down

0 comments on commit dd092bb

Please sign in to comment.