#!/bin/sh set -e java -jar /apktool.jar d /data/app.apk sed 's/android:extractNativeLibs="false"/android:extractNativeLibs="true"/' -i app/AndroidManifest.xml if ! grep -q android.permission.INTERNET app/AndroidManifest.xml; then sed 's/<\/manifest>/<\/manifest>/' -i app/AndroidManifest.xml fi /patch-main.py mkdir -p app/lib/arm64-v8a cp /libfrida-gadget.so /libfrida-gadget.config.so app/lib/arm64-v8a sed "s/FRIDA_TOKEN/${FRIDA_TOKEN:-secret}/" -i app/lib/arm64-v8a/libfrida-gadget.config.so java -jar /apktool.jar b -o patched.apk app java -jar /apk-signer.jar --overwrite -a patched.apk cp patched.apk /data