explaingit

ax/apk.sh

3,781ShellAudience · developerComplexity · 3/5Setup · hard

TLDR

A Bash script that automates pulling, decoding, patching, and rebuilding Android APK files, including injecting a Frida monitoring gadget for dynamic analysis without needing a rooted device.

Mindmap

mindmap
  root((apk.sh))
    What it does
      Automate APK tasks
      No root required
      Frida injection
    Commands
      pull from device
      decode to files
      build and sign
      patch for Frida
    Underlying tools
      apktool
      Frida gadget
      apksigner
    Supports
      Split APKs
      arm and arm64
      x86 and x86_64
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Pull an APK from a connected Android device and decode it into readable files to inspect what the app does.

USE CASE 2

Patch an APK to load the Frida gadget so you can trace its network calls and function behaviour without rooting the phone.

USE CASE 3

Rebuild a modified APK, sign it, and reinstall it on a device for security testing or reverse engineering research.

USE CASE 4

Rename the package name of an APK to install two versions of the same app side-by-side on a device.

Tech stack

BashShellapktoolFridaAndroid

Getting it running

Difficulty · hard Time to first run · 1h+

Requires apktool, Frida, apksigner, and standard Android SDK tools installed on your machine before the script will work.

Open-source, check the repository for the exact license terms.

In plain English

apk.sh is a Bash script that automates common tasks involved in inspecting and modifying Android app files. Android apps are distributed as APK files, which are compressed archives containing compiled code, resources, and metadata. To understand what an app does at a technical level, security researchers and developers often need to pull the APK off a device, decode it into a readable form, modify it, and reinstall it. apk.sh chains these steps together so you do not have to run each tool separately. The script wraps two main underlying tools. It uses apktool to disassemble an APK into human-readable files and to reassemble modified files back into a working APK. It uses Frida, a dynamic analysis toolkit, to inject a monitoring library called frida-gadget.so into the app so the app can be inspected or scripted as it runs. The Frida gadget approach means you do not need a rooted Android device to instrument the app, which makes the workflow accessible on ordinary hardware. The four primary subcommands are pull, decode, build, and patch. Pull downloads an APK from a connected device or emulator by package name. Decode turns an APK into a folder of readable files. Build turns a modified folder back into a signed APK ready to install. Patch modifies an APK to load the Frida gadget when the app starts, which is what allows dynamic analysis. A separate rename subcommand changes the package name of an APK. The tool supports app bundles and split APKs, which are apps distributed as multiple separate APK files. When pulling or patching a split APK, apk.sh combines the pieces into a single unified APK. Architecture support covers arm, arm64, x86, and x86_64 devices. The signing step uses apksigner, and the script requires a handful of standard Android development tools to be installed on your machine.

Copy-paste prompts

Prompt 1
Show me how to use apk.sh to pull an APK by package name from my connected Android device and decode it into readable smali files.
Prompt 2
Walk me through patching an APK with apk.sh to inject the Frida gadget so I can trace API calls as the app runs on a non-rooted phone.
Prompt 3
How do I use apk.sh to rebuild and sign a modified APK after changing a resource file, then reinstall it on my device?
Prompt 4
What tools do I need to install on my Mac or Linux machine before apk.sh will work, and how do I set them up?
Prompt 5
How does apk.sh handle split APKs, what happens when I try to pull or patch an app that is distributed as multiple APK files?
Open on GitHub → Explain another repo

← ax on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.