Pro.DEX — API for parsing Android DEX files

Overview

The Pro.DEX module contains the API for parsing Android DEX files.

Disassembling

The following code example demonstrates how to disassemble the classes of an Android DEX file.

from Pro.Core import *
from Pro.DEX import *

def disassembleDEXClasses(fname):
    c = createContainerFromFile(fname)
    if c.isNull():
        return
    obj = DEXObject()
    if not obj.Load(c):
        return
    classes = obj.Classes()
    class_count = classes.Count()
    for i in range(class_count):
        out = NTTextBuffer()
        obj.Disassemble(out, i)
        print(out.buffer)

Method Enumeration

The following code example shows how to enumerate the methods in the classes of an Android DEX file.

from Pro.Core import *
from Pro.DEX import *

def enumerateDEXMethods(fname):
    c = createContainerFromFile(fname)
    if c.isNull():
        return
    obj = DEXObject()
    if not obj.Load(c):
        return
    classes = obj.Classes()
    class_count = classes.Count()
    for i in range(class_count):
        class_name = obj.ClassIndexToString(i, True)
        print("class:", class_name)
        cd = ClassData()
        if obj.GetClassData(i, cd):
            for it in (cd.direct_methods.iterator(), cd.virtual_methods.iterator()):
                while it.hasNext():
                    m = it.next()
                    method_name = obj.MethodIndexToString(m.index)
                    print("   method:", method_name)
                    ci = CodeItem()
                    if obj.GetCodeItem(m.code_off, ci, False):
                        print("       code offset:", hex(ci.code_offset), "- code size (in words):", hex(ci.insns_size))

An example output of the code:

class: com.android.providers.applications.ApplicationLauncher
   method: void <init>()
       code offset: 0x14e0 - code size (in words): 0x4
   method: void launchApplication(android.net.Uri)
       code offset: 0x14f8 - code size (in words): 0x4b
   method: void showSearchResults(java.lang.String)
       code offset: 0x15ac - code size (in words): 0x1d
[...]

Module API

Pro.DEX module API.

Classes:

Annotation()

This class represents an annotation.

AnnotationElement()

This class represents an annotation element.

AnnotationElementList()

List of AnnotationElement elements.

AnnotationElementListIt(obj)

Iterator class for AnnotationElementList.

AnnotationList()

List of Annotation elements.

AnnotationListIt(obj)

Iterator class for AnnotationList.

AnnotationsDirectory()

This class represents the annotations directory.

CatchData()

This class represents the catch clause of an exception.

CatchList()

List of CatchData elements.

CatchListIt(obj)

Iterator class for CatchList.

ClassData()

This class contains the members of a class.

ClassDef()

This class represents a class definition.

CodeItem()

This class represents a code item.

DEXObject()

This class represents an Android DEX file.

DebugInfo()

This class represents debug information.

EncodedFieldList()

List of FieldData elements.

EncodedFieldListIt(obj)

Iterator class for EncodedFieldList.

EncodedMethodList()

List of MethodData elements.

EncodedMethodListIt(obj)

Iterator class for EncodedMethodList.

FieldData()

This class represents the data of a field.

FieldIdItem()

This class represents the data of a field id item.

MapListItem()

This class represents a map list item.

MethodData()

This class represents the data of a method.

MethodHandle()

This class represents a method handle.

MethodIdItem()

This class represents a method id item.

ProtoIdItem()

This class represents a prototype id item.

TryData()

This class represents a try clause.

TryList()

List of TryData elements.

TryListIt(obj)

Iterator class for TryList.

Attributes:

CACC_ABSTRACT

Class access flag.

CACC_ANNOTATION

Class access flag.

CACC_ENUM

Class access flag.

CACC_FINAL

Class access flag.

CACC_INTERFACE

Class access flag.

CACC_PRIVATE

Class access flag.

CACC_PROTECTED

Class access flag.

CACC_PUBLIC

Class access flag.

CACC_STATIC

Class access flag.

CACC_SYNTHETIC

Class access flag.

DBG_ADVANCE_LINE

Debug opcode.

DBG_ADVANCE_PC

Debug opcode.

DBG_END_LOCAL

Debug opcode.

DBG_END_SEQUENCE

Debug opcode.

DBG_RESTART_LOCAL

Debug opcode.

DBG_SET_EPILOGUE_BEGIN

Debug opcode.

DBG_SET_FILE

Debug opcode.

DBG_SET_PROLOGUE_END

Debug opcode.

DBG_START_LOCAL

Debug opcode.

DBG_START_LOCAL_EXTENDED

Debug opcode.

ENDIAN_CONSTANT

Little-endian constant.

FACC_ENUM

Field access flag.

FACC_FINAL

Field access flag.

FACC_PRIVATE

Field access flag.

FACC_PROTECTED

Field access flag.

FACC_PUBLIC

Field access flag.

FACC_STATIC

Field access flag.

FACC_SYNTHETIC

Field access flag.

FACC_TRANSIENT

Field access flag.

FACC_VOLATILE

Field access flag.

MACC_ABSTRACT

Method access flag.

MACC_BRIDGE

Method access flag.

MACC_CONSTRUCTOR

Method access flag.

MACC_DECLARED_SYNCHRONIZED

Method access flag.

MACC_FINAL

Method access flag.

MACC_NATIVE

Method access flag.

MACC_PRIVATE

Method access flag.

MACC_PROTECTED

Method access flag.

MACC_PUBLIC

Method access flag.

MACC_STATIC

Method access flag.

MACC_STRICT

Method access flag.

MACC_SYNCHRONIZED

Method access flag.

MACC_SYNTHETIC

Method access flag.

MACC_VARARGS

Method access flag.

METHOD_HANDLE_TYPE_INSTANCE_GET

Method handle type.

METHOD_HANDLE_TYPE_INSTANCE_PUT

Method handle type.

METHOD_HANDLE_TYPE_INVOKE_CONSTRUCTOR

Method handle type.

METHOD_HANDLE_TYPE_INVOKE_DIRECT

Method handle type.

METHOD_HANDLE_TYPE_INVOKE_INSTANCE

Method handle type.

METHOD_HANDLE_TYPE_INVOKE_INTERFACE

Method handle type.

METHOD_HANDLE_TYPE_INVOKE_STATIC

Method handle type.

METHOD_HANDLE_TYPE_STATIC_GET

Method handle type.

METHOD_HANDLE_TYPE_STATIC_PUT

Method handle type.

NO_INDEX

Default value of TryData.catch_all_instr.

REVERSE_ENDIAN_CONSTANT

Big-endian constant.

SmaliTag_ClassDef

Smali bytecode tag.

SmaliTag_ClassRef

Smali bytecode tag.

SmaliTag_Instruction

