Interface IApkUnit

All Superinterfaces:
IEventSource, IUnit, IUnitCreator, IUserDataSupport

public interface IApkUnit extends IUnit
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.

  • Method Details

    • getPackageName

      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
    • getPermissions

      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
    • hasApplication

      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.
      Returns:
    • getApplicationName

      String getApplicationName()
      Get the application name.
      Returns:
      the application name, null if the APK does not contain an application
    • isDebuggable

      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
    • getActivities

      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
    • getMainActivity

      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
    • getServices

      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
    • getReceivers

      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
    • getProviders

      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
    • isMultiDex

      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
    • getDex

      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
    • getManifest

      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
    • getLibraries

      IUnit getLibraries()
      Convenience method to retrieve the Libraries folder unit (may not exist).
      Returns:
      a container that contains platform-dependent libraries.
    • getLibrariesForArch

      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
    • getAssets

      IUnit getAssets()
      Convenience method to retrieve the Assets folder unit (may not exist).
      Returns:
    • getResources

      IUnit getResources()
      Convenience method to retrieve the Resources folder unit (may not exist).
      Returns:
    • getSignatureSchemeVersionFlags

      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
    • getSignatureSchemeV2Block

      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)
    • getSignatureSchemeV3Block

      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)
    • dynamic

      IDexDynamic dynamic()
      Dynamic state.
      Returns:
      Dynamic state
    • createEmulatedAndroid

      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
    • createGenericUnpacker

      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