Created
February 21, 2024 09:55
-
-
Save klezVirus/8113d6c7064871713ea954c1406fb2d5 to your computer and use it in GitHub Desktop.
Quick and Simple Script to De-Flutter an iOS/Android Mobile Application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Default values | |
input_apk="" | |
signer_path="" | |
# Function to display help message | |
print_help() { | |
echo "Usage: $0 -i <input_apk> [-s <signer_path>]" | |
echo "" | |
echo "Options:" | |
echo " -i Path to the input APK file" | |
echo " -s Path to the uber-apksigner jar file (optional)" | |
echo "" | |
echo "Example:" | |
echo "$0 -i path/to/app.apk" | |
echo "$0 -i path/to/app.apk -s path/to/uber-apksigner.jar" | |
} | |
# Parsing command line flags | |
while getopts "i:s:h" flag; do | |
case "${flag}" in | |
i) input_apk="${OPTARG}" ;; | |
s) signer_path="${OPTARG}" ;; | |
h) print_help; exit 0 ;; | |
*) print_help; exit 1 ;; | |
esac | |
done | |
# Check if the input APK file is provided and valid | |
if [ ! -f "$input_apk" ]; then | |
echo "Error: Input APK file is required and must be a valid file." | |
print_help | |
exit 1 | |
fi | |
sudo apt-get update | |
pip3 install reflutter | |
reflutter "$input_apk" | |
java -jar "$signer_path" --apk "release.RE.apk" | |
exit 1 | |
if [ -n "$signer_path" ] && [ -f "$signer_path" ]; then | |
# Use uber-apksigner | |
java -jar "$signer_path" --apk "release.RE.apk" | |
else | |
# Use zipalign, keytool, and apksigner | |
zipalign -p -v 4 release.RE.apk release.ALIGN.apk | |
# the following command generates the keystore and it will ask a password for the same, please remember/store it somewhere | |
keytool -genkey -v -keystore my.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias app -storepass 'Passw0rd!' | |
# It will ask for the keystore password that you gave in the earlier command | |
apksigner sign --ks-key-alias app --ks my.keystore --ks-pass pass:'Passw0rd!' --out release.SIGN.apk release.ALIGN.apk | |
apksigner verify --print-certs --verbose release.SIGN.apk | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment