public interface

IGenericUnpacker

com.pnfsoftware.jeb.core.units.code.android.IGenericUnpacker

Class Overview

Interface for a simple Android APK unpacker that will attempt to gather resources extracted at runtime. An unpacker may be created via an apk unit or a dex decompiler unit.

Summary

Public Methods
abstract void attemptUnpack()
Start the unpacking process.
abstract String formatMonitorReport(int formatType)
Retrieve the unpacking report generated by the monitor (if the monitor was enabled before unpacking).
abstract IEmulatedAndroid getEmulatedAndroid()
Create or retrieve the emulator that will perform the unpacking task.
abstract Collection<String> getRecoveredDexHashes()
This method can be used to retrieve the sha256 hashes of the dex files that were collected by the emulator during unpacking.
abstract Collection<String> getRecoveredSoHashes()
This method can be used to retrieve the sha256 hashes of the native library (so) files that were collected by the emulator during unpacking.
abstract void setIntegrateRecoveredDexFiles(boolean integrateRecoveredDexFiles)
Determine whether the unpacked dex files should be integrated into the primary Dex unit, to allow their use during emulation.
abstract void setMaxExecutionTime(long maxExecutionTime)
Convenience method to set the maximum emulation time for unpacking.
abstract void setMonitorEvents(boolean monitorEvents)
Enable or disable the events monitor.
abstract void setUseRecoveredSoFiles(boolean useRecoveredSoFiles)
Determine whether the unpacked native library (so) files should be analyzed and used during emulation.
abstract boolean shouldAttemptUnpack()
This heuristic may be called to determine whether attemptUnpack() has a chance of success.
abstract void teardown()
This method should be called after a call to attemptUnpack(), when the unpacker and its underlying resources are no longer needed.

Public Methods

public abstract void attemptUnpack ()

Start the unpacking process. This method should be called only once. Customization or results retrieval can be done via getEmulatedAndroid() and #getRecoveredDexFileHashes().

public abstract String formatMonitorReport (int formatType)

Retrieve the unpacking report generated by the monitor (if the monitor was enabled before unpacking).

Parameters
formatType 0=standard report; 1=short report; 2=detailed report
Returns
  • the formatted report

public abstract IEmulatedAndroid getEmulatedAndroid ()

Create or retrieve the emulator that will perform the unpacking task. This method may be called before attemptUnpack() to customize the emulator components, or after to retrieve fine-grained emulation results.

public abstract Collection<String> getRecoveredDexHashes ()

This method can be used to retrieve the sha256 hashes of the dex files that were collected by the emulator during unpacking. Note that additional dex units are created as well, as children of the 'unpacked' container unit.

Returns
  • a collection of sha256 hashes of the recovered dex files

public abstract Collection<String> getRecoveredSoHashes ()

This method can be used to retrieve the sha256 hashes of the native library (so) files that were collected by the emulator during unpacking. Note that additional native units are created as well, as children of the 'unpacked' container unit.

Returns
  • a collection of sha256 hashes of the recovered so files

public abstract void setIntegrateRecoveredDexFiles (boolean integrateRecoveredDexFiles)

Determine whether the unpacked dex files should be integrated into the primary Dex unit, to allow their use during emulation.

public abstract void setMaxExecutionTime (long maxExecutionTime)

Convenience method to set the maximum emulation time for unpacking. This method redirects to setMaxDuration(long).

Parameters
maxExecutionTime a time in ms

public abstract void setMonitorEvents (boolean monitorEvents)

Enable or disable the events monitor. If the monitor is enabled, a report may be collected after the unpacking process.

public abstract void setUseRecoveredSoFiles (boolean useRecoveredSoFiles)

Determine whether the unpacked native library (so) files should be analyzed and used during emulation.

public abstract boolean shouldAttemptUnpack ()

This heuristic may be called to determine whether attemptUnpack() has a chance of success. The result of this method should be considered a very loose indicator. If this method is to be used, for better performance, it should be invoked before any other method of this interface.

public abstract void teardown ()

This method should be called after a call to attemptUnpack(), when the unpacker and its underlying resources are no longer needed.