Last active
December 1, 2019 20:38
-
-
Save Phate6660/f177afdc1082c0d3f9fc5ccf44bc5b13 to your computer and use it in GitHub Desktop.
Wire and Signal apk downloader, with optional verification.
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/bash | |
## Note: This script requires curl, awk, and optionally sha256sum. | |
## Most distros have these installed by default, but just in case, I decided to leave this comment here. | |
clear && echo -e "Please input the path in which you'd like to download the apk.\nInput \".\" if you want to download to your current path." | |
read -p "> " dir | |
cd "$dir" || echo "Could not enter the directory, are you sure it exists? Using current directory instead." | |
clear && echo -e "What would you like to do?\n\n1. Download Wire.\n2. Download Signal.\n" | |
read -p "> " ans | |
case $ans in | |
1) | |
url="$(curl -sSl https://wire.com/page-data/en/download/page-data.json | awk -F, '{print $17}' | awk -F\" '{print $4}')" | |
file="$(echo "$url" | awk -F/ '{print $6}')" | |
curl "$url" -o "$file" | |
clear && echo "File saved to \"$file\"." | |
echo -e "Would you like to verify the apk? (yes/no)\n(This requires that sha256sum is installed on your machine.)" | |
read -p "> " ans2 | |
case $ans2 in | |
yes) | |
sum="$(curl -sSl https://wire.com/page-data/en/download/page-data.json | awk -F\" '{print $150}' | awk -F\n '{print $10}' | rev | cut -c5- | rev)" | |
apk_sum="$(sha256sum "$file" | awk -F\ '{print $1}')" | |
if [ "$sum" = "$apk_sum" ]; then | |
clear && echo "Checksums match, you're good to go!" | |
else | |
clear && echo -e "Uh oh, checksums don't match...\nsupplied checksum: $sum\napk checksum: $apk_sum" | |
fi | |
;; | |
no) exit 0;; | |
esac | |
;; | |
2) | |
url="$(curl -sSl https://updates.signal.org/android/latest.json | awk -F, '{print $4}' | awk -F\" '{print $4}')" | |
file="$(echo "$url" | awk -F/ '{print $5}')" | |
curl "$url" -o "$file" | |
clear && echo "File saved to \"$file\"." | |
echo -e "Would you like to verify the apk? (yes/no)\n(This requires that sha256sum is installed on your machine.)" | |
read -p "> " ans3 | |
case $ans3 in | |
yes) | |
sum="$(curl -sSl https://updates.signal.org/android/latest.json | awk -F, '{print $3}' | awk -F\" '{print $4}')" | |
apk_sum="$(sha256sum "$file" | awk -F\ '{print $1}')" | |
if [ "$sum" = "$apk_sum" ]; then | |
clear && echo "Checksums match, you're good to go!" | |
else | |
clear && echo -e "Uh oh, checksums don't match...\nsupplied checksum: $sum\napk checksum: $apk_sum" | |
fi | |
;; | |
no) exit 0;; | |
esac | |
;; | |
esac |
God I hate Github so much right now.
WHY CAN'T YOU JUST INDENT PROPERLY!? OR BETTER YET, DON'T EVEN TOUCH THE FILE! JUST LEAVE IT AS IT IS!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's it, I give up. No matter how many times I fix indentation, Github decides to break it every time I save the changes.