fit.interfaces package

Subpackages

Submodules

fit.interfaces.implementations module

class fit.interfaces.implementations.Implementation(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumeration class for the available injector implementations.

GDB = 1
classmethod from_string(s)[source]

Function that returns the injector class corresponding to a given implementation name.

Parameters:

s (str) – the implementation name.

Return type:

Type[InternalInjector]

Returns:

the class corresponding to the given implementation name.

fit.interfaces.internal_injector module

class fit.interfaces.internal_injector.InternalInjector(elf_path, **kwargs)[source]

Bases: ABC

Abstract class for managing the injection process into an ELF binary.

abstract close()[source]

Function that closes the GDB session and exit the controller.

Return type:

None

classmethod get_class()[source]

Function that returns the class type.

Return type:

Type[Self]

Returns:

the class type.

abstract get_mappings()[source]
Return type:

list[Mapping]

abstract get_register_names()[source]
Return type:

list[str]

abstract interrupt()[source]
Return type:

Optional[str]

abstract is_running()[source]
Return type:

bool

abstract read_memory(address, count)[source]

Function that reads a memory word from the target.

Parameters:
  • address (int) – the memory address to read from.

  • count (int) – the number of bytes to read.

Return type:

list[int]

Returns:

the values read from the target.

abstract read_register(register)[source]

Function that reads a register from the target.

Parameters:

register (str) – the register to read.

Return type:

int

Returns:

the value read from the target.

abstract reset()[source]

Function that resets the injector to a known initial state. Useful between test runs or injections.

Return type:

None

abstract run(blocking=True, stop_event=None)[source]

Function that runs the injector for a given amount of time.

Parameters:
  • blocking (bool) – whether to block until the precess stops.

  • stop_event (Optional[Event]) – synchronization variable that needs to be checked when waiting for a timeout

Return type:

str

Returns:

the name of the breakpoint hit.

abstract set_event(event)[source]

Function that sets a specific event for this target.

Parameters:

event (str) – the event to set.

Return type:

None

abstract write_memory(address, value, repeat)[source]

Function that writes a memory word from the target.

Parameters:
  • address (int) – the memory address to write to.

  • value (list[int]) – the value to write.

  • repeat (int) – the number of times to write the value.

Return type:

None

abstract write_register(register, value)[source]

Function that writes a register from the target.

Parameters:
  • register (str) – the register to write.

  • value (int) – the value to write.

Return type:

None

Module contents