public interface

IDGlobalContext

com.pnfsoftware.jeb.core.units.code.android.ir.IDGlobalContext

Class Overview

dexdec IR global context. This object also provides factory methods to create non-instruction elements. (IR instructions can be created using a method context).

Summary

Public Methods
abstract IDAllocObjectInfo createAllocObjectInfo(String objectType)
abstract IDAllocObjectInfo createAllocObjectInfo(IJavaType objectType)
abstract IDArrayElt createArrayElt(IDExpression array, IDExpression index, IJavaType type)
Create an array element.
abstract IDInstanceField createArrayLength(IDExpression instance)
abstract IDImm createBoolean(boolean value)
Wrapper used to create boolean constants.
abstract IDNewArrayInfo createBooleanArray(boolean[] values)
abstract IDImm createByte(byte value)
Wrapper used to create byte constants.
abstract IDNewArrayInfo createByteArray(byte[] values)
abstract IDCallInfo createCallInfo(DInvokeType invoketype, int methodindex, List<IDExpression> arguments)
abstract IDCallInfo createCallInfo(DInvokeType invoketype, String msig, List<IDExpression> arguments)
abstract IDCallInfo createCallInfo(IDIndex methodindex, IDExpression[] arguments, IJavaType returntype, String methodsig, DInvokeType invoketype)
abstract IDCallInfo createCallInfo(IDIndex methodindex, List<IDExpression> arguments, IJavaType returntype, String methodsig, DInvokeType invoketype)
abstract IDOperation createCastOperation(String castTypeSignature, IDExpression exp)
Create a cast operation.
abstract IDOperation createCastOperation(IJavaType castType, IDExpression exp)
Create a cast operation.
abstract IDImm createChar(char value)
Wrapper used to create char constants.
abstract IDNewArrayInfo createCharArray(char[] values)
abstract IDStaticField createClassObject(String csig)
abstract IDOperation createConditional(IJavaType type, IDPredicate pred, IDExpression expTrue, IDExpression expFalse)
Convenience operation.
abstract IDImm createConstant(long rawvalue, IJavaType type)
Create immediate constants.
abstract IDImm createDouble(double value)
Wrapper used to create double constants.
abstract IDNewArrayInfo createDoubleArray(double[] values)
abstract IDImm createFloat(float value)
Wrapper used to create float constants.
abstract IDNewArrayInfo createFloatArray(float[] values)
abstract IDImm createImm(long rawvalue, IJavaType type)
Create immediate constants.
abstract IDIndex createIndex(int value)
Create an immutable pool index value.
abstract IDInstanceField createInstanceField(IDExpression instance, String fsig)
abstract IDInstanceField createInstanceField(IDExpression instance, IDIndex index, IJavaType fieldtype, String fieldname)
abstract IDInstanceField createInstanceField(IDExpression instance, String fsig, boolean createRefIfDoesNotExist)
abstract IDInstanceField createInstanceField(IDExpression instance, IDexField f)
abstract IDImm createInt(int value)
Wrapper used to create int constants.
abstract IDNewArrayInfo createIntArray(int[] values)
abstract IDImm createLong(long value)
Wrapper used to create long constants.
abstract IDNewArrayInfo createLongArray(long[] values)
abstract IDMasterOptimizer createMasterOptimizer(IDMethodContext methodContext)
Create a pre-initialized master optimizer targeting the provided method.
abstract IDMasterOptimizer createMasterOptimizer(IDMethodContext methodContext, boolean registerBuiltinOptimizers, boolean initializeWithDexdecSettings, boolean registerExternalOptimizers)
Create a master optimizer targeting the provided method.
abstract IDNewArrayInfo createNewArrayInfo(IJavaType type, IDExpression size, List<IDExpression> initvals)
abstract IDNewInfo createNewInfo(IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, List<IDExpression> arguments, String methodsig)
abstract IDNewInfo createNewInfo(String constructorSig, IDExpression... arguments)
Convenience method to create a new SomeObject(..) operand.
abstract IDNewInfo createNewInfo(IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, IDExpression[] arguments, String methodsig)
abstract IDImm createNull()
Wrapper used to create the null constant.
abstract IDOperation createOperation(IJavaType type, JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2)
Create an operation element, such an an arithmetic or bitwise expression, conditional, string concatenation, or cast operation.
abstract IDOperation createOperation(IJavaType type, IDExpression left, IJavaOperator operator, IDExpression right)
Create an operation element, such an an arithmetic or bitwise expression, conditional, string concatenation, or cast operation.
abstract IDPredicate createPredicate(JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2)
Create a predicate expression.
abstract IDPredicate createPredicate(IDExpression left, IJavaOperator operator, IDExpression right)
Create a predicate expression.
abstract IDPredicate createPredicate(IDExpression e)
Create a predicate expression.
abstract IDImm createRef(int refid)
Create an object reference.
abstract IDImm createRef(int refid, IJavaType reftype)
Create an object reference.
abstract IDReferenceType createReferenceType(String csig)
Create a reference type expression.
abstract IDReferenceType createReferenceType(IDIndex cindex, IJavaType ctype)
Create a reference type expression.
abstract IDImm createShort(short value)
Wrapper used to create short constants.
abstract IDNewArrayInfo createShortArray(short[] values)
abstract IDState createState(boolean initForEmulation, boolean loadDexdecEmuSettings)
Create a fresh IR state.
abstract IDState createState()
Create a fresh, uninitialized IR state.
abstract IDStaticField createStaticField(IDIndex index, IJavaType fieldtype, String csig, String fieldname)
abstract IDStaticField createStaticField(IDexField f)
abstract IDStaticField createStaticField(String fsig)
abstract IDStaticField createStaticField(String fsig, boolean createRefIfDoesNotExist)
abstract IDImm createString(IDIndex stringIndex)
Wrapper used to create string constants.
abstract IDImm createString(String value)
Wrapper used to create string constants.
abstract IDNewArrayInfo createStringArray(String[] values)
abstract IDSwitchData createSwitchData()
Create a switch data element used in Switch instructions.
abstract IDTarget createTarget(int offset)
abstract Object getData(String key)
Retrieve an arbitrary object in this global context.
abstract Set<String> getDataKeys()
Retrieve the set of objects keys for data elements stored using setData.
abstract IDexDecompilerUnit getDecompiler()
Retrieve the managing dex decompiler object.
abstract IDexUnit getDex()
Retrieve the underlying dex unit object.
abstract IDState getEmulator()
Retrieve the current IR state associated with the current thread.
abstract IJavaOperatorFactory getOperatorFactory()
Retrieve the global high-level operator factory.
abstract IDState getThreadSharedState()
Retrieve the current IR state associated with the current thread.
abstract IJavaTypeFactory getTypeFactory()
Retrieve the global high-level type factory.
abstract IDTypeInfoProvider getTypeInfoProvider()
Retrieve the type information provider.
abstract void resetDeobfuscatorCounters(String entryName)
Reset deobfuscators counters, generally updated by IR optimizers that rely on IR emulation.
abstract void resetDeobfuscatorCounters()
Reset deobfuscators counters, generally updated by IR optimizers that rely on IR emulation.
abstract Object setData(String key, Object value)
Store an arbitrary object in this global context.

