Skip to content

Commit

Permalink
Merge pull request #820 from mandiant/fix/linter-file-format
Browse files Browse the repository at this point in the history
auto recognize shellcode based on file extension
  • Loading branch information
williballenthin authored Nov 2, 2021
2 parents 10dc895 + e9170a1 commit e9a7dbc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,16 @@ def get_sample_capabilities(ctx: Context, path: Path) -> Set[str]:
logger.debug("found cached results: %s: %d capabilities", nice_path, len(ctx.capabilities_by_sample[path]))
return ctx.capabilities_by_sample[path]

if nice_path.endswith(capa.main.EXTENSIONS_SHELLCODE_32):
format = "sc32"
elif nice_path.endswith(capa.main.EXTENSIONS_SHELLCODE_64):
format = "sc64"
else:
format = "auto"

logger.debug("analyzing sample: %s", nice_path)
extractor = capa.main.get_extractor(
nice_path, "auto", capa.main.BACKEND_VIV, DEFAULT_SIGNATURES, False, disable_progress=True
nice_path, format, capa.main.BACKEND_VIV, DEFAULT_SIGNATURES, False, disable_progress=True
)

capabilities, _ = capa.main.find_capabilities(ctx.rules, extractor, disable_progress=True)
Expand Down

0 comments on commit e9a7dbc

Please sign in to comment.