pwnypack.target – Target definition

The Target class describes the architecture of a targeted machine, executable or environment. It encodes the generic architecture, the word size, the byte order and an architecture dependant mode.

It is used throughout pwnypack to determine how data should be interpreted or emitted.

class pwnypack.target.Target(arch=None, bits=None, endian=None, mode=0)

Bases: object

class Arch

Bases: enum.Enum

Describes the general architecture of a target.

class Target.Bits

Bases: enum.IntEnum

The target architecture’s word size.

class Target.Endian

Bases: enum.IntEnum

The target architecture’s byte order.

class Target.Mode

Bases: enum.IntEnum

Architecture dependant mode flags.

Target.arch

The target’s architecture. One of Target.Arch.

Target.assume(other)

Assume the identity of another target. This can be useful to make the global target assume the identity of an ELF executable.

Parameters:other (Target) – The target whose identity to assume.

Example

>>> from pwny import *
>>> target.assume(ELF('my-executable'))
Target.bits

The target architecture word size. One of Target.Bits.

Target.endian

The target architecture byte order. One of Target.Endian.

Target.mode

The target architecture dependant flags. OR’ed values of Target.Mode.