Skip to main content

apkInspector PyPI - Version CI codecov

apkInspector

apkInspector is a tool designed to provide detailed insights into the zip structure of APK files, offering the capability to extract content and decode the AndroidManifest.xml file. What sets APKInspector apart is its adherence to the zip specification during APK parsing, eliminating the need for reliance on external libraries. This independence, allows APKInspector to be highly adaptable, effectively emulating Android's installation process for APKs that cannot be parsed using standard libraries. The main goal is to enable users to conduct static analysis on APKs that employ evasion techniques, especially when conventional methods prove ineffective.

Please check this blog post for more details.

How to install

apkInspector is available through PyPI

pip install apkInspector

or you can clone this repository and build and install locally:

git clone https://github.com/erev0s/apkInspector.git
cd apkInspector
poetry build
pip install dist/apkInspector-Version_here.tar.gz

Documentation

Documentation created based on the docstrings, is available through Sphinx:
https://erev0s.github.io/apkInspector/

CLI

apkInspector offers a command line tool with the same name, with the following options;

$ apkInspector -h
usage: apkInspector [-h] [-apk APK] [-f FILENAME] [-ll] [-lc] [-la] [-e] [-x] [-xa] [-m] [-sm SPECIFY_MANIFEST] [-a] [-v]

apkInspector is a tool designed to provide detailed insights into the zip structure of APK files, offering the capability to extract content and decode the AndroidManifest.xml file.

options:
  -h, --help            show this help message and exit
  -apk APK              A single APK to inspect or a directory where multiple APKs may reside.
  -f FILENAME, --filename FILENAME
                        Filename to provide info for
  -ll, --list-local     List all files by name from local headers
  -lc, --list-central   List all files by name from central directory header
  -la, --list-all       List all files from both central directory and local headers
  -e, --export          Export to JSON. What you list from the other flags, will be exported
  -x, --extract         Attempt to extract the file specified by the -f flag
  -xa, --extract-all    Attempt to extract all files detected in the central directory header
  -m, --manifest        Extract and decode the AndroidManifest.xml
  -sm SPECIFY_MANIFEST, --specify-manifest SPECIFY_MANIFEST
                        Pass an encoded AndroidManifest.xml file to be decoded
  -a, --analyze         Check an APK for static analysis evasion techniques
  -v, --version         Retrieves version information

Library

The library component of apkInspector is designed with extensibility in mind, allowing other tools to seamlessly integrate its functionality. This flexibility empowers developers to leverage the capabilities of apkInspector within their own applications and workflows. To facilitate clear comprehension and ease of use, comprehensive docstrings accompany all primary methods, providing valuable insights into their functionality, expected arguments, and return values. These detailed explanations serve as invaluable guides, ensuring that developers can quickly grasp the inner workings of apkInspector's core features and smoothly incorporate them into their projects.

Features offered

  • Find end of central directory record
  • Parse central directory of APK and get details about each entry
  • Get details local header for each entry
  • Extract single or all files within an APK
  • Decode AndroidManifest.xml file
  • Identify Tampering Indicators:
    • End of Central Directory record defined multiple times
    • Unknown compression methods
    • Compressed entry with empty filename
    • Filenames/Path collisions
    • Unexpected starting signature of AndroidManifest.xml
    • Tampered StringCount value
    • Strings surpassing maximum length
    • Invalid data between elements
    • Unexpected attribute start
    • Unexpected attribute size
    • Unexpected attribute names or values
    • Zero size header for namespace end nodes

The command-line interface (CLI) serves as a practical illustration of how the methods provided by the library have been employed.

Reliability

Please take a look at the results from testing apkInspector against a set of top Play Store applications

Planned to-do

  • Improve documentation (add examples)
  • Improve code coverage

Contributions

We welcome contributions from the open-source community to help improve and enhance apkInspector. Whether you're a developer, tester, or documentation enthusiast, your contributions are valuable.

:rocket: apkInspector is being used by :rocket: :

Presentation of the tool and the research behind it

  • Defcon 32 | PDF

Disclaimer

It should be kept in mind that apkInspector is an evolving project, a work in progress. As such, users should anticipate occasional bugs and anticipate updates and upgrades as the tool continues to mature and enhance its functionality. Your feedback and contributions to apkInspector are highly appreciated as we work together to improve and refine its capabilities.

Release files for apkInspector 1.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apkInspector 1.3.7
File Size Uploaded
apkinspector-1.3.7.tar.gz 28.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for apkInspector 1.3.7
File Interpreter ABI Platform
apkinspector-1.3.7-py3-none-any.whl Python 3 none any Details

Total release size: 60.0 kB

Release files / apkinspector-1.3.7.tar.gz

Download URL apkinspector-1.3.7.tar.gz
Size 28.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ea5a62f9c6a3127a6191901fa0cc32e23b05caf2034d7062193bd4c0539c7888
BLAKE2b-256 checksum
How to use checksums
d48ddd382dd4fd58799634d66d8f6eafe2c951a35971aacad6f6f3df6f111383
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.13

Release files / apkinspector-1.3.7-py3-none-any.whl

Download URL apkinspector-1.3.7-py3-none-any.whl
Size 31.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa3242baa7ba8e0eecd20a2fcf427fcfd34f4043902542d12110c7297649c590
BLAKE2b-256 checksum
How to use checksums
257fe958755a08d9331428990464ee86980d43c24b330c4ab59c2fadb125e892
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.13

Release history Release notifications | RSS feed

This release

1.3.7 This release

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page