Smali bytecode tag.

SmaliTag_Invalid

Smali bytecode tag.

SmaliTag_Label

Smali bytecode tag.

SmaliTag_LabelJump

Smali bytecode tag.

SmaliTag_MethodDef

Smali bytecode tag.

SmaliTag_MethodRef

Smali bytecode tag.

SmaliTag_Offset

Smali bytecode tag.

SmaliTag_String

Smali bytecode tag.

SmaliTag_TypeRef

Smali bytecode tag.

TYPE_ANNOTATIONS_DIRECTORY_ITEM

Annotations directory item type.

TYPE_ANNOTATION_ITEM

Annotation item type.

TYPE_ANNOTATION_SET_ITEM

Annotation set item type.

TYPE_ANNOTATION_SET_REF_LIST

Annotation set reference list type.

TYPE_CALL_SITE_ID_ITEM

Call site id item type.

TYPE_CLASS_DATA_ITEM

Class data item type.

TYPE_CLASS_DEF_ITEM

Class definition item type.

TYPE_CODE_ITEM

Code item type.

TYPE_DEBUG_INFO_ITEM

Debug information item type.

TYPE_ENCODED_ARRAY_ITEM

Encoded array item type.

TYPE_FIELD_ID_ITEM

Field id item type.

TYPE_HEADER_ITEM

Header item type.

TYPE_HIDDENAPI_CLASS_DATA_ITEM

Hidden API class data item type.

TYPE_MAP_LIST

Map list type.

TYPE_METHOD_HANDLE_ITEM

Method handle item type.

TYPE_METHOD_ID_ITEM

Method id item type.

TYPE_PROTO_ID_ITEM

Prototype id item type.

TYPE_STRING_DATA_ITEM

String data item type.

TYPE_STRING_ID_ITEM

String id item type.

TYPE_TYPE_ID_ITEM

Type id item type.

TYPE_TYPE_LIST

Type list type.

VALUE_ANNOTATION

Annotation value.

VALUE_ARRAY

Array value.

VALUE_BOOLEAN

Boolean value.

VALUE_BYTE

Byte value.

VALUE_CHAR

Character value.

VALUE_DOUBLE

Double value.

VALUE_ENUM

Enum value.

VALUE_FIELD

Field value.

VALUE_FLOAT

Float value.

VALUE_INT

Integer value.

VALUE_LONG

Long value.

VALUE_METHOD

Method value.

VALUE_METHOD_HANDLE

Method handle value.

VALUE_METHOD_TYPE

Method type value.

VALUE_NULL

Null value.

VALUE_SHORT

Short value.

VALUE_STRING

String value.

VALUE_TYPE

Type value.

VISIBILITY_BUILD

Build visibility.

VISIBILITY_RUNTIME

Run-time visibility.

VISIBILITY_SYSTEM

System visibility.

class Annotation

This class represents an annotation.

See also DEXObject.GetAnnotationSet().

Attributes:

elements

A AnnotationElementList list of annotation elements.

offset

The offset of the annotation.

type_idx

The type index of the annotation.

visibility

The visibility of the annotation.

elements

A AnnotationElementList list of annotation elements.

See also AnnotationElement.

offset

The offset of the annotation.

type_idx

The type index of the annotation.

visibility

The visibility of the annotation.

class AnnotationElement

This class represents an annotation element.

See also Annotation.

Attributes:

name

The name index of the element.

offset

The offset of the element.

size

The size of the element.

type

The type of the element.

value_offset

The offset of the value after the name index.

name

The name index of the element.

offset

The offset of the element.

size

The size of the element.

type

The type of the element.

See also DEXObject.GetTypeName().

value_offset

The offset of the value after the name index.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

class AnnotationElementList

List of AnnotationElement elements.

Methods:

append(value)

Inserts value at the end of the vector.

at(i)

Returns the item at index position i in the vector.

clear()

Removes all the elements from the vector and releases the memory used by the vector.

contains(value)

Checks the presence of an element in the vector.

count(value)

Returns the number of occurrences of value in the vector.

indexOf(value[, start])

Searches for an element in the vector.

insert(i, value)

Inserts value at index position i in the vector.

isEmpty()

Checks whether the vector is empty.

iterator()

Creates an iterator for the vector.

reserve(alloc)

Reserve space for alloc elements.

resize(size)

Sets the size of the vector to size.

size()

Returns the number of items in the vector.

append(value: Pro.DEX.AnnotationElement)None

Inserts value at the end of the vector.

Parameters

value (AnnotationElement) – The value to add to the list.

See also insert().

at(i: int)Pro.DEX.AnnotationElement

Returns the item at index position i in the vector. i must be a valid index position in the vector (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

AnnotationElement

clear()None

Removes all the elements from the vector and releases the memory used by the vector.

contains(value: Pro.DEX.AnnotationElement)bool

Checks the presence of an element in the vector.

Parameters

value (AnnotationElement) – The value to check for.

Returns

Returns True if the vector contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.DEX.AnnotationElement)int

Returns the number of occurrences of value in the vector.

Parameters

value (AnnotationElement) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.DEX.AnnotationElement, start: int = 0)int

Searches for an element in the vector.

Parameters
  • value (AnnotationElement) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the vector. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.DEX.AnnotationElement)None

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Parameters
  • i (int) – The position at which to add the value.

  • value (AnnotationElement) – The value to add.

See also append().

isEmpty()bool

Checks whether the vector is empty.

Returns

Returns True if the vector contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.DEX.AnnotationElementListIt

Creates an iterator for the vector.

Returns

Returns the iterator.

Return type

AnnotationElementListIt

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the vector.

Parameters

alloc (int) – The amount of elements to reserve space for.

resize(size: int)None

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Parameters

size (int) – The new size of the vector.

See also size().

size()int
Returns

Returns the number of items in the vector.

Return type

int

See also isEmpty().

class AnnotationElementListIt(obj: Pro.DEX.AnnotationElementList)

Iterator class for AnnotationElementList.

Parameters

