Interface IDexDecompilerUnit
- All Superinterfaces:
IAddressableUnit,IDecompilerUnit,IEventSource,IInteractiveUnit,IUnit,IUnitCreator,IUserDataSupport
Specialized interface representing Dex (Dalvik) decompiler Units.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringUnit property name for the emulator configuration path.Fields inherited from interface com.pnfsoftware.jeb.core.units.code.IDecompilerUnit
FLAG_ALLOW_EXTRA_WORK, FLAG_BATCH_DECOMPILATION, FLAG_KEEP_IR, FLAG_NO_CONCURRENT_DECOMPILATION, FLAG_NO_DEFERRED_DECOMPILATION, FLAG_NO_INNER_DECOMPILATION, FLAG_NO_METHOD_AST_GENERATION, FLAG_STANDALONE_IR_CONVERSION, FLAG_TEMP_FORCED_REDECOMPILATIONS, propnameListOfDisabledExternalPlugins -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSpecialComment(String address, String value) Add a special comment to the decompiled output.intApply the currently un-applied code matches.voidForcefully clear the cache of IRs for decompiled methods.voidClear the map of currently un-applied code matches.voidclearSpecialComments(String address) Clear special comments at an address.Create a limited environment to emulate dex code and native code.Create a generic unpacker, backed by anemulated-androidobject, that can be used to attempt to retrieve resources unpacked at runtime.Generate a user-friendly text buffer of the decompilations currently being performed by this unit.Retrieve a previously decompiled AST class object or create an empty AST class element.Retrieve the code matching behavior override.Get the code unit (possibly the parent, possibly null) that is providing the low-level data to this decompiler.intRetrieve the number of cached IRs for decompiled methods.Retrieve a DCR used during AST generation.Retrieve a previously decompiled AST field object or create an empty AST field element.Retrieve the list decompilation events, without duplicates.getGlobalDecompilationEvents(boolean keepDuplicates) Retrieve a copy of the decompilation events.Retrieve the global AST context.getIdentifierName(IJavaIdentifier ident) Retrieve the effective (renamed) name of an identifier in this method's AST.Retrieve the global IR context.Retrieve a previously decompiled AST method object or create an empty AST method element.Retrieve the currently un-applied code matches.voidrecordDecompilationEvent(DexDecompilerEvent<?> event) Record a decompilation event.voidRegister a user-controlled event queue that will receive decompilation events.booleanRemove an AST class object.voidresetDecompilation(String identifier) Remove a decompiled object (i.e., same asIDecompilerUnit.removeDecompilation(String).) For a dex decompiler, reset and removal actions are equivalent.booleanRemove an AST field object.voidReset the global decompilation events list.booleanRemove an AST method object.retrieveCachedIR(String msig) Attempt to retrieve the Intermediate Representation (IR) of a previously decompiled method.Retrieve all cached IRs available at this time.default voidsetCachePolicy(int maxCount, int maxSeconds) Deprecated.setCodeMatchingOverride(Boolean enabled) Override the.CodeMatchSettingunit property.booleansetIdentifierName(IJavaIdentifier ident, String name) Rename an identifier.booleansetIdentifierName(IJavaIdentifier ident, String name, boolean failOnNameConflict, boolean notify) Rename an identifier.booleansetIdentifierName(String msig, String currentName, String newName) Rename an identifier by method signature and current name.voidsetIRCachePolicy(int maxCount, int maxSeconds) Set the policy for the cache of decompiled IRs.voidUnregister a previously registered user-controlled decompilation event queue.Methods inherited from interface com.pnfsoftware.jeb.core.units.IAddressableUnit
getAddressLabel, getAddressLabels, getAddressOfItem, getCanonicalAddress, getItemAtAddress, getItemObject, getRelatedItems, getWellKnownAddresses, isValidAddressMethods inherited from interface com.pnfsoftware.jeb.core.units.code.IDecompilerUnit
canDecompile, canPerformConcurrentDecompilations, decompile, decompileAll, decompileAllClasses, decompileAllMethods, decompileClass, decompileClass, decompileClasses, decompileField, decompileField, decompileMethod, decompileMethod, decompileMethods, decompileToUnit, decompileToUnit, getDecompiledClassText, getDecompiledFieldText, getDecompiledMethodText, getDecompiledText, getDecompiledUnit, getExporter, getOutputType, getThreadPoolSize, removeAllDecompilations, removeDecompilation, removeFreeElements, resetAllDecompilations, runGarbageCollection, setThreadPoolSizeMethods inherited from interface com.pnfsoftware.jeb.util.events.IEventSource
addListener, countListeners, getListeners, getParentSource, insertListener, notifyListeners, removeListener, setParentSourceMethods inherited from interface com.pnfsoftware.jeb.core.units.IInteractiveUnit
addressToLocation, canExecuteAction, executeAction, executeAction, getAddressActions, getCommentManager, getFullComment, getFullComments, getGlobalActions, getInlineComment, getInlineComments, getItemActions, getMetadataManager, locationToAddress, prepareExecution, setInlineCommentMethods inherited from interface com.pnfsoftware.jeb.core.units.IUnit
addChild, addChild, canBePersisted, dispose, execprvfunc, generateQuickState, getChildren, getContributions, getCreationTimestamp, getDescription, getExtraInputs, getFormatter, getFormatType, getIconData, getInput, getInterpreters, getLock, getName, getNotes, getNotificationManager, getParent, getParentArtifact, getParentProject, getPropertyDefinitionManager, getPropertyManager, getRealName, getStatus, getUid, getUnitProcessor, initializePropertyObjects, isDisposed, isProcessed, isStale, isTransientChild, notifyGenericChange, postDeserialization, process, removeChild, setName, setNotes, setParent, setRealName, setUnitProcessorMethods inherited from interface com.pnfsoftware.jeb.core.IUserDataSupport
clearAllData, getAllData, getData, setData
-
Field Details
-
propnameEmulatorConfigPath
Unit property name for the emulator configuration path.- See Also:
-
-
Method Details
-
getCodeUnit
IDexUnit getCodeUnit()Description copied from interface:IDecompilerUnitGet the code unit (possibly the parent, possibly null) that is providing the low-level data to this decompiler.- Specified by:
getCodeUnitin interfaceIDecompilerUnit- Returns:
- a code unit, possibly null
-
getIntermediateContext
IDGlobalContext getIntermediateContext()Retrieve the global IR context.- Returns:
- the global IR context
-
getHighLevelContext
IJavaGlobalContext getHighLevelContext()Retrieve the global AST context.- Returns:
- the global AST context
-
getDynamicContentManager
IDynamicContentManager getDynamicContentManager()Retrieve a DCR used during AST generation.- Returns:
- the dynamic content manager
-
setIdentifierName
Rename an identifier by method signature and current name.- Parameters:
msig- method signaturecurrentName- current identifier namenewName- new identifier name- Returns:
- success indicator
-
setIdentifierName
Rename an identifier.- Parameters:
ident- identifier to renamename- new name- Returns:
- success indicator
-
setIdentifierName
boolean setIdentifierName(IJavaIdentifier ident, String name, boolean failOnNameConflict, boolean notify) Rename an identifier.- Parameters:
ident- identifier to renamename- new namefailOnNameConflict- true to fail if the name conflicts with another identifiernotify- true to notify listeners of the change- Returns:
- success indicator
-
getIdentifierName
Retrieve the effective (renamed) name of an identifier in this method's AST.- Parameters:
ident- identifier- Returns:
- the effective name
-
getClass
Retrieve a previously decompiled AST class object or create an empty AST class element.- Parameters:
csig- class signaturecreateIfNotExist- true to create an empty element if none exists- Returns:
- the Java class, or null if none exists and creation was not requested
-
getField
Retrieve a previously decompiled AST field object or create an empty AST field element.- Parameters:
fsig- field signaturecreateIfNotExist- true to create an empty element if none exists- Returns:
- the Java field, or null if none exists and creation was not requested
-
getMethod
Retrieve a previously decompiled AST method object or create an empty AST method element.- Parameters:
msig- method signaturecreateIfNotExist- true to create an empty element if none exists- Returns:
- the Java method, or null if none exists and creation was not requested
-
resetDecompilation
Remove a decompiled object (i.e., same asIDecompilerUnit.removeDecompilation(String).) For a dex decompiler, reset and removal actions are equivalent.- Specified by:
resetDecompilationin interfaceIDecompilerUnit- Parameters:
identifier- identifier or address
-
resetClassElement
Remove an AST class object.- Parameters:
c- class to reset- Returns:
- success indicator
-
resetFieldElement
Remove an AST field object.- Parameters:
f- field to reset- Returns:
- success indicator
-
resetMethodElement
Remove an AST method object.- Parameters:
m- method to reset- Returns:
- success indicator
-
registerEventQueue
Register a user-controlled event queue that will receive decompilation events.- Parameters:
queue- event queue to register
-
unregisterEventQueue
Unregister a previously registered user-controlled decompilation event queue.- Parameters:
queue- event queue to unregister
-
getGlobalDecompilationEvents
Collection<DexDecompilerEvent<?>> getGlobalDecompilationEvents()Retrieve the list decompilation events, without duplicates. Note that this queue is managed separately thanuser-controlled event queues.- Returns:
- the global decompilation events
-
getGlobalDecompilationEvents
Retrieve a copy of the decompilation events. Note that this queue is managed separately thanuser-controlled event queues.- Parameters:
keepDuplicates- if true, duplicate events will be present in the returned collection- Returns:
- the global decompilation events
-
resetGlobalDecompilationEvents
void resetGlobalDecompilationEvents()Reset the global decompilation events list. This operation is not reversible. -
recordDecompilationEvent
Record a decompilation event.- Parameters:
event- event to record
-
addSpecialComment
Add a special comment to the decompiled output.- Parameters:
address- target addressvalue- comment value
-
clearSpecialComments
Clear special comments at an address.- Parameters:
address- target address
-
createEmulatedAndroid
IEmulatedAndroid createEmulatedAndroid()Create a limited environment to emulate dex code and native code. Currently, the emulated environment is a simple Arm 64-bit (aarch64) Android 13 system (API level 33). This dex decompiler must be the descendant of an APK unit.- Returns:
- an emulated Android environment
-
createGenericUnpacker
IGenericUnpacker createGenericUnpacker()Create a generic unpacker, backed by anemulated-androidobject, that can be used to attempt to retrieve resources unpacked at runtime. This dex decompiler must be the descendant of an APK unit.- Returns:
- an emulated Android environment
-
formatOngoingDecompilations
String formatOngoingDecompilations()Generate a user-friendly text buffer of the decompilations currently being performed by this unit.- Returns:
- formatted ongoing decompilation information
-
setCachePolicy
default void setCachePolicy(int maxCount, int maxSeconds) Deprecated.callsetIRCachePolicy(int, int)instead- Parameters:
maxCount- maximum number of entries in the cachemaxSeconds- timeout in seconds after the last access
-
setIRCachePolicy
void setIRCachePolicy(int maxCount, int maxSeconds) Set the policy for the cache of decompiled IRs.Special calls:
- To store all IRs and disabled cache eviction, call with maxCount=-1 and maxSeconds=-1.
- To disabled IR storage entirely, call with maxCount=0 or maxSeconds=0.- Parameters:
maxCount- maximum number of entries in the cache (-1 means no cap, which is not recommended; 0 can be used to disable caching entirely)maxSeconds- starting from the last access to an entry, this value is a timeout in seconds after which the entry is auto-removed from the cache (-1 means no time-based removal)
-
clearCachedIRs
void clearCachedIRs()Forcefully clear the cache of IRs for decompiled methods. -
getCountOfCachedIRs
int getCountOfCachedIRs()Retrieve the number of cached IRs for decompiled methods.- Returns:
- the number of cached IRs
-
retrieveCachedIR
Attempt to retrieve the Intermediate Representation (IR) of a previously decompiled method.- Parameters:
msig- original method signature (internal format, e.g.Lcom/xyz/Object;->foo(I)V)- Returns:
- an IR object or null if it was not found in the cache
-
retrieveCachedIRs
List<IDMethodContext> retrieveCachedIRs()Retrieve all cached IRs available at this time.- Returns:
- a list of IR method contexts (the list is a copy of the cache and may be modified without affecting the cache)
-
setCodeMatchingOverride
Override the.CodeMatchSettingunit property.Note: this flag does not override
IDecompilerUnit.FLAG_ALLOW_EXTRA_WORK, which must a required condition to allow code matching- Parameters:
enabled- null to disable the override; true to force-enable code matching; false to force-disable code matching- Returns:
- the previous setting for the override
-
getCodeMatchingOverride
Boolean getCodeMatchingOverride()Retrieve the code matching behavior override. Refer tosetCodeMatchingOverride(Boolean)for details.- Returns:
- null if there is no override; else, a boolean value
-
applyCodeMatches
int applyCodeMatches()Apply the currently un-applied code matches. When applying matches, matched methods may be renamed, classes may be renamed and/or moved to existing or newly-created packages. Related types may be renamed as well.Note: if the
.CodeMatchSettingunit property is set to 2 or above, this method is automatically called afterIDecompilerUnit.decompileToUnit(java.lang.String).- Returns:
- a number indicating the number of modifications performed (e.g. renames, moves, etc.)
-
getUnappliedCodeMatches
Map<String,MethodMatch> getUnappliedCodeMatches()Retrieve the currently un-applied code matches.- Returns:
- a map of original internal method signature to its current best code match
-
clearCodeMatches
void clearCodeMatches()Clear the map of currently un-applied code matches.
-
setIRCachePolicy(int, int)instead