diff --git a/capa/features/extractors/binja/extractor.py b/capa/features/extractors/binja/extractor.py index 568a8e21f..32e1325c6 100644 --- a/capa/features/extractors/binja/extractor.py +++ b/capa/features/extractors/binja/extractor.py @@ -62,8 +62,6 @@ def _build_call_graph(self): f: Function for f in self.bv.functions: for caller in f.callers: - if caller == f: - logger.debug("recursive: 0x%x", f.start) calls_from[caller.start].add(f.start) calls_to[f.start].add(caller.start) diff --git a/capa/features/extractors/binja/function.py b/capa/features/extractors/binja/function.py index 347c2c16e..a2d284ec7 100644 --- a/capa/features/extractors/binja/function.py +++ b/capa/features/extractors/binja/function.py @@ -21,7 +21,7 @@ def extract_function_calls_to(fh: FunctionHandle): func: Function = fh.inner caller: int - for caller in fh.ctx["call_graph"].get("calls_to", []): + for caller in fh.ctx["call_graph"]["calls_to"].get(func.start, []): if caller == func.start: continue @@ -33,7 +33,7 @@ def extract_function_calls_from(fh: FunctionHandle): func: Function = fh.inner callee: int - for callee in fh.ctx["call_graph"].get("calls_from", []): + for callee in fh.ctx["call_graph"]["calls_from"].get(func.start, []): if callee == func.start: continue @@ -60,7 +60,7 @@ def extract_recursive_call(fh: FunctionHandle): func: Function = fh.inner caller: int - for caller in fh.ctx["call_graph"].get("calls_to", []): + for caller in fh.ctx["call_graph"]["calls_to"].get(func.start, []): if caller == func.start: yield Characteristic("recursive call"), fh.address return