obj (AnnotationElementList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.DEX.AnnotationElement
Returns

Returns the next item and advances the iterator by one position.

Return type

AnnotationElement

See also hasNext() and previous().

previous()Pro.DEX.AnnotationElement
Returns

Returns the previous item and moves the iterator back by one position.

Return type

AnnotationElement

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class AnnotationList

List of Annotation elements.

Methods:

append(value)

Inserts value at the end of the vector.

at(i)

Returns the item at index position i in the vector.

clear()

Removes all the elements from the vector and releases the memory used by the vector.

contains(value)

Checks the presence of an element in the vector.

count(value)

Returns the number of occurrences of value in the vector.

indexOf(value[, start])

Searches for an element in the vector.

insert(i, value)

Inserts value at index position i in the vector.

isEmpty()

Checks whether the vector is empty.

iterator()

Creates an iterator for the vector.

reserve(alloc)

Reserve space for alloc elements.

resize(size)

Sets the size of the vector to size.

size()

Returns the number of items in the vector.

append(value: Pro.DEX.Annotation)None

Inserts value at the end of the vector.

Parameters

value (Annotation) – The value to add to the list.

See also insert().

at(i: int)Pro.DEX.Annotation

Returns the item at index position i in the vector. i must be a valid index position in the vector (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

Annotation

clear()None

Removes all the elements from the vector and releases the memory used by the vector.

contains(value: Pro.DEX.Annotation)bool

Checks the presence of an element in the vector.

Parameters

value (Annotation) – The value to check for.

Returns

Returns True if the vector contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.DEX.Annotation)int

Returns the number of occurrences of value in the vector.

Parameters

value (Annotation) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.DEX.Annotation, start: int = 0)int

Searches for an element in the vector.

Parameters
  • value (Annotation) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the vector. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.DEX.Annotation)None

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Parameters
  • i (int) – The position at which to add the value.

  • value (Annotation) – The value to add.

See also append().

isEmpty()bool

Checks whether the vector is empty.

Returns

Returns True if the vector contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.DEX.AnnotationListIt

Creates an iterator for the vector.

Returns

Returns the iterator.

Return type

AnnotationListIt

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the vector.

Parameters

alloc (int) – The amount of elements to reserve space for.

resize(size: int)None

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Parameters

size (int) – The new size of the vector.

See also size().

size()int
Returns

Returns the number of items in the vector.

Return type

int

See also isEmpty().

class AnnotationListIt(obj: Pro.DEX.AnnotationList)

Iterator class for AnnotationList.

Parameters

obj (AnnotationList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.DEX.Annotation
Returns

Returns the next item and advances the iterator by one position.

Return type

Annotation

See also hasNext() and previous().

previous()Pro.DEX.Annotation
Returns

Returns the previous item and moves the iterator back by one position.

Return type

Annotation

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class AnnotationsDirectory

This class represents the annotations directory.

See also DEXObject.GetAnnotationsDirectory().

Attributes:

class_offs

The offset of class annotations.

field_count

The number of field annotations.

field_offs

The offset of field annotations.

method_count

The number of method annotations.

method_offs

The offset of method annotations.

param_count

The number of parameter annotations.

params_offs

The offset of parameter annotations.

class_offs

The offset of class annotations.

field_count

The number of field annotations.

field_offs

The offset of field annotations.

method_count

The number of method annotations.

method_offs

The offset of method annotations.

param_count

The number of parameter annotations.

params_offs

The offset of parameter annotations.

CACC_ABSTRACT: Final[int]

Class access flag.

Declared abstract; must not be instantiated.

CACC_ANNOTATION: Final[int]

Class access flag.

Declared as an annotation type.

CACC_ENUM: Final[int]

Class access flag.

Declared as an enum type.

CACC_FINAL: Final[int]

Class access flag.

Declared final; no subclasses allowed.

CACC_INTERFACE: Final[int]

Class access flag.

Is an interface, not a class.

CACC_PRIVATE: Final[int]

Class access flag.

Declared private; may not be accessed from outside its package.

CACC_PROTECTED: Final[int]

Class access flag.

Declared protected; may be accessed from within its package.

CACC_PUBLIC: Final[int]

Class access flag.

Declared public; may be accessed from outside its package.

CACC_STATIC: Final[int]

Class access flag.

Declared static.

CACC_SYNTHETIC: Final[int]

Class access flag.

Declared synthetic; not present in the source code.

class CatchData

This class represents the catch clause of an exception.

Attributes:

instr

The instruction offset for the catch clause.

type_idx

The type index of the catch clause.

instr

The instruction offset for the catch clause.

Note

This value must be multiplied by 2.

type_idx

The type index of the catch clause.

See also DEXObject.TypeIndexToString().

class CatchList

List of CatchData elements.

Methods:

append(value)

Inserts value at the end of the vector.

at(i)

Returns the item at index position i in the vector.

clear()

Removes all the elements from the vector and releases the memory used by the vector.

contains(value)

Checks the presence of an element in the vector.

count(value)

Returns the number of occurrences of value in the vector.

indexOf(value[, start])

Searches for an element in the vector.

insert(i, value)

Inserts value at index position i in the vector.

isEmpty()

Checks whether the vector is empty.

iterator()

Creates an iterator for the vector.

reserve(alloc)

Reserve space for alloc elements.

resize(size)

Sets the size of the vector to size.

size()

Returns the number of items in the vector.

append(value: Pro.DEX.CatchData)None

Inserts value at the end of the vector.

Parameters

value (CatchData) – The value to add to the list.

See also insert().

at(i: int)Pro.DEX.CatchData

Returns the item at index position i in the vector. i must be a valid index position in the vector (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

CatchData

clear()None

Removes all the elements from the vector and releases the memory used by the vector.

contains(value: Pro.DEX.CatchData)bool

Checks the presence of an element in the vector.

Parameters

value (CatchData) – The value to check for.

Returns

Returns True if the vector contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.DEX.CatchData)int

Returns the number of occurrences of value in the vector.

Parameters

value (CatchData) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.DEX.CatchData, start: int = 0)int

Searches for an element in the vector.

Parameters
  • value (CatchData) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the vector. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.DEX.CatchData)None

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Parameters
  • i (int) – The position at which to add the value.

  • value (CatchData) – The value to add.

See also append().

isEmpty()bool

Checks whether the vector is empty.

Returns

Returns True if the vector contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.DEX.CatchListIt

Creates an iterator for the vector.

Returns

Returns the iterator.

Return type

CatchListIt

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the vector.

Parameters

alloc (int) – The amount of elements to reserve space for.

resize(size: int)None

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Parameters

size (int) – The new size of the vector.

See also size().

size()int
Returns

Returns the number of items in the vector.

Return type

int

See also isEmpty().

class CatchListIt(obj: Pro.DEX.CatchList)

Iterator class for CatchList.

Parameters

