public interface

IApkUnit

implements IUnit
com.pnfsoftware.jeb.core.units.code.android.IApkUnit

Class Overview

Interface for units representing Android "application packages", aka APK files. Units representing APKs are not obliged to implement this interface.

JEB's internal APK handler plugin produces units which do implement this interface.

Summary

Public Methods
abstract IEmulatedAndroid createEmulatedAndroid()
Convenience method to create a limited environment to emulate this APK.
abstract IGenericUnpacker createGenericUnpacker()
Convenience method to create a generic unpacker, backed by an emulated-android object, that can be used to attempt to retrieve resources unpacked at runtime..
abstract IDexDynamic dynamic()
Dynamic state.
abstract List<String> getActivities()
Get the list of activity classes declared by the applications.
abstract String getApplicationName()
Get the application name.
abstract IUnit getAssets()
Convenience method to retrieve the Assets folder unit (may not exist).
abstract IUnit getAssetsUnit()
This method is deprecated. use getAssets()
abstract IDexUnit getDex()
Convenience method to retrieve the main DEX unit of this APK.
abstract IUnit getLibraries()
Convenience method to retrieve the Libraries folder unit (may not exist).
abstract List<IELFUnit> getLibrariesForArch(AndroidPlatformABI abi)
Convenience method to retrieve the ELF SO (Shared Object) units Libraries for the provided target architecture.
abstract IUnit getLibrariesUnit()
This method is deprecated. use getLibraries()
abstract String getMainActivity()
Get the main activity name.
abstract IXmlUnit getManifest()
Convenience method to retrieve the Android manifest unit of this APK.
abstract String getPackageName()
Get the package name exposed in the Android Manifest file.
abstract List<String> getPermissions()
Get the list of permissions requested by the application.
abstract List<String> getProviders()
Get the list of provider classes declared by the applications.
abstract List<String> getReceivers()
Get the list of receiver classes declared by the applications.
abstract IUnit getResourceUnit()
This method is deprecated. use getResources()
abstract IUnit getResources()
Convenience method to retrieve the Resources folder unit (may not exist).
abstract List<String> getServices()
Get the list of service classes declared by the applications.
abstract APKSigSchemeV2Block getSignatureSchemeV2Block()
Retrieve the APK signature scheme version 2 block.
abstract APKSigSchemeV3Block getSignatureSchemeV3Block()
Retrieve the APK signature scheme version 2 block.
abstract int getSignatureSchemeVersionFlags()
Retrieve a flag indicating which signing schemes are used in this APK.
abstract boolean hasApplication()
Determine whether or not the APK contains an application (Application tag in the Android manifest); if there is no app, other application-related methods (getApplicationName(), isDebuggable(), getActivities(), getMainActivity(), getServices(), getProviders(), getReceivers()) should not be used.
abstract boolean isDebuggable()
Determine if the app can be debugged, per the Android Manifest entry isDebuggable.
abstract boolean isMultiDex()
Determine if the bytecode of this APK is split over two or more DEX files.
[Expand]
Inherited Methods
From interface com.pnfsoftware.jeb.core.IUnitCreator
From interface com.pnfsoftware.jeb.core.IUserDataSupport
From interface com.pnfsoftware.jeb.core.units.IUnit
From interface com.pnfsoftware.jeb.util.events.IEventSource

Public Methods

public abstract IEmulatedAndroid createEmulatedAndroid ()

Convenience method to create a limited environment to emulate this APK. Currently, the emulated environment is a simple Arm 64-bit (aarch64) Android 13 system (API level 33).

Returns
  • an emulated Android environment

public abstract IGenericUnpacker createGenericUnpacker ()

Convenience method to create a generic unpacker, backed by an emulated-android object, that can be used to attempt to retrieve resources unpacked at runtime..

Returns
  • an emulated Android environment

public abstract IDexDynamic dynamic ()

Dynamic state.

Returns
  • Dynamic state

public abstract List<String> getActivities ()

Get the list of activity classes declared by the applications. This is a convenience method; users can retrieve the Manifest unit to examine the entire manifest file.

Returns
  • a list of fully-qualified class names

public abstract String getApplicationName ()

Get the application name.

