intellicrack.bridges.cutter

Cutter/Rizin bridge for static and dynamic analysis.

This module provides integration with Cutter/Rizin for disassembly, analysis, and debugging capabilities. Dispatch transparently selects rzpipe when the rizin binary is available and r2pipe when the radare2 binary is available, so installations that ship only one of the two toolchains (for example the Cutter+rizin desktop bundle) still initialize successfully.

class CutterBridge[source]

Bases: CutterDebugMixin

Bridge for Cutter/Rizin reverse engineering framework.

Provides static analysis, disassembly, and debugging capabilities through a backend-agnostic analysis-pipe (rzpipe/r2pipe) interface. Composed from the _CutterBridgeBase core class together with topical mixin classes that inherit linearly so cross-references resolve through normal MRO. Each mixin groups one surface area so no single class definition exceeds the public method limit.

async shutdown()[source]

Shutdown Cutter bridge and cleanup resources.

Wraps every reference-releasing step in try/finally so super().shutdown() is guaranteed to run even when an intermediate cleanup step raises. Without the guarantee a ProcessManager failure would leave the base BridgeState marked connected=True after the bridge had released its rizin handle, presenting observers with a stuck-alive state.

Return type:

None

is_rizin_64bit(bits, arch, file_class)[source]

Determine whether a rizin-reported binary is 64-bit.

Rizin’s ij output exposes a binary’s word width through three overlapping fields. bin.bits is the most direct, but several formats (notably PE32+ and split debug variants) leave it set to a 32-bit value while the architecture or container class still indicates 64-bit. Combining the three sources matches what Cutter itself does when classifying loaded binaries.

Parameters:
  • bits (int) – bin.bits value reported by rizin (0 if missing).

  • arch (str) – bin.arch value reported by rizin (e.g. x86, x86_64, arm, arm64).

  • file_class (str) – bin.class value reported by rizin (e.g. ELF64, PE32+, MACH064).

Returns:

True when any of the three sources indicates 64-bit word size.

Return type:

bool

validate_r2_argument(value, *, field)[source]

Reject raw user input that would inject rizin command-control characters.

Rizin parses ; as a command separator, @ as a temporary seek, | as a shell pipe, ~ as the internal grep operator, backticks as nested-command substitution, > as redirection, and treats $ / # as variable / comment prefixes. Forwarding untrusted user input directly into command strings allows arbitrary rizin commands to run in the analysed session, including file writes through wx or process spawning through !.

Parameters:
  • value (str) – Caller-supplied text destined for an rizin command line.

  • field (str) – Name of the parameter being validated, used in the raised error message.

Returns:

The unmodified value when safe to forward.

Return type:

str

Raises:

ToolError – When value contains a rizin command-control character or starts with ! (shell escape).