Public Methods

public abstract IDAllocObjectInfo createAllocObjectInfo (String objectType)

public abstract IDAllocObjectInfo createAllocObjectInfo (IJavaType objectType)

public abstract IDArrayElt createArrayElt (IDExpression array, IDExpression index, IJavaType type)

Create an array element.

public abstract IDInstanceField createArrayLength (IDExpression instance)

public abstract IDImm createBoolean (boolean value)

Wrapper used to create boolean constants.

public abstract IDNewArrayInfo createBooleanArray (boolean[] values)

public abstract IDImm createByte (byte value)

Wrapper used to create byte constants.

public abstract IDNewArrayInfo createByteArray (byte[] values)

public abstract IDCallInfo createCallInfo (DInvokeType invoketype, int methodindex, List<IDExpression> arguments)

public abstract IDCallInfo createCallInfo (DInvokeType invoketype, String msig, List<IDExpression> arguments)

public abstract IDCallInfo createCallInfo (IDIndex methodindex, IDExpression[] arguments, IJavaType returntype, String methodsig, DInvokeType invoketype)

public abstract IDCallInfo createCallInfo (IDIndex methodindex, List<IDExpression> arguments, IJavaType returntype, String methodsig, DInvokeType invoketype)

public abstract IDOperation createCastOperation (String castTypeSignature, IDExpression exp)

