Skip to main content

Inject network security config xml into an Android APK

Project description

ANS INJECT

Image by Darwin Laganzon from Pixabay

Android Network Security Config Injector

PyPI - Python Version PyPI - Implementation GitHub top language PyPI - License PyPI PyPI - Format PyPI - Status

This tool is simply an easier way to use some collection of other tools which can inject a network security config into an Android APK. Mainly it's sole pupose is making it easier to use the tools in the requirements list below with one line of command.

This is useful when you want to test an app that uses HTTPS but you don't have a valid certificate. This tool will allow you to bypass the certificate check.

Disclaimer

This tool is provided as is. I am not responsible for any damage caused by this tool. Use it at your own risk.

Requirements

Installation

pip install ansinject

Usage

ansinject --help
ansinject inject [input_apk] [output_apk] --temp-dir [temp_dir]

Basicly the script will do the following:

  1. Extract the APK
  2. Copy the following network security config onto /res/xml/network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
            <certificates src="user" />
        </trust-anchors>
    </base-config>
</network-security-config>
  1. Rebuild the APK
  2. Generate a keystore in order to sign the APK
  3. Sign the APK
  4. Align the output

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansinject-0.2.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

ansinject-0.2.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file ansinject-0.2.0.tar.gz.

File metadata

  • Download URL: ansinject-0.2.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for ansinject-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5780d68d8eced6746395de06f8b8ccf0bea7fc874b84b44b68f3c6b30470f2cd
MD5 4e972f527afa5ee492997039e6ac893c
BLAKE2b-256 561f0102c08ce941efce347f90a50cae5faba140fa8333d6a291a7e6a954030e

See more details on using hashes here.

File details

Details for the file ansinject-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ansinject-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for ansinject-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90a963654bccc1b93166e74055552ae795fe9e759a1d635c953d8e9ad3f71c44
MD5 5822ab1d753827f198ebf69617747643
BLAKE2b-256 988b496b5be04e108fc5b1dcf6494f260d0f59fa8955cda5ac77147ae310ec97

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page