avatar2 package

Submodules

avatar2.avatar2 module

class avatar2.avatar2.Avatar(arch=<class 'avatar2.archs.arm.ARM'>, endness='little', output_directory=None)

Bases: threading.Thread

The Avatar-object is the main interface of avatar. Here we can set the different targets, and more

Variables:
  • arch – architecture of all targets
  • endness – used endianness
add_memory_range(address, size, name='', permissions='rwx', file=None, forwarded=False, forwarded_to=None, emulate=None, **kwargs)

Adds a memory range to avatar

Parameters:
  • address – Base-Address of the Range
  • size – Size of the range
  • file – A file backing this range, if applicable
  • forwarded – Whether this range should be forwarded
  • forwarded_to – If forwarded is true, specify the forwarding target
add_target(name, backend, *args, **kwargs)

Adds a new target to the analyses

Variables:
  • name – name of the target
  • backend – the desired backend. Implemented for now: qemu, gdb
Kwargs:

those argument will be passed to the target-object itself

Returns:

The created TargetObject

get_memory_range(address)

Get a memory range from an address Note: for now just get’s one range. If there are multiple ranges at the same address, this method won’t work (for now)

Parameters:address – the address of the range
Returns:the memory range
get_status()
get_target(name)

Retrieves a target of the analyses by it’s name

Parameters:name – The name of the desired target
Returns:The Target!
get_targets()

A generator for all targets.

init_targets()

Inits all created targets

load_plugin(name)
run()

The code of the Thread managing the asynchronous messages received. Default behavior: wait for the priority queue to hold a message and call the _async_handler method to process it.

shutdown()

Shuts down all targets and Avatar. Should be called at end of script in order to cleanly exit all spawned processes and threads

sigint_wrapper(signal, frame)
stop()

Stop the thread which manages the asynchronous messages.

transfer_state(from_target, to_target, synch_regs=True, synched_ranges=[])

Transfers the state from one target to another one

Parameters:
  • from_target (Target()) – the source target
  • to_target (Target()) – the destination target
  • synch_regs (bool) – Whether registers should be synched
  • synched_ranges (list) – The memory ranges whose contents should be transfered

avatar2.memory_range module

class avatar2.memory_range.MemoryRange(address, size, name='', permissions='rwx', file=None, forwarded=False, forwarded_to=None, **kwargs)

Bases: object

This class represents a MemoryRange which can be mapped in one of Avatar-Targets. :ivar address: The load-address of the memory range :ivar size: The size of the memory range :ivar name: User-defined name for the memory range :ivar permissions: The permisions of the range, represented as textual unix file permission (rwx) :ivar file: A file used for backing the memory range :ivar forwarded: Enable or disable forwarding for this range :ivar forwarded_to: List of targets this range should be forwarded to

avatar2.message module

class avatar2.message.AvatarMessage(origin)

Bases: object

This class provides constants to create and parse the avatar message-dict

class avatar2.message.BreakpointHitMessage(origin, breakpoint_number, address)

Bases: avatar2.message.AvatarMessage

class avatar2.message.RemoteMemoryReadMessage(origin, id, address, size)

Bases: avatar2.message.AvatarMessage

class avatar2.message.RemoteMemoryWriteMessage(origin, id, address, value, size)

Bases: avatar2.message.AvatarMessage

class avatar2.message.UpdateStateMessage(origin, new_state)

Bases: avatar2.message.AvatarMessage

avatar2.watchmen module

class avatar2.watchmen.WatchedEvent(type, when, callback, async, *args, **kwargs)

Bases: object

react(avatar, *args, **kwargs)
class avatar2.watchmen.Watchmen(avatar)

Bases: object

add(type, when='before', callback=None, async=False, *args, **kwargs)
add_watch_types(watched_types)
add_watchman(type, when='before', callback=None, async=False, *args, **kwargs)
remove_watchman(type, watchman)
t(type, when, *args, **kwargs)
trigger(type, when, *args, **kwargs)
class avatar2.watchmen.asyncReaction(avatar, callback, *args, **kwargs)

Bases: threading.Thread

run()
avatar2.watchmen.watch(watched_type)

Decorator for the watchmen system

Module contents