OAT

Utilities

bool LIEF::OAT::is_oat(const ELF::Binary &elf_binary)

Check if the given LIEF::ELF::Binary is an OAT one.

bool LIEF::OAT::is_oat(const std::string &file)

Check if the given file is an OAT one.

bool LIEF::OAT::is_oat(const std::vector<uint8_t> &raw)

Check if the given raw data is an OAT one.

oat_version_t LIEF::OAT::version(const std::string &file)

Return the OAT version of the given file.

oat_version_t LIEF::OAT::version(const std::vector<uint8_t> &raw)

Return the OAT version of the raw data.

oat_version_t LIEF::OAT::version(const LIEF::ELF::Binary &elf_binary)

Return the OAT version of the given LIEF::ELF::Binary.

LIEF::Android::ANDROID_VERSIONS LIEF::OAT::android_version(oat_version_t version)

Return the ANDROID_VERSIONS associated with the given OAT version.


Parser

class Parser : public LIEF::Parser

Class which parse an OAT file and transform into a OAT::Binary.

Public Functions

Parser &operator=(const Parser &copy)
Parser(const Parser &copy)

Public Static Functions

std::unique_ptr<Binary> parse(const std::string &oat_file)

Parse an OAT file.

std::unique_ptr<Binary> parse(const std::string &oat_file, const std::string &vdex_file)
std::unique_ptr<Binary> parse(const std::vector<uint8_t> &data, const std::string &name = "")

Binary

class Binary : public LIEF::ELF::Binary

Public Functions

Binary &operator=(const Binary &copy)
Binary(const Binary &copy)
const Header &header(void) const

OAT Header.

Header &header(void)
DEX::it_dex_files dex_files(void)

Iterator over LIEF::DEX::File.

DEX::it_const_dex_files dex_files(void) const
it_dex_files oat_dex_files(void)

Iterator over LIEF::OAT::DexFile.

it_const_dex_files oat_dex_files(void) const
it_const_classes classes(void) const

Iterator over LIEF::OAT::Class.

it_classes classes(void)
bool has_class(const std::string &class_name) const

Check the current OAT has the given class.

const Class &get_class(const std::string &class_name) const

Return the LIEF::OAT::Class with the given name.

Class &get_class(const std::string &class_name)
const Class &get_class(size_t index) const

Return the LIEF::OAT::Class at the given index.

Class &get_class(size_t index)
it_const_methods methods(void) const

Iterator over LIEF::OAT::Method.

it_methods methods(void)
dex2dex_info_t dex2dex_info(void) const
std::string dex2dex_json_info(void)
bool operator==(const Binary &rhs) const
bool operator!=(const Binary &rhs) const
void accept(Visitor &visitor) const

Method so that the visitor can visit us.

~Binary(void)

Friends

std::ostream &operator<<(std::ostream &os, const Binary &binary)


DexFile

class DexFile : public LIEF::Object

Public Functions

DexFile(void)
DexFile(const DexFile&)
DexFile &operator=(const DexFile&)
const std::string &location(void) const
uint32_t checksum(void) const
uint32_t dex_offset(void) const
bool has_dex_file(void) const
const DEX::File &dex_file(void) const
DEX::File &dex_file(void)
void location(const std::string &location)
void checksum(uint32_t checksum)
void dex_offset(uint32_t dex_offset)
const std::vector<uint32_t> &classes_offsets(void) const
uint32_t lookup_table_offset(void) const
void class_offsets_offset(uint32_t offset)
void lookup_table_offset(uint32_t offset)
void accept(Visitor &visitor) const
bool operator==(const DexFile &rhs) const
bool operator!=(const DexFile &rhs) const
~DexFile(void)

Friends

std::ostream &operator<<(std::ostream &os, const DexFile &dex_file)

Class

class Class : public LIEF::Object

Public Functions

