sensepost / objection

📱 objection - runtime mobile exploration
GNU General Public License v3.0
7.17k stars 825 forks source link

Added supporting apk patches via docker #636

Closed w1gs closed 7 months ago

w1gs commented 9 months ago

This makes a few changes which allow for users to patch APK files via Docker. Suggested in: #528

Notable Changes

Dockerfile was added

The Docker file first creates a container with all the required dependencies and packages needed to download the tools (aapt, apktool, etc). It then downloads the official android command line tools and downloads all the required tools from the sdkmanager. Since the command line tools and build tools contain a bunch of extra binaries, the Dockerfile creates a new container and only copies in the required binaries to reduce overall container size. Notes: While the user can build the entire thing themselves, it would probably be better to build the final image and upload that to the hub so users can pull it directly. The pypi objection package should be updated to reflect the changes as the docker container will use pip to install the latest version of objection.

Patching APK

Once the container is pulled/built, patching the APK should be straight forward.

docker run --rm -it --platform linux/amd64 -v <local_dir_with_apk>:/app/build objection:latest "objection patchapk -s /app/build/<APK_name>.apk -a <target_arch>"

Example: image

Note: The container could take a while to patch the apk (~5-20 min). One way to check to see if its not stuck somewhere is to use the docker stats command and see if the containers cpu usage is fluctuating.

You should then see the patched apk in the same folder as the original APK. image