obj (CatchList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.DEX.CatchData
Returns

Returns the next item and advances the iterator by one position.

Return type

CatchData

See also hasNext() and previous().

previous()Pro.DEX.CatchData
Returns

Returns the previous item and moves the iterator back by one position.

Return type

CatchData

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class ClassData

This class contains the members of a class.

See also DEXObject.GetClassData().

Attributes:

direct_methods

A EncodedMethodList list of direct methods.

instance_fields

A EncodedFieldList list of instance fields.

size

The size of the class.

static_fields

A EncodedFieldList list of static fields.

virtual_methods

A EncodedMethodList list of virtual methods.

direct_methods

A EncodedMethodList list of direct methods.

See also MethodData.

instance_fields

A EncodedFieldList list of instance fields.

See also FieldData.

size

The size of the class.

static_fields

A EncodedFieldList list of static fields.

See also FieldData.

virtual_methods

A EncodedMethodList list of virtual methods.

See also MethodData.

class ClassDef

This class represents a class definition.

See also DEXObject.GetClass().

Attributes:

access_flags

The access flags of the class (e.g., CACC_PUBLIC).

annotations_off

The annotations offset.

class_data_off

The class data offset.

class_idx

The class type index.

interfaces_off

The interfaces offset.

source_file_idx

The source file index.

static_values_off

The static values offset.

superclass_idx

The superclass type index.

access_flags

The access flags of the class (e.g., CACC_PUBLIC).

annotations_off

The annotations offset.

class_data_off

The class data offset.

class_idx

The class type index.

See also DEXObject.TypeIndexToString().

interfaces_off

The interfaces offset.

source_file_idx

The source file index.

See also DEXObject.IndexToString().

static_values_off

The static values offset.

superclass_idx

The superclass type index.

See also DEXObject.TypeIndexToString().

class CodeItem

This class represents a code item.

See also DEXObject.GetCodeItem().

Attributes:

catches_offset

The offset of the catch clauses.

code_offset

The offset of the code.

debug_info_off

The debug information offset.

ins_size

The number of words of incoming arguments.

insns_size

The size of the code in 16-bit instructions.

outs_size

The number of words of outgoing argument space.

registers_size

The number of registers used by the code.

size

The size of the code item.

tries_offset

The offset of the try clauses.

tries_size

The size of the try clauses.

catches_offset

The offset of the catch clauses.

code_offset

The offset of the code.

debug_info_off

The debug information offset.

ins_size

The number of words of incoming arguments.

insns_size

The size of the code in 16-bit instructions.

outs_size

The number of words of outgoing argument space.

registers_size

The number of registers used by the code.

size

The size of the code item.

tries_offset

The offset of the try clauses.

tries_size

The size of the try clauses.

DBG_ADVANCE_LINE: Final[int]

Debug opcode.

DBG_ADVANCE_PC: Final[int]

Debug opcode.

DBG_END_LOCAL: Final[int]

Debug opcode.

DBG_END_SEQUENCE: Final[int]

Debug opcode.

DBG_RESTART_LOCAL: Final[int]

Debug opcode.

DBG_SET_EPILOGUE_BEGIN: Final[int]

Debug opcode.

DBG_SET_FILE: Final[int]

Debug opcode.

DBG_SET_PROLOGUE_END: Final[int]

Debug opcode.

DBG_START_LOCAL: Final[int]

Debug opcode.

DBG_START_LOCAL_EXTENDED: Final[int]

Debug opcode.

class DEXObject

Bases: Pro.Core.CFFObject

This class represents an Android DEX file.

Methods:

CallSites()

Returns a list of class site structures.

ClassIndexToString(i[, beautify])

Converts a class index to its string representation.

Classes()

Returns a list of class definition structures.

ComputeLayoutRanges(r)

Computes layout ranges for the file.

Demangle(descr)

Unmangles a type.

Disassemble(out, token[, include_nested])

Disassembles the specified class.

DisassembleMethod(out, md[, addclass, curclass])

Disassembles the specified method.

DumpCodeItem(out, offset)

Outputs a code item.

DumpNamelessValue(out, offset_or_r[, …])

Outputs a nameless value.

DumpValue(out, offset_or_r[, with_type_info])

Outputs a value.

FieldIndexToString(i[, beautify, addclass, …])

Converts a field index into its string representation.

GetAnnotationSet(offset, al)

Retrieves a list of annotations.

GetAnnotationsDirectory(offset, ad)

Retrieves the annotations directory.

GetArrayValues(offset)

Retrieves an array of values.

GetClass(i, cd)

Retrieves a class definition.

GetClassData(i, cd)

Retrieves the data of a class.

GetCodeItem(offset, ci[, parse_catches])

Retrieves a code item.

GetDebugInfo(offset, di[, parse_bytecode])

Retrieves debug information.

GetFieldIdItem(i, fii)

Retrieves a field id item.

GetFieldIdItemCount()

Returns the number of field id items.

GetMapListItem(i, mli)

Retrieves a map list item.

GetMapListItemByType(type, mli)

Retrieves a map list item by its type.

GetMapListSize()

Returns the number of map list items.

GetMapTypeName(t)

Retrieves the name of a map type.

GetMethodHandle(i, mh)

Retrieves a method handle.

GetMethodIdItem(i, mii)

Retrieves a method id item.

GetMethodIdItemCount()

Returns the number of method id items.

GetProtoIdItem(i, pii)

Retrieves a proto id item.

GetProtoIdItemCount()

Returns the number of proto id items.

GetTries(ci, tl[, parse_catches])

Retrieves try clauses for a code item.

GetTypeName(t)

Retrieves the name of a type.

GetVisibilityName(v)

Gets the name of a visibility.

Header()

Returns the main header of the Android DEX file.

IndexToString(i)

Retrieves a string from its index.

LastCommonDot(str1, str2)

Retrieves the index of the last common dot between two input strings.

MethodHandles()

Returns a list of method handle structures.

MethodIndexToString(i[, beautify, addclass, …])

Converts a method index into its string representation.

ProtoIndexToString(i[, name, beautify, …])

Converts a prototype index into its string representation.

ReadMUTF8String(offset, maxlen)

Reads a MUTF8 string.

ReadSLEB128(r)

Reads a signed encoded integer.

ReadULEB128(r)

Reads an unsigned encoded integer.

ReadULEB128P1(r)

Reads a P1 unsigned encoded integer.

SplitClassFromNS(name)

Splits a class name from its namespace.

TypeIndexToString(i[, beautify, curclass])

Converts a type index into its string representation.

Attributes:

IDXSO_FieldType

Index string option: puts the return value in a comment.

IDXSO_ReturnComment

Index string option: avoids the ‘return’ string in the comment.

CallSites()Pro.Core.CFFStruct
Returns

Returns a list of class site structures.

Return type

CFFStruct

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

ClassIndexToString(i: int, beautify: bool = True)str

Converts a class index to its string representation.

Parameters
  • i (int) – The class index.

  • beautify (bool) – If True, beautifies the returned string.

Returns

Returns the string if successful; otherwise returns an empty string.

Return type

str

Classes()Pro.Core.CFFStruct
Returns

Returns a list of class definition structures.

Return type

CFFStruct

ComputeLayoutRanges(r: NTRanges)None

Computes layout ranges for the file.

Parameters

r (NTRanges) – The instance of Pro.Core.NTRanges used to compute the layout.

static Demangle(descr: str)str

Unmangles a type.

Note

This method is used internally by TypeIndexToString().

Parameters

descr (str) – The mangled type.

Returns

Returns the unmangled type.

Return type

str

See also TypeIndexToString().

Disassemble(out: Pro.Core.NTTextStream, token: int, include_nested: bool = False)None

Disassembles the specified class.

Parameters
  • out (NTTextStream) – The output stream.

  • token (int) – The class index.

See also DisassembleMethod().

DisassembleMethod(out: Pro.Core.NTTextStream, md: Pro.DEX.MethodData, addclass: bool = False, curclass: str = str())None

Disassembles the specified method.

Parameters
  • out (NTTextStream) – The output stream.

  • md (MethodData) – The method data.

  • addclass (bool) – If True, adds the name of the class.

  • curclass (str) – The name of the current class.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also Disassemble().

DumpCodeItem(out: Pro.Core.NTTextStream, offset: int)None

Outputs a code item.

Parameters
  • out (NTTextStream) – The output stream.

  • offset (int) – The offset of the code item.

See also GetCodeItem().

DumpNamelessValue(out: Pro.Core.NTTextStream, offset_or_r: Union[Pro.Core.CFFBuffer, int], with_type_info: bool = True)None

Outputs a nameless value.

Parameters
DumpValue(out: Pro.Core.NTTextStream, offset_or_r: Union[Pro.Core.CFFBuffer, int], with_type_info: bool = True)None

Outputs a value.

Parameters
FieldIndexToString(i: int, beautify: bool = True, addclass: bool = False, curclass: str = str())str

Converts a field index into its string representation.

Parameters
  • i (int) – The field index.

  • beautify (bool) – If True, beautifies the returned string.

  • addclass (bool) – If True, adds the name of the class to the field name.

  • curclass (str) – The name of the current class.

Returns

Returns the string if successful; otherwise returns an empty string.

Return type

str

GetAnnotationSet(offset: int, al: Pro.DEX.AnnotationList)bool

Retrieves a list of annotations.

Parameters
  • offset (int) – The offset of the annotations.

  • al (AnnotationList) – The list of annotations to retrieve.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also Annotation.

GetAnnotationsDirectory(offset: int, ad: Pro.DEX.AnnotationsDirectory)bool

Retrieves the annotations directory.

Parameters
  • offset (int) – The offset of the annotations directory.

  • ad (AnnotationsDirectory) – The annotations directory to retrieve.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also AnnotationsDirectory.

GetArrayValues(offset: int)Pro.Core.NTUIntVector

Retrieves an array of values.

Parameters

offset (int) – The offset of the values.

Returns

Returns the value array.

Return type

NTUIntVector

GetClass(i: int, cd: Pro.DEX.ClassDef)bool

Retrieves a class definition.

Parameters
  • i (int) – The index of the class.

  • cd (ClassDef) – The instance of the class definition to retrieve.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also ClassDef.

GetClassData(i: int, cd: Pro.DEX.ClassData)bool

Retrieves the data of a class.

Parameters
  • i (int) – The index of the class.

  • cd (ClassData) – The instance of the class data to retrieve.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also ClassData.

GetCodeItem(offset: int, ci: Pro.DEX.CodeItem, parse_catches: bool = False)bool

Retrieves a code item.

Parameters
  • offset (int) – The offset of the code item.

  • ci (CodeItem) – The instance of the code item to retrieve.

  • parse_catches (bool) – If True, retrieves catch clauses.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also CodeItem.

GetDebugInfo(offset: int, di: Pro.DEX.DebugInfo, parse_bytecode: bool = False)bool

Retrieves debug information.

Parameters
  • offset (int) – The offset of the debug information.

  • di (DebugInfo) – The instance of the debug information to retrieve.

  • parse_bytecode (bool) – If True, parses the byte-code.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also DebugInfo.

GetFieldIdItem(i: int, fii: Pro.DEX.FieldIdItem)bool

Retrieves a field id item.

Parameters
  • i (int) – The index of the field id item to retrieve.

  • fii (FieldIdItem) – The instance of the field id item to retrieve.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also GetFieldIdItemCount().

GetFieldIdItemCount()int
Returns

Returns the number of field id items.

Return type

int

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also GetFieldIdItem().

GetMapListItem(i: int, mli: Pro.DEX.MapListItem)bool

Retrieves a map list item.

Parameters
  • i (int) – The index of the map list item to retrieve.

  • mli (MapListItem) – The instance of the map list item to retrieve.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also GetMapListSize() and GetMapListItemByType().

GetMapListItemByType(type: int, mli: Pro.DEX.MapListItem)bool

Retrieves a map list item by its type.

Parameters
  • type (int) – The type of the map list item to retrieve.

  • mli (MapListItem) – The instance of the map list item to retrieve.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also GetMapListSize() and GetMapListItem().

GetMapListSize()int
Returns

Returns the number of map list items.

Return type

int

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also GetMapListItem().

static GetMapTypeName(t: int)str

Retrieves the name of a map type.

Parameters

t (int) – The map type.

Returns

Returns the name of the map type if successful; otherwise returns None

Return type

str

GetMethodHandle(i: int, mh: Pro.DEX.MethodHandle)bool

Retrieves a method handle.

Parameters
  • i (int) – The index of the method handle to retrieve.

  • mh (MethodHandle) – The instance of the method handle to retrieve.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also MethodHandles().

GetMethodIdItem(i: int, mii: Pro.DEX.MethodIdItem)bool

Retrieves a method id item.

Parameters
  • i (int) – The index of the method id item to retrieve.

  • mii (MethodIdItem) – The instance of the method id item to retrieve.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also GetMethodIdItemCount().

GetMethodIdItemCount()int
Returns

Returns the number of method id items.

Return type

int

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also GetMethodIdItem().

GetProtoIdItem(i: int, pii: Pro.DEX.ProtoIdItem)bool

Retrieves a proto id item.

Parameters
  • i (int) – The index of the method id item to retrieve.

  • pii (ProtoIdItem) – The instance of the proto id item to retrieve.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also GetProtoIdItemCount().

GetProtoIdItemCount()int
Returns

Returns the number of proto id items.

Return type

int

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also GetProtoIdItem().

GetTries(ci: Pro.DEX.CodeItem, tl: Pro.DEX.TryList, parse_catches: bool = False)bool

Retrieves try clauses for a code item.

Parameters
  • ci (CodeItem) – The code item.

  • tl (TryList) – The instance of try clauses to retrieve.

  • parse_catches (bool) – If True, parses the catch clauses.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

static GetTypeName(t: int)str

Retrieves the name of a type.

Parameters

t (int) – The type.

Returns

Returns the name of the type if successful; otherwise returns None

Return type

str

static GetVisibilityName(v: int)str

Gets the name of a visibility.

Parameters

v (int) – The visibility.

Returns

Returns the name of the visibility if successful; otherwise returns None

Return type

str

Header()Pro.Core.CFFStruct
Returns

Returns the main header of the Android DEX file.

Return type

CFFStruct

IDXSO_FieldType: Final[int]

Index string option: puts the return value in a comment.

IDXSO_ReturnComment: Final[int]

Index string option: avoids the ‘return’ string in the comment.

IndexToString(i: int)str

Retrieves a string from its index.

Parameters

i (int) – The string index.

Returns

Returns the string if successful; otherwise returns an empty string.

Return type

str

static LastCommonDot(str1: str, str2: str)int

Retrieves the index of the last common dot between two input strings.

Parameters
  • str1 (str) – The first input string.

  • str2 (str) – The second input string.

Returns

Returns the index of the last common dot if successful; otherwise returns -1.

Return type

int

MethodHandles()Pro.Core.CFFStruct
Returns

Returns a list of method handle structures.

Return type

CFFStruct

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

MethodIndexToString(i: int, beautify: bool = True, addclass: bool = False, curclass: str = str(), params_names: Pro.Core.NTUIntVector = NTUIntVector())str

Converts a method index into its string representation.

Parameters
  • i (int) – The method index.

  • beautify (bool) – If True, beautifies the returned string.

  • addclass (bool) – If True, adds the name of the class to the method name.

  • curclass (str) – The name of the current class.

  • params_names (NTUIntVector) – The name indexes of the parameters.

Returns

Returns the string if successful; otherwise returns an empty string.

Return type

str

ProtoIndexToString(i: int, name: str = str(), beautify: bool = True, curclass: str = str(), params_names: Pro.Core.NTUIntVector = NTUIntVector())str

Converts a prototype index into its string representation.

Parameters
  • i (int) – The prototype index.

  • name (str) – The name of the prototype.

  • beautify (bool) – If True, beautifies the returned string.

  • curclass (str) – The name of the current class.

  • params_names (NTUIntVector) – The name indexes of the parameters.

Returns

Returns the string if successful; otherwise returns an empty string.

Return type

str

ReadMUTF8String(offset: int, maxlen: int)tuple

Reads a MUTF8 string.

Parameters
  • offset (int) – The offset of the string.

  • maxlen (int) – The maximum length of the string.

Returns

Returns a tuple containing the string read and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

str

ReadSLEB128(r: Pro.Core.CFFBuffer)int

Reads a signed encoded integer.

Parameters

r (CFFBuffer) – The Pro.Core.CFFBuffer instance.

Returns

Returns the integer read.

Return type

int

See also ReadULEB128() and ReadULEB128P1().

ReadULEB128(r: Pro.Core.CFFBuffer)int

Reads an unsigned encoded integer.

Parameters

r (CFFBuffer) – The Pro.Core.CFFBuffer instance.

Returns

Returns the integer read.

Return type

int

See also ReadSLEB128() and ReadULEB128P1().

ReadULEB128P1(r: Pro.Core.CFFBuffer)int

Reads a P1 unsigned encoded integer.

Parameters

r (CFFBuffer) – The Pro.Core.CFFBuffer instance.

Returns

Returns the integer read.

Return type

int

See also ReadSLEB128() and ReadULEB128().

static SplitClassFromNS(name: str)tuple

Splits a class name from its namespace.

Parameters

name (str) – The input string.

Returns

Returns the class name if successful; otherwise returns an empty string.

Return type

str

TypeIndexToString(i: int, beautify: bool = True, curclass: str = str())str

Converts a type index into its string representation.

Parameters
  • i (int) – The type index.

  • beautify (bool) – If True, beautifies the returned string.

Returns

Returns the string if successful; otherwise returns an empty string.

Return type

str

class DebugInfo

This class represents debug information.

See also DEXObject.GetDebugInfo().

Attributes:

bytecode_offs

The offset of the byte-code.

line_start

The start line.

params_names

Array of parameter name indexes.

size

The size of the debug information.

bytecode_offs

The offset of the byte-code.

line_start

The start line.

params_names

Array of parameter name indexes.

size

The size of the debug information.

ENDIAN_CONSTANT: Final[int]

Little-endian constant.

See also REVERSE_ENDIAN_CONSTANT.

class EncodedFieldList

List of FieldData elements.

Methods:

append(value)

Inserts value at the end of the vector.

at(i)

Returns the item at index position i in the vector.

clear()

Removes all the elements from the vector and releases the memory used by the vector.

contains(value)

Checks the presence of an element in the vector.

count(value)

Returns the number of occurrences of value in the vector.

indexOf(value[, start])

Searches for an element in the vector.

insert(i, value)

Inserts value at index position i in the vector.

isEmpty()

Checks whether the vector is empty.

iterator()

Creates an iterator for the vector.

reserve(alloc)

Reserve space for alloc elements.

resize(size)

Sets the size of the vector to size.

size()

Returns the number of items in the vector.

append(value: Pro.DEX.FieldData)None

Inserts value at the end of the vector.

Parameters

value (FieldData) – The value to add to the list.

See also insert().

at(i: int)Pro.DEX.FieldData

Returns the item at index position i in the vector. i must be a valid index position in the vector (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

FieldData

clear()None

Removes all the elements from the vector and releases the memory used by the vector.

contains(value: Pro.DEX.FieldData)bool

Checks the presence of an element in the vector.

Parameters

value (FieldData) – The value to check for.

Returns

Returns True if the vector contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.DEX.FieldData)int

Returns the number of occurrences of value in the vector.

Parameters

value (FieldData) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.DEX.FieldData, start: int = 0)int