Returns
  • the application name, null if the APK does not contain an application

public abstract IUnit getAssets ()

Convenience method to retrieve the Assets folder unit (may not exist).

public abstract IUnit getAssetsUnit ()

This method is deprecated.
use getAssets()

public abstract IDexUnit getDex ()

Convenience method to retrieve the main DEX unit of this APK. The primary DEX unit may represent the merger of several DEX files, in the case of multi-DEX applications.

Use UnitUtil to retrieve other/more sub-units.

Returns
  • a DEX unit representing the bytecode of the app, null on error

public abstract IUnit getLibraries ()

Convenience method to retrieve the Libraries folder unit (may not exist).

Returns
  • a container that contains platform-dependent libraries.

public abstract List<IELFUnit> getLibrariesForArch (AndroidPlatformABI abi)

Convenience method to retrieve the ELF SO (Shared Object) units Libraries for the provided target architecture.

Returns
  • a list of ELF units, possibly empty

public abstract IUnit getLibrariesUnit ()

This method is deprecated.
use getLibraries()

public abstract String getMainActivity ()

Get the main activity name. This is a convenience method; users can retrieve the Manifest unit to examine the entire manifest file.

Returns
  • the main activity name, null on error or if none was found

public abstract IXmlUnit getManifest ()

Convenience method to retrieve the Android manifest unit of this APK.

Use UnitUtil to retrieve other/more sub-units.

Returns
  • an XML unit representing the manifest, null on error

public abstract String getPackageName ()

Get the package name exposed in the Android Manifest file. This is a convenience method; users can retrieve the Manifest unit to examine the entire manifest file.

Returns
  • the application package name

public abstract List<String> getPermissions ()

Get the list of permissions requested by the application. This is a convenience method; users can retrieve the Manifest unit to examine the entire manifest file.

Returns
  • the list of permissions declared to be used in the Android manifest

public abstract List<String> getProviders ()

Get the list of provider classes declared by the applications. This is a convenience method; users can retrieve the Manifest unit to examine the entire manifest file.

Returns
  • a list of fully-qualified class names

public abstract List<String> getReceivers ()

Get the list of receiver classes declared by the applications. This is a convenience method; users can retrieve the Manifest unit to examine the entire manifest file.

Returns
  • a list of fully-qualified class names

public abstract IUnit getResourceUnit ()

This method is deprecated.
use getResources()

public abstract IUnit getResources ()

Convenience method to retrieve the Resources folder unit (may not exist).

public abstract List<String> getServices ()

Get the list of service classes declared by the applications. This is a convenience method; users can retrieve the Manifest unit to examine the entire manifest file.

Returns
  • a list of fully-qualified class names

public abstract APKSigSchemeV2Block getSignatureSchemeV2Block ()

Retrieve the APK signature scheme version 2 block. The specifications of this block are detailed here: https://source.android.com/security/apksigning/v2

Returns
  • a signature block, null if there is none (eg, if the APK is not signed using the v2 scheme)

public abstract APKSigSchemeV3Block getSignatureSchemeV3Block ()

Retrieve the APK signature scheme version 2 block. The specifications of this block are detailed here: https://source.android.com/security/apksigning/v3

Returns
  • a signature block, null if there is none (eg, if the APK is not signed using the v3 scheme)

public abstract int getSignatureSchemeVersionFlags ()

Retrieve a flag indicating which signing schemes are used in this APK.

Returns
  • a combination of flags: bit #0 is on if v1 is used; bit #1 is on if v2 is used; bit #2 is on if v3 is used

public abstract boolean hasApplication ()

Determine whether or not the APK contains an application (Application tag in the Android manifest); if there is no app, other application-related methods (getApplicationName(), isDebuggable(), getActivities(), getMainActivity(), getServices(), getProviders(), getReceivers()) should not be used.

public abstract boolean isDebuggable ()

Determine if the app can be debugged, per the Android Manifest entry isDebuggable. This is a convenience method; users can retrieve the Manifest unit to examine the entire manifest file.

Returns
  • true if the application is legally debuggable, false otherwise

public abstract boolean isMultiDex ()

Determine if the bytecode of this APK is split over two or more DEX files.

Returns
  • true for multi-DEX apps, false otherwise