mbank-mobile-app-deadname-r.../mbankDeadnameRemover.sh

35 wiersze
1.4 KiB
Bash
Czysty Zwykły widok Historia

2020-07-25 01:27:25 +00:00
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo "usage: $0 <mbank_apk> <your desired name(s)>"
exit 0
fi
apk=$(realpath $1)
mkdir mbank
cd mbank
[[ ! -f "apktool.jar" ]] && wget https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.4.1.jar -O apktool.jar
[[ ! -f "signapk.jar" ]] && wget https://github.com/techexpertize/SignApk/raw/master/signapk.jar -O signapk.jar
java -jar apktool.jar d $apk -o base
strings_file_en=$(grep -Rl "Hello, %s" base/res/*)
strings_file_pl=$(grep -Rl "Witaj, %s" base/res/*)
sed -i "s/Hello, \%s/Hello, $2/" $strings_file_en
sed -i "s/Witaj, \%s/Witaj, $2/" $strings_file_pl
if [[ ! -f "crypto.crt" || ! -f "key.pk8" ]]; then
openssl genrsa -out crypto.key 1024
openssl req -new -key crypto.key -out crypto.csr -subj "/C=PL/ST=Warsaw/L=Warsaw/O=Paweł Tanajno Rigcz Hawajska+ hacker collective"
openssl x509 -req -days 9999 -in crypto.csr -signkey crypto.key -out crypto.crt
cat crypto.key crypto.crt > certificate.pem
openssl pkcs8 -topk8 -outform DER -in certificate.pem -inform PEM -out key.pk8 -nocrypt
rm crypto.key crypto.csr certificate.pem
fi
java -jar apktool.jar b base -o out.apk
java -jar signapk.jar crypto.crt key.pk8 out.apk out_signed.apk
rm -R mbank/base
echo "IMPORTANT NOTE: please store crypto.crt and key.pk8 in a safe place - you'll need them to sign the app after any updates."
echo "OUTPUT FILE: mbank/out_signed.apk"