Skip to content

Commit

Permalink
Merge pull request #11 from soar/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
whiteinge authored Dec 29, 2022
2 parents 8e7d5f3 + de56eba commit d3d2999
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ are not experienced with the command line and debugging on your own.
* [Apktool](https://ibotpeaches.github.io/Apktool/)
* ADB
* Python 3
* Android SDK

Android SDK is required, if you are going to use Android 12+.
If you have an older Android version, and you want to skip installing SDK,
you can use a legacy mode with `--legacy-sign` command line switch (e.g. `./get_code.sh --legacy-sign`)

### Supported Environments
* Linux
* Windows + Git Bash ([#3](https://github.com/steamguard-totp/steamguard-shared-secret/issues/3))
* Mac (`brew install apktool android-platform-tools gnu-sed python`)
* Mac (`brew install apktool android-platform-tools android-sdk gnu-sed python`)

# How it does it
If you phone is rooted, don't use this. Do this instead:
Expand Down
36 changes: 33 additions & 3 deletions get_code.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

USE_LEGACY_SIGN=false

command -v "python3"
if [[ $? -ne 0 ]]; then
printf 'Missing python3. Installed under a different name?\n'
Expand All @@ -17,6 +19,19 @@ fi
# Abort on errors.
set -e

while [[ $# -gt 0 ]]; do
case $1 in
--legacy-sign)
USE_LEGACY_SIGN=true
shift
;;
*)
echo "Unknown option $1"
exit 1
;;
esac
done

printf 'Make sure Steam Guard Mobile Authenticator is DISABLED or you will be
locked out of your Steam account!
'
Expand All @@ -40,7 +55,8 @@ $SEDVAR -i 's/android:allowBackup="false"/android:allowBackup="true"/g' steam/An
printf '\n[ Rebuilding APK ]\n'
apktool b steam

PASS=$(tr -cd "[:digit:]" < /dev/urandom | head -c 8)
printf '\n[ Generating password ]\n'
PASS=$(LC_CTYPE=C LC_ALL=C tr -cd "[:digit:]" < /dev/urandom | head -c 8)

printf '\n[ Generating signing key ]\n'
keytool -genkey -noprompt \
Expand All @@ -53,15 +69,29 @@ keytool -genkey -noprompt \
-alias attemptone \
-dname "CN=example.com, OU=dont, O=use, L=this, S=in, C=production"

printf '\n[ Signing APK ]\n'
jarsigner \
if [ "$USE_LEGACY_SIGN" = true ]; then
printf '\n[ Signing APK (legacy way) ]\n'
jarsigner \
-sigalg SHA1withRSA \
-digestalg SHA1 \
-keystore key.keystore \
-storepass $PASS \
-keypass $PASS \
steam/dist/steam.apk \
attemptone
else
printf '\n[ Preparing the file ]\n'
zipalign -v -f 4 steam/dist/steam.apk steam/dist/steam-aligned.apk
mv -f steam/dist/steam-aligned.apk steam/dist/steam.apk

printf '\n[ Signing APK ]\n'
apksigner sign \
--ks key.keystore \
--ks-key-alias attemptone \
--ks-pass pass:$PASS \
--key-pass pass:$PASS \
steam/dist/steam.apk
fi
rm key.keystore

printf '\n[ Uninstalling Steam App ]\n'
Expand Down

0 comments on commit d3d2999

Please sign in to comment.