com.pnfsoftware.jeb.core.units.code.android.ir.IDGlobalContext |
dexdec
IR global context. This object also provides factory methods to create
non-instruction elements
. (IR instructions can be created using a
method context
).
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, IDIndex index, IJavaType fieldtype, String fieldname) | ||||||||||
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 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.
|
Create an array element.
Create a cast operation.
Create a cast operation.
Convenience operation.
Create immediate constants. The same as createImm(long, IJavaType)
.
Create an immutable pool index value.
value | index value |
---|
Create a pre-initialized master optimizer targeting the provided method. This convenience
method is equivalent to
createMasterOptimizer(ctx, true, true, true)
.
Create a master optimizer targeting the provided method.
Convenience method to create a new SomeObject(..)
operand.
Create an operation element, such an an arithmetic or bitwise expression, conditional, string concatenation, or cast operation.
type | may be left null to let a basic type for the expression be auto-determined |
---|
Create an operation element, such an an arithmetic or bitwise expression, conditional, string concatenation, or cast operation.
Create a predicate expression.
Create a predicate expression.
Create an object reference. The type of the reference will be the
generic wildcard object
type
refid | object reference id |
---|
Create an object reference.
refid | object reference id |
---|---|
reftype | optional object type; if null is provided, the
generic wildcard object type
is used |
Create a reference type expression.
Create a reference type expression.
Create a fresh IR state. The IR state is context-less (no context
is created).
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 |
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.
Create a switch data element used in Switch instructions.
Retrieve an arbitrary object in this global context.
Retrieve the set of objects keys for data elements stored using
setData
.
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
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.
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.
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.
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.
entryName | counter name; generally, a method fully-qualified name, e.g.
Lcom/abc/Foo->bar(I)V
|
---|
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.
Store an arbitrary object in this global context.
key | non-null key |
---|---|
value | null means remove the entry |