analyzers.py
ofrak.core.patch_maker.analyzers
ComplexBlockSymbolAnalyzer (Analyzer)
Analyzes function blocks (complex blocks) to identify and extract linkable symbols by examining function entry points, call relationships, and debug information. Creates symbol entries with names and addresses that can be used for linking or reference. Use when analyzing disassembled functions to discover callable symbol names and addresses, build a symbol table for stripped binaries, or prepare for code injection that needs to reference existing functions. Helpful for understanding what functions are available to call.
analyze(self, resource, config=None)
async
Analyze a resource for to extract specific ResourceAttributes.
Users should not call this method directly; rather, they should run Resource.run or Resource.analyze.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource |
Resource |
The resource that is being analyzed |
required |
config |
ComponentConfig |
Optional config for analyzing. If an implementation provides a default, this default will always be used when config would otherwise be None. Note that a copy of the default config will be passed, so the default config values cannot be modified persistently by a component run. |
None |
Returns:
| Type | Description |
|---|---|
LinkableSymbol |
The analysis results |
Source code in ofrak/core/patch_maker/analyzers.py
async def analyze(self, resource: Resource, config: ComponentConfig = None) -> LinkableSymbol:
cb = await resource.view_as(ComplexBlock)
cb_mode = await cb.get_mode()
return LinkableSymbol(
cb.VirtualAddress,
cb.Symbol,
LinkableSymbolType.FUNC,
cb_mode,
)