pex.assembler

Package Contents

class pex.assembler.Assembler

Bases: object

Main class of pex.assembler module.

This main class of pex.assembler module is intended for providing an implementation of native assembler.

assemble(arch: pex.arch.types.Arch | str, code: str, mode: str = '', syntax: str = 'intel') bytes

Assemble code for the specified architecture.

Parameters:
  • arch (Union[Arch, str]) – architecture to assemble for

  • code (str) – code to assemble

  • mode (str) – special assembler mode

  • syntax (str) – special assembler syntax

Return bytes:

assembled code for the specified architecture

hexdump(code: bytes, length: int = 16, sep: str = '.') list

Dump assembled code as hex.

Parameters:
  • code (bytes) – assembled code to dump as hex

  • length (int) – length of each string

  • sep (str) – non-printable chars replacement

Return list:

list of hexdump strings