Class(void)
Class(OAT_CLASS_STATUS status, OAT_CLASS_TYPES type, DEX::Class *dex_class, const std::vector<uint32_t> &bitmap = {})
Class(const Class&)
Class &operator=(const Class&)
bool has_dex_class(void) const
const DEX::Class &dex_class(void) const
DEX::Class &dex_class(void)
OAT_CLASS_STATUS status(void) const
OAT_CLASS_TYPES type(void) const
const std::string &fullname(void) const
size_t index(void) const
it_methods methods(void)
it_const_methods methods(void) const
const std::vector<uint32_t> &bitmap(void) const
bool is_quickened(const DEX::Method &m) const
bool is_quickened(uint32_t relative_index) const
uint32_t method_offsets_index(const DEX::Method &m) const
uint32_t method_offsets_index(uint32_t relative_index) const
uint32_t relative_index(const DEX::Method &m) const
uint32_t relative_index(uint32_t method_absolute_index) const
DEX::dex2dex_class_info_t dex2dex_info(void) const
void accept(Visitor &visitor) const
bool operator==(const Class &rhs) const
bool operator!=(const Class &rhs) const
~Class(void)

Friends

std::ostream &operator<<(std::ostream &os, const Class &cls)

Method

class Method : public LIEF::Object

Public Types

using quick_code_t = std::vector<uint8_t>

Container for the Quick Code.

Public Functions

Method(void)
Method(DEX::Method *method, Class *oat_class, const std::vector<uint8_t> &code = {})
Method(const Method&)
Method &operator=(const Method&)
std::string name(void) const

Method’s name.

const Class &oat_class(void) const

OAT Class associated with this Method.

Class &oat_class(void)
bool has_dex_method(void) const

Check if a LIEF::DEX::Method is associated with this Method

const DEX::Method &dex_method(void) const

LIEF::DEX::Method associated (if any)

DEX::Method &dex_method(void)
bool is_dex2dex_optimized(void) const

True if the optimization is DEX.

bool is_compiled(void) const
const DEX::dex2dex_method_info_t &dex2dex_info(void) const
const Method::quick_code_t &quick_code(void) const

Quick code associated with the method.

void quick_code(const quick_code_t &code)
void accept(Visitor &visitor) const
bool operator==(const Method &rhs) const
bool operator!=(const Method &rhs) const
~Method(void)

Friends

std::ostream &operator<<(std::ostream &os, const Method &meth)

Enums

OAT Class types

enum LIEF::OAT::OAT_CLASS_TYPES

Values:

OAT_CLASS_ALL_COMPILED = 0
OAT_CLASS_SOME_COMPILED = 1

OatClass is followed by an OatMethodOffsets for each method.

OAT_CLASS_NONE_COMPILED = 2

A bitmap of which OatMethodOffsets are present follows the OatClass.


OAT Class Status

enum LIEF::OAT::OAT_CLASS_STATUS

Values:

STATUS_RETIRED = -2
STATUS_ERROR = -1
STATUS_NOTREADY = 0
STATUS_IDX = 1
STATUS_LOADED = 2
STATUS_RESOLVING = 3
STATUS_RESOLVED = 4
STATUS_VERIFYING = 5
STATUS_RETRY_VERIFICATION_AT_RUNTIME = 6
STATUS_VERIFYING_AT_RUNTIME = 7
STATUS_VERIFIED = 8
STATUS_INITIALIZING = 9
STATUS_INITIALIZED = 10

Header Keys

enum LIEF::OAT::HEADER_KEYS

Values:

KEY_IMAGE_LOCATION = 0
KEY_DEX2OAT_CMD_LINE = 1
KEY_DEX2OAT_HOST = 2
KEY_PIC = 3
KEY_HAS_PATCH_INFO = 4
KEY_DEBUGGABLE = 5
KEY_NATIVE_DEBUGGABLE = 6
KEY_COMPILER_FILTER = 7
KEY_CLASS_PATH = 8
KEY_BOOT_CLASS_PATH = 9
KEY_CONCURRENT_COPYING = 10
KE_COMPILATION_REASON = 11

Instruction sets

enum LIEF::OAT::INSTRUCTION_SETS

Values:

INST_SET_NONE = 0
INST_SET_ARM = 1
INST_SET_ARM_64 = 2
INST_SET_THUMB2 = 3
INST_SET_X86 = 4
INST_SET_X86_64 = 5
INST_SET_MIPS = 6
INST_SET_MIPS_64 = 7