apkinjector


Nameapkinjector JSON
Version 1.1.5 PyPI version JSON
download
home_pagehttps://nitanmarcel.github.io/apkinjector
SummaryUtilities to help injecting libraries and frida in apks.
upload_time2023-08-23 13:45:13
maintainer
docs_urlNone
authorMarcel Alexandru Nitan
requires_python
license
keywords frida apk injection inject
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # APK Injector

Pluginable tool to automate injection of libraries in apks, with support for unpack, repack, and bundles.

- [APK Injector](#apk-injector)
    - [Features](#features)
    - [Installation](#installation)
    - [Usage](#usage)
      - [Frida](#frida)
      - [Inject](#inject)
      - [Apk utils](#apk-utils)
      - [Plugins](#plugins)
    - [Using as a module](#using-as-a-module)
    - [Usage as a plugin](#usage-as-a-plugin)

### Features
- Insert libraries and load them when an activity starts.
- Frida support with support to load frida scripts either from disc or codeshare.
- Bundle support. Apks exported from SAI or XApks downloaded from apkpure.
- Plugins support. Check plugins/plugins.json and plugin_example.py

### Installation
`pip3 install apkinjector`

### Usage
```
apkinjector [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  apk      Apk utils
  frida    Inject a frida gadget in a target apk.
  inject   Inject a shared library (*.so) in a target apk.
  plugins  Manage plugins
```


#### Frida
```
Usage: python -m apkinjector frida [OPTIONS] APK

  Inject a frida gadget in a target apk.

Options:
  --gadget TEXT     Path to custom gadget.
  --script TEXT     Inject a javascript to be loaded when the gadget starts.
  --codeshare TEXT  Same as --script but uses Frida Codeshare as the source
                    javascript.
  --arch TEXT       Architecture to inject for. If empty --adb or --gadget
                    must be specified.
  --adb             Use adb (if installed) to detect device architecture.
  --activity TEXT   Name of the activity to inject into. If unspecified, the
                    main activity will be injected.
  --output          Custom path where the patched apk should be saved.
  --force           Force delete destination directory.
  --help            Show this message and exit.
```

#### Inject
```
Usage: python -m apkinjector inject [OPTIONS] APK

  Inject a shared library (*.so) in a target apk.

Options:
  --library TEXT   Shared library (*.so) to inject.  [required]
  --include TEXT   Extra files to include in the lib folder. Can be used
                   multiple times to include more files.
  --arch TEXT      Architecture to inject for. If empty --adb or --library
                   must be specified.
  --adb            Use adb (if installed) to detect device architecture.
  --activity TEXT  Name of the activity to inject into. If unspecified, the
                   main activity will be injected.
  --output         Custom path where the patched apk should be saved.
  --force          Force delete destination directory.
  --help           Show this message and exit.
```

#### Apk utils
```
Usage: python -m apkinjector apk [OPTIONS] APK

  Apk utils

Options:
  --activities   Gets all activities
  --permissions  Gets all permissions
  --libraries    Gets all libraries
  --recievers    Gets all receivers
  --help         Show this message and exit.
```

#### Plugins
```
Usage: python -m apkinjector plugins [OPTIONS]

  Manage plugins

Options:
  --list          List all installed and available plugins.
  --install TEXT  Installs a plugin by name.
  --remove TEXT   Removes an installed plugin.
  --help          Show this message and exit.
```


### Using as a module

```python
from apkinjector import LOG


LOG.info("This has been printed using apkinjector logging")


# Also comes with runners for apktool, uber-apk-signer, etc/

from apkinjector.apktool import ApkTool

from apkinjector.uber_apk_signer import UberApkSigner

# Automatically download and setup apktool.
ApkTool.install()

# Decompile apk
ApkTool.decode(...)

# Automatically download and setup uber-apk-signer
UberApkSigner.install()

# Sign apk
UberApkSigner.sign(...)


# Check if a dependency is in path

from apkinjector import DEPENDENCIES_MANAGER

# Add a new dependency
java = DEPENDENCIES_MANAGER.add_dependency('java', required=True) # Return Depedency(name, path, required)

# Check if a dependency is path
# Returns the path to the binary if found, if not returns None
# See apkpatcher/apkpatcher to see how dependencies are automatically handled
in_path = DEPENDENCIES_MANAGER.java
```

### Usage as a plugin

```python

# Can use the same methods as a it would been included in a separate module.

from apkinjector import LOG

# Adding a new command to the `apkinjector` application:

from apkinjector.plugins import main

# Define a new command. It uses click under the hood. See more at https://click.palletsprojects.com/en/8.1.x/
# Check plugins/plugin_example.py for a full example.
@main.command(help='Prints hello world to the console.')
def hello_world():
    LOG.info('Hello World')  # prints info
    LOG.warning("Hello World")  # prints warning
    LOG.error('Hello World')  # prints error and calls sys.exit(1)

# This will be usable with `apkinjector hello_world`
# 
# apkinjector hello-world --help
# Usage: python -m apkinjector hello-world [OPTIONS]

#   Prints hello world to the console.

# Options:
#   --help  Show this message and exit. 
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://nitanmarcel.github.io/apkinjector",
    "name": "apkinjector",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "FRIDA,APK,INJECTION,INJECT",
    "author": "Marcel Alexandru Nitan",
    "author_email": "nitan.marcel@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d4/f7/137da45531c9587cb1bfffb72debbdb7f15cd3e2ed5c7fd7342f809f901c/apkinjector-1.1.5.tar.gz",
    "platform": null,
    "description": "# APK Injector\n\nPluginable tool to automate injection of libraries in apks, with support for unpack, repack, and bundles.\n\n- [APK Injector](#apk-injector)\n    - [Features](#features)\n    - [Installation](#installation)\n    - [Usage](#usage)\n      - [Frida](#frida)\n      - [Inject](#inject)\n      - [Apk utils](#apk-utils)\n      - [Plugins](#plugins)\n    - [Using as a module](#using-as-a-module)\n    - [Usage as a plugin](#usage-as-a-plugin)\n\n### Features\n- Insert libraries and load them when an activity starts.\n- Frida support with support to load frida scripts either from disc or codeshare.\n- Bundle support. Apks exported from SAI or XApks downloaded from apkpure.\n- Plugins support. Check plugins/plugins.json and plugin_example.py\n\n### Installation\n`pip3 install apkinjector`\n\n### Usage\n```\napkinjector [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  apk      Apk utils\n  frida    Inject a frida gadget in a target apk.\n  inject   Inject a shared library (*.so) in a target apk.\n  plugins  Manage plugins\n```\n\n\n#### Frida\n```\nUsage: python -m apkinjector frida [OPTIONS] APK\n\n  Inject a frida gadget in a target apk.\n\nOptions:\n  --gadget TEXT     Path to custom gadget.\n  --script TEXT     Inject a javascript to be loaded when the gadget starts.\n  --codeshare TEXT  Same as --script but uses Frida Codeshare as the source\n                    javascript.\n  --arch TEXT       Architecture to inject for. If empty --adb or --gadget\n                    must be specified.\n  --adb             Use adb (if installed) to detect device architecture.\n  --activity TEXT   Name of the activity to inject into. If unspecified, the\n                    main activity will be injected.\n  --output          Custom path where the patched apk should be saved.\n  --force           Force delete destination directory.\n  --help            Show this message and exit.\n```\n\n#### Inject\n```\nUsage: python -m apkinjector inject [OPTIONS] APK\n\n  Inject a shared library (*.so) in a target apk.\n\nOptions:\n  --library TEXT   Shared library (*.so) to inject.  [required]\n  --include TEXT   Extra files to include in the lib folder. Can be used\n                   multiple times to include more files.\n  --arch TEXT      Architecture to inject for. If empty --adb or --library\n                   must be specified.\n  --adb            Use adb (if installed) to detect device architecture.\n  --activity TEXT  Name of the activity to inject into. If unspecified, the\n                   main activity will be injected.\n  --output         Custom path where the patched apk should be saved.\n  --force          Force delete destination directory.\n  --help           Show this message and exit.\n```\n\n#### Apk utils\n```\nUsage: python -m apkinjector apk [OPTIONS] APK\n\n  Apk utils\n\nOptions:\n  --activities   Gets all activities\n  --permissions  Gets all permissions\n  --libraries    Gets all libraries\n  --recievers    Gets all receivers\n  --help         Show this message and exit.\n```\n\n#### Plugins\n```\nUsage: python -m apkinjector plugins [OPTIONS]\n\n  Manage plugins\n\nOptions:\n  --list          List all installed and available plugins.\n  --install TEXT  Installs a plugin by name.\n  --remove TEXT   Removes an installed plugin.\n  --help          Show this message and exit.\n```\n\n\n### Using as a module\n\n```python\nfrom apkinjector import LOG\n\n\nLOG.info(\"This has been printed using apkinjector logging\")\n\n\n# Also comes with runners for apktool, uber-apk-signer, etc/\n\nfrom apkinjector.apktool import ApkTool\n\nfrom apkinjector.uber_apk_signer import UberApkSigner\n\n# Automatically download and setup apktool.\nApkTool.install()\n\n# Decompile apk\nApkTool.decode(...)\n\n# Automatically download and setup uber-apk-signer\nUberApkSigner.install()\n\n# Sign apk\nUberApkSigner.sign(...)\n\n\n# Check if a dependency is in path\n\nfrom apkinjector import DEPENDENCIES_MANAGER\n\n# Add a new dependency\njava = DEPENDENCIES_MANAGER.add_dependency('java', required=True) # Return Depedency(name, path, required)\n\n# Check if a dependency is path\n# Returns the path to the binary if found, if not returns None\n# See apkpatcher/apkpatcher to see how dependencies are automatically handled\nin_path = DEPENDENCIES_MANAGER.java\n```\n\n### Usage as a plugin\n\n```python\n\n# Can use the same methods as a it would been included in a separate module.\n\nfrom apkinjector import LOG\n\n# Adding a new command to the `apkinjector` application:\n\nfrom apkinjector.plugins import main\n\n# Define a new command. It uses click under the hood. See more at https://click.palletsprojects.com/en/8.1.x/\n# Check plugins/plugin_example.py for a full example.\n@main.command(help='Prints hello world to the console.')\ndef hello_world():\n    LOG.info('Hello World')  # prints info\n    LOG.warning(\"Hello World\")  # prints warning\n    LOG.error('Hello World')  # prints error and calls sys.exit(1)\n\n# This will be usable with `apkinjector hello_world`\n# \n# apkinjector hello-world --help\n# Usage: python -m apkinjector hello-world [OPTIONS]\n\n#   Prints hello world to the console.\n\n# Options:\n#   --help  Show this message and exit. \n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Utilities to help injecting libraries and frida in apks.",
    "version": "1.1.5",
    "project_urls": {
        "Homepage": "https://nitanmarcel.github.io/apkinjector"
    },
    "split_keywords": [
        "frida",
        "apk",
        "injection",
        "inject"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d4f7137da45531c9587cb1bfffb72debbdb7f15cd3e2ed5c7fd7342f809f901c",
                "md5": "951c5b0eff95e66e1bd8d4466d667e99",
                "sha256": "ddeefc759b6785320717e5b3d2e6d1205f1d9729c34f18dd4855053888486e58"
            },
            "downloads": -1,
            "filename": "apkinjector-1.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "951c5b0eff95e66e1bd8d4466d667e99",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 31115,
            "upload_time": "2023-08-23T13:45:13",
            "upload_time_iso_8601": "2023-08-23T13:45:13.436476Z",
            "url": "https://files.pythonhosted.org/packages/d4/f7/137da45531c9587cb1bfffb72debbdb7f15cd3e2ed5c7fd7342f809f901c/apkinjector-1.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-23 13:45:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "apkinjector"
}
        
Elapsed time: 0.12399s