Searches for an element in the vector.

Parameters
  • value (FieldData) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the vector. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.DEX.FieldData)None

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Parameters
  • i (int) – The position at which to add the value.

  • value (FieldData) – The value to add.

See also append().

isEmpty()bool

Checks whether the vector is empty.

Returns

Returns True if the vector contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.DEX.EncodedFieldListIt

Creates an iterator for the vector.

Returns

Returns the iterator.

Return type

EncodedFieldListIt

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the vector.

Parameters

alloc (int) – The amount of elements to reserve space for.

resize(size: int)None

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Parameters

size (int) – The new size of the vector.

See also size().

size()int
Returns

Returns the number of items in the vector.

Return type

int

See also isEmpty().

class EncodedFieldListIt(obj: Pro.DEX.EncodedFieldList)

Iterator class for EncodedFieldList.

Parameters

obj (EncodedFieldList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.DEX.FieldData
Returns

Returns the next item and advances the iterator by one position.

Return type

FieldData

See also hasNext() and previous().

previous()Pro.DEX.FieldData
Returns

Returns the previous item and moves the iterator back by one position.

Return type

FieldData

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class EncodedMethodList

List of MethodData elements.

Methods:

append(value)

Inserts value at the end of the vector.

at(i)

Returns the item at index position i in the vector.

clear()

Removes all the elements from the vector and releases the memory used by the vector.

contains(value)

Checks the presence of an element in the vector.

count(value)

Returns the number of occurrences of value in the vector.

indexOf(value[, start])

Searches for an element in the vector.

insert(i, value)

Inserts value at index position i in the vector.

isEmpty()

Checks whether the vector is empty.

iterator()

Creates an iterator for the vector.

reserve(alloc)

Reserve space for alloc elements.

resize(size)

Sets the size of the vector to size.

size()

Returns the number of items in the vector.

append(value: Pro.DEX.MethodData)None

Inserts value at the end of the vector.

Parameters

value (MethodData) – The value to add to the list.

See also insert().

at(i: int)Pro.DEX.MethodData

Returns the item at index position i in the vector. i must be a valid index position in the vector (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

MethodData

clear()None

Removes all the elements from the vector and releases the memory used by the vector.

contains(value: Pro.DEX.MethodData)bool

Checks the presence of an element in the vector.

Parameters

value (MethodData) – The value to check for.

Returns

Returns True if the vector contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.DEX.MethodData)int

Returns the number of occurrences of value in the vector.

Parameters

value (MethodData) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.DEX.MethodData, start: int = 0)int