Create a cast operation.

public abstract IDOperation createCastOperation (IJavaType castType, IDExpression exp)

Create a cast operation.

public abstract IDImm createChar (char value)

Wrapper used to create char constants.

public abstract IDNewArrayInfo createCharArray (char[] values)

public abstract IDStaticField createClassObject (String csig)

public abstract IDOperation createConditional (IJavaType type, IDPredicate pred, IDExpression expTrue, IDExpression expFalse)

Convenience operation.

public abstract IDImm createConstant (long rawvalue, IJavaType type)

Create immediate constants. The same as createImm(long, IJavaType).

public abstract IDImm createDouble (double value)

Wrapper used to create double constants.

public abstract IDNewArrayInfo createDoubleArray (double[] values)

public abstract IDImm createFloat (float value)

Wrapper used to create float constants.

public abstract IDNewArrayInfo createFloatArray (float[] values)

public abstract IDImm createImm (long rawvalue, IJavaType type)

Create immediate constants.

public abstract IDIndex createIndex (int value)

Create an immutable pool index value.

Parameters
value index value
Returns
  • the index object

public abstract IDInstanceField createInstanceField (IDExpression instance, String fsig)

public abstract IDInstanceField createInstanceField (IDExpression instance, IDIndex index, IJavaType fieldtype, String fieldname)

public abstract IDInstanceField createInstanceField (IDExpression instance, String fsig, boolean createRefIfDoesNotExist)

public abstract IDInstanceField createInstanceField (IDExpression instance, IDexField f)

public abstract IDImm createInt (int value)

Wrapper used to create int constants.

public abstract IDNewArrayInfo createIntArray (int[] values)

public abstract IDImm createLong (long value)

Wrapper used to create long constants.

public abstract IDNewArrayInfo createLongArray (long[] values)

public abstract IDMasterOptimizer createMasterOptimizer (IDMethodContext methodContext)

Create a pre-initialized master optimizer targeting the provided method. This convenience method is equivalent to createMasterOptimizer(ctx, true, true, true).

public abstract IDMasterOptimizer createMasterOptimizer (IDMethodContext methodContext, boolean registerBuiltinOptimizers, boolean initializeWithDexdecSettings, boolean registerExternalOptimizers)

Create a master optimizer targeting the provided method.

public abstract IDNewArrayInfo createNewArrayInfo (IJavaType type, IDExpression size, List<IDExpression> initvals)

public abstract IDNewInfo createNewInfo (IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, List<IDExpression> arguments, String methodsig)

public abstract IDNewInfo createNewInfo (String constructorSig, IDExpression... arguments)

Convenience method to create a new SomeObject(..) operand.

public abstract IDNewInfo createNewInfo (IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, IDExpression[] arguments, String methodsig)

public abstract IDImm createNull ()

Wrapper used to create the null constant.

public abstract IDOperation createOperation (IJavaType type, JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2)

Create an operation element, such an an arithmetic or bitwise expression, conditional, string concatenation, or cast operation.

Parameters
type may be left null to let a basic type for the expression be auto-determined

public abstract IDOperation createOperation (IJavaType type, IDExpression left, IJavaOperator operator, IDExpression right)

Create an operation element, such an an arithmetic or bitwise expression, conditional, string concatenation, or cast operation.

public abstract IDPredicate createPredicate (JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2)

Create a predicate expression.

public abstract IDPredicate createPredicate (IDExpression left, IJavaOperator operator, IDExpression right)

Create a predicate expression.

public abstract IDPredicate createPredicate (IDExpression e)

Create a predicate expression.

public abstract IDImm createRef (int refid)

Create an object reference. The type of the reference will be the generic wildcard object type

Parameters
refid object reference id
Returns
  • an imm representing an object reference

public abstract IDImm createRef (int refid, IJavaType reftype)

Create an object reference.

Parameters
refid object reference id
reftype optional object type; if null is provided, the generic wildcard object type is used
Returns
  • an imm representing an object reference

public abstract IDReferenceType createReferenceType (String csig)

Create a reference type expression.

public abstract IDReferenceType createReferenceType (IDIndex cindex, IJavaType ctype)

Create a reference type expression.

public abstract IDImm createShort (short value)

Wrapper used to create short constants.

public abstract IDNewArrayInfo createShortArray (short[] values)

