``class Workflow`` in Binary Ninja defines the set of analyses to perform on a binary, including their dependencies and execution order. Workflows are represented as Directed Acyclic Graphs (DAGs), where each node corresponds to an :class:`Activity` (an individual analysis or action). Workflow
| 244 | |
| 245 | |
| 246 | class Workflow(metaclass=_WorkflowMetaclass): |
| 247 | """ |
| 248 | ``class Workflow`` in Binary Ninja defines the set of analyses to perform on a binary, |
| 249 | including their dependencies and execution order. |
| 250 | |
| 251 | Workflows are represented as Directed Acyclic Graphs (DAGs), where each node corresponds to |
| 252 | an :class:`Activity` (an individual analysis or action). Workflows are used to tailor the |
| 253 | analysis process for :class:`BinaryView` or :class:`Function` objects, providing granular |
| 254 | control over analysis tasks at module or function levels. |
| 255 | |
| 256 | A Workflow starts in an unregistered state, either by creating a new empty Workflow or by |
| 257 | cloning an existing one. While unregistered, it is possible to add and remove :class:`Activity` |
| 258 | objects, as well as modify the execution strategy. To apply a Workflow to a binary, it must be |
| 259 | registered. Once registered, the Workflow becomes immutable and is available for use. |
| 260 | |
| 261 | :Example: |
| 262 | |
| 263 | .. code-block:: python |
| 264 | |
| 265 | # Define the custom activity configuration |
| 266 | configuration = json.dumps({ |
| 267 | "name": "analysis.plugins.xorStringDecoder", |
| 268 | "title": "XOR String Decoder", |
| 269 | "description": "This analysis step transforms XOR-encoded strings within the current function.", |
| 270 | "eligibility": { |
| 271 | "auto": { |
| 272 | "default": False |
| 273 | } |
| 274 | } |
| 275 | }) |
| 276 | |
| 277 | # Clone the meta function workflow for customization |
| 278 | workflow = Workflow("core.function.metaAnalysis").clone() |
| 279 | |
| 280 | # Register a new activity |
| 281 | workflow.register_activity(Activity( |
| 282 | configuration, |
| 283 | action=lambda analysis_context: log_warn( |
| 284 | f"Decoder running for function: {hex(analysis_context.function.start)}" |
| 285 | # Insert decoder logic here :P |
| 286 | ) |
| 287 | )) |
| 288 | |
| 289 | # Insert the new activity before the "generateHighLevelIL" step |
| 290 | workflow.insert("core.function.generateHighLevelIL", ["analysis.plugins.xorStringDecoder"]) |
| 291 | |
| 292 | # Register the modified meta function workflow |
| 293 | workflow.register() |
| 294 | """ |
| 295 | def __init__(self, name: str = "", handle: core.BNWorkflowHandle = None, query_registry: bool = True, object_handle: Union[core.BNFunctionHandle, core.BNBinaryViewHandle] = None): |
| 296 | if handle is None: |
| 297 | if query_registry: |
| 298 | _handle = core.BNWorkflowInstance(str(name)) |
| 299 | else: |
| 300 | _handle = core.BNCreateWorkflow(name) |
| 301 | else: |
| 302 | _handle = handle |
| 303 | assert _handle is not None |
no outgoing calls
no test coverage detected