Skip to content

Commit

Permalink
feat/aldroid_manual_replace_fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianbuck committed Sep 30, 2024
1 parent d14f530 commit efe8425
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Formula/aldroid.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Aldroid < Formula
version "0.3.11"
version "0.3.12"

desc "This tool transforms Android APKs to make them debuggable and MITMable/Charlesable"
homepage "https://github.com/AppLovin/homebrew-Mobile-Tools"
Expand Down
24 changes: 21 additions & 3 deletions aldroid
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Example Usage: ./aldroid.sh d com.applovin.enterprise.apps.demoapp
#

VERSION=0.3.11
VERSION=0.3.12

usage() {
cat <<EOF
Expand Down Expand Up @@ -397,8 +397,22 @@ make_apk_debuggable() {
# Rebuild it
compile_apk "$DECOMPIILE_DIRECTORY"

# Align and sign it
sign_apk "${DECOMPIILE_DIRECTORY}/dist/${APK_NAME}.apk" "$APK_OUT"
if [[ $USE_FALLBACK_DEBUGGABLE == true ]]; then
echo "Using fallback to manually replace AndroidManifest and neteworkSecurityConfig."
rm -rf "$DECOMPIILE_DIRECTORY/../uz"
rm -rf "$DECOMPIILE_DIRECTORY/../uz0"
unzip -q -d "$DECOMPIILE_DIRECTORY/../uz" "$DECOMPIILE_DIRECTORY/../base.apk"
unzip -q -d "$DECOMPIILE_DIRECTORY/../uz0" "$DECOMPIILE_DIRECTORY/dist/${APK_NAME}.apk"
cp "$DECOMPIILE_DIRECTORY/../uz0/AndroidManifest.xml" "$DECOMPIILE_DIRECTORY/../uz/AndroidManifest.xml"
cp "$DECOMPIILE_DIRECTORY/../uz0/res/xml/network_security_config.xml" "$DECOMPIILE_DIRECTORY/../uz/res/xml/network_security_config.xml"
pushd "$DECOMPIILE_DIRECTORY/../uz"
zip -q -r -n resources.arsc ../test.apk .
popd
sign_apk "${DECOMPIILE_DIRECTORY}/../test.apk" "$APK_OUT"
else
# Align and sign it
sign_apk "${DECOMPIILE_DIRECTORY}/dist/${APK_NAME}.apk" "$APK_OUT"
fi
}

# Installs an APK or multiple APKs to a device with adb install / adb install-multiple
Expand Down Expand Up @@ -751,6 +765,7 @@ ALIGN_OPT_SET=false
OVERRIDE_NSC=false
USE_PM_INSTALL=false
INCREMENTAL='--no-incremental'
USE_FALLBACK_DEBUGGABLE=false

# Parse options for subcommand
while getopts "i-:o:" opt; do
Expand Down Expand Up @@ -814,6 +829,9 @@ while getopts "i-:o:" opt; do
pm-install)
USE_PM_INSTALL=true
;;
fallback)
USE_FALLBACK_DEBUGGABLE=true
;;
*) # Others - print usage
usage
exit 1
Expand Down

0 comments on commit efe8425

Please sign in to comment.