public abstract IDState createState (boolean initForEmulation, boolean loadDexdecEmuSettings)

Create a fresh IR state. The IR state is context-less (no context is created).

Parameters
initForEmulation if true, the state settings are changed to allow for IR emulation
loadDexdecEmuSettings if true, the global dexdec emulator configuration file (dexdec-emu.cfg in your plugins folder) is used to further configure the State
Returns
  • a new IR state

public abstract IDState createState ()

Create a fresh, uninitialized IR state. The IR state is context-less (no context is created). Settings are left on default values, in particular, the maximum iteration count and duration are set to the default values (see DEFAULT_MAX_ITERCOUNT, DEFAULT_MAX_DURATION). The emulator and sandbox are disabled. The client should use the State's setters before proceeding with emulation.

Returns
  • a new IR state

public abstract IDStaticField createStaticField (IDIndex index, IJavaType fieldtype, String csig, String fieldname)

public abstract IDStaticField createStaticField (IDexField f)

public abstract IDStaticField createStaticField (String fsig)

public abstract IDStaticField createStaticField (String fsig, boolean createRefIfDoesNotExist)

public abstract IDImm createString (IDIndex stringIndex)

Wrapper used to create string constants.

public abstract IDImm createString (String value)

Wrapper used to create string constants.

public abstract IDNewArrayInfo createStringArray (String[] values)

public abstract IDSwitchData createSwitchData ()

Create a switch data element used in Switch instructions.

public abstract IDTarget createTarget (int offset)

public abstract Object getData (String key)

Retrieve an arbitrary object in this global context.

public abstract Set<String> getDataKeys ()

Retrieve the set of objects keys for data elements stored using setData.

Returns
  • a read-only collection

public abstract IDexDecompilerUnit getDecompiler ()

Retrieve the managing dex decompiler object.

public abstract IDexUnit getDex ()

Retrieve the underlying dex unit object.

public abstract IDState getEmulator ()

Retrieve the current IR state associated with the current thread. Each thread has its own associated State: the first time this method is called by thread T, a new state object will be created; the subsequent times this method is called by thread T, the previously created state is returned.

This method also performs two important tasks:
- the first time it is called, the State is initialized with settings to allow for practical emulation (large emulation count and timeout, emulation and sandboxing enabled, etc.)
- each time this method is called, settings from the global dexdec emulator configuration file (dexdec-emu.cfg in your plugins folder) is pulled and applied to the State if they have changed

Returns
  • the IR state associated with the running thread

public abstract IJavaOperatorFactory getOperatorFactory ()

Retrieve the global high-level operator factory. The type factory can be used to create all operators, including conditionals, string concatenation, and create cast operators.

public abstract IDState getThreadSharedState ()

Retrieve the current IR state associated with the current thread. Each thread has its own associated State: the first time this method is called by thread T, a new state object will be created; the subsequent times this method is called by thread T, the previously created state is returned.

Returns
  • the IR state associated with the running thread

public abstract IJavaTypeFactory getTypeFactory ()

Retrieve the global high-level type factory.

public abstract IDTypeInfoProvider getTypeInfoProvider ()

Retrieve the type information provider. This provider can access additional, user-provided libraries (jar, dex) to retrieve information on types referenced but not defined in the underlying dex unit.

public abstract void resetDeobfuscatorCounters (String entryName)

Reset deobfuscators counters, generally updated by IR optimizers that rely on IR emulation. Counters are used to track emulation successes and failures for methods. Some optimizers may check the counters to avoid attempting to emulate methods for which too many failures were reported. Calling this method resets such counters, allowing emulation to be re-attempted.

This method resets a specific counter.

Parameters
entryName counter name; generally, a method fully-qualified name, e.g. Lcom/abc/Foo->bar(I)V

public abstract void resetDeobfuscatorCounters ()

Reset deobfuscators counters, generally updated by IR optimizers that rely on IR emulation. Counters are used to track emulation successes and failures for methods. Some optimizers may check the counters to avoid attempting to emulate methods for which too many failures were reported. Calling this method resets such counters, allowing emulation to be re-attempted.

This method resets all counters.

public abstract Object setData (String key, Object value)

Store an arbitrary object in this global context.

Parameters
key non-null key
value null means remove the entry
Returns
  • the previous value associated with the key