Searches for an element in the vector.

Parameters
  • value (MethodData) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the vector. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.DEX.MethodData)None

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Parameters
  • i (int) – The position at which to add the value.

  • value (MethodData) – The value to add.

See also append().

isEmpty()bool

Checks whether the vector is empty.

Returns

Returns True if the vector contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.DEX.EncodedMethodListIt

Creates an iterator for the vector.

Returns

Returns the iterator.

Return type

EncodedMethodListIt

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the vector.

Parameters

alloc (int) – The amount of elements to reserve space for.

resize(size: int)None

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Parameters

size (int) – The new size of the vector.

See also size().

size()int
Returns

Returns the number of items in the vector.

Return type

int

See also isEmpty().

class EncodedMethodListIt(obj: Pro.DEX.EncodedMethodList)

Iterator class for EncodedMethodList.

Parameters

obj (EncodedMethodList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.DEX.MethodData
Returns

Returns the next item and advances the iterator by one position.

Return type

MethodData

See also hasNext() and previous().

previous()Pro.DEX.MethodData
Returns

Returns the previous item and moves the iterator back by one position.

Return type

MethodData

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

FACC_ENUM: Final[int]

Field access flag.

Declared as an element of an enum.

FACC_FINAL: Final[int]

Field access flag.

Declared final; never directly assigned to after object construction.

FACC_PRIVATE: Final[int]

Field access flag.

Declared private; usable only within the defining class.

FACC_PROTECTED: Final[int]

Field access flag.

Declared protected; may be accessed within subclasses.

FACC_PUBLIC: Final[int]

Field access flag.

Declared public; may be accessed from outside its package.

FACC_STATIC: Final[int]

Field access flag.

Declared static.

FACC_SYNTHETIC: Final[int]

Field access flag.

Declared synthetic; not present in the source code.

FACC_TRANSIENT: Final[int]

Field access flag.

Declared transient; not written or read by a persistent object manager.

FACC_VOLATILE: Final[int]

Field access flag.

Declared volatile; cannot be cached.

class FieldData

This class represents the data of a field.

Attributes:

access_flags

The access flags (e.g., FACC_PUBLIC).

index

The index of the field.

offset

The offset of the data.

access_flags

The access flags (e.g., FACC_PUBLIC).

index

The index of the field.

offset

The offset of the data.

class FieldIdItem

This class represents the data of a field id item.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

Attributes:

class_idx

The index of the class.

name_idx

The index of the name.

type_idx

The index of the type.

class_idx

The index of the class.

name_idx

The index of the name.

type_idx

The index of the type.

MACC_ABSTRACT: Final[int]

Method access flag.

Declared abstract; no implementation is provided.

MACC_BRIDGE: Final[int]

Method access flag.

A bridge method, generated by the compiler.

MACC_CONSTRUCTOR: Final[int]

Method access flag.

A constructor method.

MACC_DECLARED_SYNCHRONIZED: Final[int]

Method access flag.

Declared synchronized; invocation is wrapped by a monitor use.

MACC_FINAL: Final[int]

Method access flag.

Declared final; no subclasses allowed.

MACC_NATIVE: Final[int]

Method access flag.

Declared native; implemented in a language other than Java.

MACC_PRIVATE: Final[int]

Method access flag.

Declared private; accessible only within the defining class.

MACC_PROTECTED: Final[int]

Method access flag.

Declared protected; may be accessed within subclasses.

MACC_PUBLIC: Final[int]

Method access flag.

Declared public; may be accessed from outside its package.

MACC_STATIC: Final[int]

Method access flag.

Declared static.

MACC_STRICT: Final[int]

Method access flag.

Declared strictfp; floating-point mode is FP-strict.

MACC_SYNCHRONIZED: Final[int]

Method access flag.

Declared synchronized; invocation is wrapped by a monitor use.

MACC_SYNTHETIC: Final[int]

Method access flag.

Declared synthetic; not present in the source code.

MACC_VARARGS: Final[int]

Method access flag.

Declared with variable number of arguments.

METHOD_HANDLE_TYPE_INSTANCE_GET: Final[int]

Method handle type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

METHOD_HANDLE_TYPE_INSTANCE_PUT: Final[int]

Method handle type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

METHOD_HANDLE_TYPE_INVOKE_CONSTRUCTOR: Final[int]

Method handle type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

METHOD_HANDLE_TYPE_INVOKE_DIRECT: Final[int]

Method handle type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

METHOD_HANDLE_TYPE_INVOKE_INSTANCE: Final[int]

Method handle type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

METHOD_HANDLE_TYPE_INVOKE_INTERFACE: Final[int]

Method handle type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

METHOD_HANDLE_TYPE_INVOKE_STATIC: Final[int]

Method handle type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

METHOD_HANDLE_TYPE_STATIC_GET: Final[int]

Method handle type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

METHOD_HANDLE_TYPE_STATIC_PUT: Final[int]

Method handle type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

class MapListItem

This class represents a map list item.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

Attributes:

offset

The offset of the item.

size

The size of the item.

type

The type of the item.

offset

The offset of the item.

size

The size of the item.

type

The type of the item.

class MethodData

This class represents the data of a method.

Attributes:

access_flags

The access flags (e.g., MACC_PUBLIC).

code_off

The offset of the code.

index

The index of the method.

offset

The offset of the data.

access_flags

The access flags (e.g., MACC_PUBLIC).

code_off

The offset of the code.

index

The index of the method.

offset

The offset of the data.

class MethodHandle

This class represents a method handle.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

Attributes:

field_or_method_id

Either a field or method index.

is_field_id

If True, field_or_method_id represents a field index; otherwise it represents a method index.

type

The type of method handle (e.g., METHOD_HANDLE_TYPE_INSTANCE_GET).

field_or_method_id

Either a field or method index.

See also is_field_id.

is_field_id

If True, field_or_method_id represents a field index; otherwise it represents a method index.

See also field_or_method_id.

type

The type of method handle (e.g., METHOD_HANDLE_TYPE_INSTANCE_GET).

class MethodIdItem

This class represents a method id item.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

Attributes:

class_idx

The index of the class.

name_idx

The index of the name.

proto_idx

The index of the prototype.

class_idx

The index of the class.

name_idx

The index of the name.

proto_idx

The index of the prototype.

NO_INDEX: Final[int]

Default value of TryData.catch_all_instr.

See also TryData.catch_all_instr.

class ProtoIdItem

This class represents a prototype id item.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

Attributes:

parameters_offset

The offset to the list of parameters.

return_type_idx

The return type index.

shorty_idx

The index to the shortened prototype string.

parameters_offset

The offset to the list of parameters.

return_type_idx

The return type index.

shorty_idx

The index to the shortened prototype string.

REVERSE_ENDIAN_CONSTANT: Final[int]

Big-endian constant.

See also ENDIAN_CONSTANT.

SmaliTag_ClassDef: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

SmaliTag_ClassRef: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

SmaliTag_Instruction: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

SmaliTag_Invalid: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

SmaliTag_Label: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

SmaliTag_LabelJump: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

SmaliTag_MethodDef: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

SmaliTag_MethodRef: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

SmaliTag_Offset: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

SmaliTag_String: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

SmaliTag_TypeRef: Final[int]

Smali bytecode tag.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

See also DEXObject.Disassemble().

TYPE_ANNOTATIONS_DIRECTORY_ITEM: Final[int]

Annotations directory item type.

TYPE_ANNOTATION_ITEM: Final[int]

Annotation item type.

TYPE_ANNOTATION_SET_ITEM: Final[int]

Annotation set item type.

TYPE_ANNOTATION_SET_REF_LIST: Final[int]

Annotation set reference list type.

TYPE_CALL_SITE_ID_ITEM: Final[int]

Call site id item type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

TYPE_CLASS_DATA_ITEM: Final[int]

Class data item type.

TYPE_CLASS_DEF_ITEM: Final[int]

Class definition item type.

TYPE_CODE_ITEM: Final[int]

Code item type.

TYPE_DEBUG_INFO_ITEM: Final[int]

Debug information item type.

TYPE_ENCODED_ARRAY_ITEM: Final[int]

Encoded array item type.

TYPE_FIELD_ID_ITEM: Final[int]

Field id item type.

TYPE_HEADER_ITEM: Final[int]

Header item type.

TYPE_HIDDENAPI_CLASS_DATA_ITEM: Final[int]

Hidden API class data item type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

TYPE_MAP_LIST: Final[int]

Map list type.

TYPE_METHOD_HANDLE_ITEM: Final[int]

Method handle item type.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

TYPE_METHOD_ID_ITEM: Final[int]

Method id item type.

TYPE_PROTO_ID_ITEM: Final[int]

Prototype id item type.

TYPE_STRING_DATA_ITEM: Final[int]

String data item type.

TYPE_STRING_ID_ITEM: Final[int]

String id item type.

TYPE_TYPE_ID_ITEM: Final[int]

Type id item type.

TYPE_TYPE_LIST: Final[int]

Type list type.

class TryData

This class represents a try clause.

See also DEXObject.GetTries().

Attributes:

catch_all_instr

The offset of the catch all clause.

catch_list

A CatchList list of catch clauses.

count

The count of instruction contained in the try clause.

handler_offset

The offset of the handler.

start_instr

The start instruction of the try clause.

catch_all_instr

The offset of the catch all clause.

Note

This value must be multiplied by 2.

catch_list

A CatchList list of catch clauses.

count

The count of instruction contained in the try clause.

handler_offset

The offset of the handler.

start_instr

The start instruction of the try clause.

class TryList

List of TryData elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.DEX.TryData)None

