Skip to content

Commit

Permalink
loader: show duration of binary ninja loading
Browse files Browse the repository at this point in the history
  • Loading branch information
williballenthin committed Nov 27, 2024
1 parent 999f91b commit a909d02
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions capa/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def get_extractor(
return capa.features.extractors.dnfile.extractor.DnfileFeatureExtractor(input_path)

elif backend == BACKEND_BINJA:
import capa.perf as perf
import capa.features.extractors.binja.find_binja_api as finder

if not finder.has_binaryninja():
Expand All @@ -262,9 +263,10 @@ def get_extractor(
raise UnsupportedOSError()

with console.status("analyzing program...", spinner="dots"):
bv: binaryninja.BinaryView = binaryninja.load(str(input_path))
if bv is None:
raise RuntimeError(f"Binary Ninja cannot open file {input_path}")
with perf.timing("binary ninja: loading program"):
bv: binaryninja.BinaryView = binaryninja.load(str(input_path))
if bv is None:
raise RuntimeError(f"Binary Ninja cannot open file {input_path}")

return capa.features.extractors.binja.extractor.BinjaFeatureExtractor(bv)

Expand Down

0 comments on commit a909d02

Please sign in to comment.