From 6c2517cd64cb318a2ab126b4aec2eb60bd9facf5 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Mon, 16 Sep 2024 13:59:58 -0400 Subject: update single function analysis to use analysis_hold in batch processing --- docs/dev/batch.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'docs/dev') diff --git a/docs/dev/batch.md b/docs/dev/batch.md index e9419999..e46bc573 100644 --- a/docs/dev/batch.md +++ b/docs/dev/batch.md @@ -78,25 +78,19 @@ Notice that we have far fewer functions in `/bin/ls` this time. By shortcutting ### Single Function Analysis -A common workflow is to analyze a single (or small number) of functions in a particular binaries. If we both the [maxFunctionSize](https://docs.binary.ninja/getting-started.html#analysis.limits.maxFunctionSize) setting in conjunction with the [analysis_skipped](https://api.binary.ninja/binaryninja.function-module.html#binaryninja.function.Function.analysis_skipped) function property we can select specific functions to analyze: +A common workflow is to analyze a single (or small number) of functions in a particular binaries. This can be done using the analysis hold feature. If we both the [maxFunctionSize](https://docs.binary.ninja/getting-started.html#analysis.limits.maxFunctionSize) setting in conjunction with the [analysis_skipped](https://api.binary.ninja/binaryninja.function-module.html#binaryninja.function.Function.analysis_skipped) function property we can select specific functions to analyze: ```python from binaryninja import load -with load("/bin/ls", options={'analysis.limits.maxFunctionSize': 1}) as bv: +with load("/bin/ls", options={'analysis.initialAnalysisHold': True}) as bv: fn = bv.entry_function # Alternatively, use add_user_function at a particular address to first # create the function if fn: - if fn.mlil: - print("Entry function has MLIL") - else: - print(f"No MLIL entry function") - fn.analysis_skipped = False - bv.update_analysis_and_wait() - if fn.mlil: - print("Entry function has MLIL") - else: - print(f"No MLIL entry function") + if fn.hlil_if_available: + print("This will not fire because analysis hold has analyzed nothing so no HLIL exists.") + if fn.hlil: + print("This will work because HLIL is explicitly being requested via the API and will override the hold.") ``` ### Running Plugins -- cgit v1.3.1