Inserts value at the end of the list.

Parameters

value (TryData) – The value to add to the list.

See also insert().

at(i: int)Pro.DEX.TryData

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

TryData

clear()None

Removes all items from the list.

contains(value: Pro.DEX.TryData)bool

Checks the presence of an element in the list.

Parameters

value (TryData) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.DEX.TryData)int

Returns the number of occurrences of value in the list.

Parameters

value (TryData) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.DEX.TryData, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (TryData) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.DEX.TryData)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (TryData) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.DEX.TryListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

TryListIt

removeAll(value: Pro.DEX.TryData)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (TryData) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.DEX.TryData

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

TryData

See also removeAt().

class TryListIt(obj: Pro.DEX.TryList)

Iterator class for TryList.

Parameters

obj (TryList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.DEX.TryData
Returns

Returns the next item and advances the iterator by one position.

Return type

TryData

See also hasNext() and previous().

previous()Pro.DEX.TryData
Returns

Returns the previous item and moves the iterator back by one position.

Return type

TryData

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

VALUE_ANNOTATION: Final[int]

Annotation value.

VALUE_ARRAY: Final[int]

Array value.

VALUE_BOOLEAN: Final[int]

Boolean value.

VALUE_BYTE: Final[int]

Byte value.

VALUE_CHAR: Final[int]

Character value.

VALUE_DOUBLE: Final[int]

Double value.

VALUE_ENUM: Final[int]

Enum value.

VALUE_FIELD: Final[int]

Field value.

VALUE_FLOAT: Final[int]

Float value.

VALUE_INT: Final[int]

Integer value.

VALUE_LONG: Final[int]

Long value.

VALUE_METHOD: Final[int]

Method value.

VALUE_METHOD_HANDLE: Final[int]

Method handle value.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

VALUE_METHOD_TYPE: Final[int]

Method type value.

Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.

VALUE_NULL: Final[int]

Null value.

VALUE_SHORT: Final[int]

Short value.

VALUE_STRING: Final[int]

String value.

VALUE_TYPE: Final[int]

Type value.

VISIBILITY_BUILD: Final[int]

Build visibility.

VISIBILITY_RUNTIME: Final[int]

Run-time visibility.

VISIBILITY_SYSTEM: Final[int]

System visibility.