Python

Utilities

lief.is_oat(*args) bool
lief.is_oat(path: str) bool
lief.is_oat(raw: collections.abc.Sequence[int]) bool

Overloaded function.

  1. is_oat(binary: lief._lief.ELF.Binary) -> bool

Check if the Binary given in parameter is an OAT

  1. is_oat(path: str) -> bool

Check if the file given in parameter is an OAT

  1. is_oat(raw: collections.abc.Sequence[int]) -> bool

Check if the raw data given in parameter is an OAT

lief.OAT.version(*args) int
lief.OAT.version(file: str) int
lief.OAT.version(raw: collections.abc.Sequence[int]) int

Overloaded function.

  1. version(binary: lief._lief.ELF.Binary) -> int

Return the OAT version of the Binary given in parameter

  1. version(file: str) -> int

Return the OAT version of the file given in parameter

  1. version(raw: collections.abc.Sequence[int]) -> int

Return the OAT version of the raw data given in parameter

lief.OAT.android_version(arg: int) lief.Android.ANDROID_VERSIONS

Return the ANDROID_VERSIONS associated with the given OAT version


Parser

lief.OAT.parse(*args) lief.OAT.Binary | None
lief.OAT.parse(oat_file: str, vdex_file: str) lief._lief.OAT.Binary | None
lief.OAT.parse(raw: collections.abc.Sequence[int]) lief._lief.OAT.Binary | None
lief.OAT.parse(obj: io.IOBase | os.PathLike) lief._lief.OAT.Binary | None

Overloaded function.

  1. parse(oat_file: str) -> Optional[lief._lief.OAT.Binary]

Parse the given OAT file and return a Binary object

  1. parse(oat_file: str, vdex_file: str) -> Optional[lief._lief.OAT.Binary]

Parse the given OAT with its VDEX file and return a Binary object

  1. parse(raw: collections.abc.Sequence[int]) -> Optional[lief._lief.OAT.Binary]

Parse the given raw data and return a Binary object

  1. parse(obj: Union[io.IOBase | os.PathLike]) -> Optional[lief._lief.OAT.Binary]


Binary

class lief.OAT.Binary

Bases: Binary

OAT binary representation

property classes lief.OAT.Binary.it_classes

Return an iterator over Class

property dex2dex_json_info str
property dex_files lief.OAT.Binary.it_dex_files

Return an iterator over File

get_class(*args) lief.OAT.Class

Overloaded function.

  1. get_class(self, class_name: str) -> lief._lief.OAT.Class

Return the Class from its name

  1. get_class(self, class_index: int) -> lief._lief.OAT.Class

Return the Class from its index

has_class(self, arg: str) bool

Check if the class if the given name is present in the current OAT binary

property header lief.OAT.Header

Return the OAT Header

class it_classes

Bases: object

Iterator over lief._lief.OAT.Class

class it_dex_files

Bases: object

Iterator over lief._lief.DEX.File

class it_methods

Bases: object

Iterator over lief._lief.OAT.Method

class it_oat_dex_files

Bases: object

Iterator over lief._lief.OAT.DexFile

property methods lief.OAT.Binary.it_methods

Return an iterator over Method

property oat_dex_files lief.OAT.Binary.it_oat_dex_files

Return an iterator over DexFile



DexFile

class lief.OAT.DexFile(self)

Bases: Object

OAT DexFile representation

property checksum int

Checksum of the underlying DEX file

property dex_file lief.DEX.File

Associated lief.DEX.File

property dex_offset int

Offset to the raw lief.DEX.File

property has_dex_file bool

Check if the lief.DEX.File is present

property location str

Original location of the DEX file


Class

class lief.OAT.Class(self)

Bases: Object

OAT Class representation

property bitmap list[int]

Bitmap information used to quickly find which methods are optimized

property fullname str

Class mangled name (e.g. Lcom/android/MyActivity;)

has_dex_class(self) bool

True if a lief.DEX.Class object is associated with this OAT Class

property index int

Index the DEX classes pool (lief.DEX.File.classes)

is_quickened(*args) bool

Overloaded function.

  1. is_quickened(self, dex_method: lief._lief.DEX.Method) -> bool

Check if the given lief.DEX.Method is compiled into native code

  1. is_quickened(self, method_index: int) -> bool

Check if the Method at the given index is compiled into native code

class it_methods

Bases: object

Iterator over lief._lief.OAT.Method

method_offsets_index(self, arg: int) int
property methods lief.OAT.Class.it_methods

Iterator over lief.OAT.Method

property status lief.OAT.OAT_CLASS_STATUS

Class OAT_CLASS_STATUS

property type lief.OAT.OAT_CLASS_TYPES

Information (OAT_CLASS_TYPES) about how methods are optimized


Method

class lief.OAT.Method(self)

Bases: Object

OAT Method representation

property dex_method lief.DEX.Method

Mirrored Method associated with the OAT method (or None)

property has_dex_method bool

Check if a Method is associated with the OAT method

property is_compiled bool

True if the optimization is native

property is_dex2dex_optimized bool

True if the optimization is DEX

property name str

Method’s name

property oat_class lief.OAT.Class

Class associated with the method (or None)

property quick_code list[int]

Quick code associated with the method


Enums

OAT Class types

class lief.OAT.OAT_CLASS_TYPES(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

ALL_COMPILED = 0
NONE_COMPILED = 2
SOME_COMPILED = 1

OAT Class Status

class lief.OAT.OAT_CLASS_STATUS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

ERROR = -1
IDX = 1
INITIALIZED = 10
INITIALIZING = 9
LOADED = 2
NOTREADY = 0
RESOLVED = 4
RESOLVING = 3
RETIRED = -2
VERIFICATION_AT_RUNTIME = 6
VERIFIED = 8
VERIFYING = 5
VERIFYING_AT_RUNTIME = 7

Header Keys

class lief.OAT.HEADER_KEYS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

BOOT_CLASS_PATH = 9
CLASS_PATH = 8
COMPILER_FILTER = 7
CONCURRENT_COPYING = 10
DEBUGGABLE = 5
DEX2OAT_CMD_LINE = 1
DEX2OAT_HOST = 2
HAS_PATCH_INFO = 4
IMAGE_LOCATION = 0
NATIVE_DEBUGGABLE = 6
PIC = 3

Instruction sets

class lief.OAT.INSTRUCTION_SETS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

ARM = 1
ARM_64 = 2
MIPS = 6
MIPS_64 = 7
NONE = 0
THUMB2 = 3
X86 = 4
X86_64 = 5