Abstract Interface

AbstractProgramBackend

class qbindiff.loader.backend.AbstractProgramBackend[source]

Bases: object

This is an abstract class and should not be used as is. It represents a generic backend loader for a Program

abstract property callgraph: DiGraph

The callgraph of the program.

abstract property exec_path: str

Returns the executable path

abstract property fun_names: dict[str, int]

Returns a dictionary with function name as key and the function address as value.

abstract property functions: Iterator[AbstractFunctionBackend]

Returns an iterator over backend function objects.

abstract property name: str

The name of the program.

abstract property structures: list[Structure]

Returns the list of structures defined in program.

AbstractFunctionBackend

class qbindiff.loader.backend.AbstractFunctionBackend[source]

Bases: object

This is an abstract class and should not be used as is. It represents a generic backend loader for a Function.

abstract property addr: int

The address of the function.

abstract property basic_blocks: Iterator[AbstractBasicBlockBackend]

Returns an iterator over backend basic blocks objects.

abstract property children: set[int]

Set of function children in the call graph.

abstract property graph: DiGraph

The Control Flow Graph of the function.

abstract property name: str

The name of the function.

abstract property parents: set[int]

Set of function parents in the call graph.

abstract property type: FunctionType

The type of the function.

unload_blocks() None[source]

Unload basic blocks from memory

AbstractBasicBlockBackend

class qbindiff.loader.backend.AbstractBasicBlockBackend[source]

Bases: object

This is an abstract class and should not be used as is. It represents a generic backend loader for a BasicBlock

abstract property addr: int

The address of the basic block

abstract property bytes: bytes

Returns the bytes representation of the basic block

abstract property instructions: Iterator[AbstractInstructionBackend]

Returns an iterator over backend instruction objects

AbstractInstructionBackend

class qbindiff.loader.backend.AbstractInstructionBackend[source]

Bases: object

This is an abstract class and should not be used as is. It represents a generic backend loader for a Instruction

MAX_ID = 3000

Max instruction ID. All the instruction IDs will be in the range [0, MAX_ID]

abstract property addr: int

The address of the instruction

abstract property bytes: bytes

Returns the bytes representation of the instruction

abstract property comment: str

Comment associated with the instruction

abstract property groups: list[str]

Returns a list of groups of this instruction

abstract property id: int

Returns the instruction ID as a non negative int. The ID is in the range [0, MAX_ID]. The value MAX_ID means that there is no ID available.

Warning

The backend is responsible for creating this value, different backends should not be considered compatible between each other. (For example IDA relies on IDA IDs while quokka relies on capstone IDs)

abstract property mnemonic: str

Returns the instruction mnemonic as a string

abstract property operands: Iterator[AbstractOperandBackend]

Returns an iterator over backend operand objects

abstract property references: dict[ReferenceType, list[Data | Structure | StructureMember]]

Returns all the references towards the instruction

AbstractOperandBackend

class qbindiff.loader.backend.AbstractOperandBackend[source]

Bases: object

This is an abstract class and should not be used as is. It represents a generic backend loader for a Operand

abstract is_immediate() bool[source]

Returns whether the operand is an immediate value (not considering addresses)

abstract property type: OperandType

Returns the operand type.

abstract property value: int | None

Returns the immediate value (not addresses) if the operand is constant. If not, None is returned.