Skip to content

Commit

Permalink
bug/network_security_config_android_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
cemtuver-applovin authored May 27, 2024
1 parent d9434d3 commit d14f530
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 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.10"
version "0.3.11"

desc "This tool transforms Android APKs to make them debuggable and MITMable/Charlesable"
homepage "https://github.com/AppLovin/homebrew-Mobile-Tools"
Expand Down
11 changes: 10 additions & 1 deletion 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.10
VERSION=0.3.11

usage() {
cat <<EOF
Expand Down Expand Up @@ -253,6 +253,15 @@ make_decompiled_debuggable() {
sed -E "s/(<application)/\1 android\:networkSecurityConfig=\"@xml\/$NSC_NAME\" /" "$INPUT_DIRECTORY/AndroidManifest.xml" > "$INPUT_DIRECTORY/AndroidManifest.xml.tmp"
mv "$INPUT_DIRECTORY/AndroidManifest.xml.tmp" "$INPUT_DIRECTORY/AndroidManifest.xml"
else
# Make sure that the networkSecurityConfig has android: prefix
local NSC_PREFIX_GREP=$(grep -E "<application.*android:networkSecurityConfig=\".*?\".*?>" "$INPUT_DIRECTORY/AndroidManifest.xml")

# if the networkSecurityConfig is not prefixed with android: replace it
if [[ -z $NSC_PREFIX_GREP ]]; then
sed -E "s/networkSecurityConfig=/android:networkSecurityConfig=/g" "$INPUT_DIRECTORY/AndroidManifest.xml" > "$INPUT_DIRECTORY/AndroidManifest.xml.tmp"
mv "$INPUT_DIRECTORY/AndroidManifest.xml.tmp" "$INPUT_DIRECTORY/AndroidManifest.xml"
fi

# networkSecurityConfig is defined, find the name via regex
# First get a narrow match since ~= doesn't support lazy matching and grep doesn't support capture groups...
NSC_NARROW_MATCH=$(grep -oE "networkSecurityConfig=\"@xml/.*?\"" <<< "$NSC_GREP")
Expand Down

0 comments on commit d14f530

Please sign in to comment.