-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathget_code.sh
executable file
·115 lines (96 loc) · 2.89 KB
/
get_code.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env bash
USE_LEGACY_SIGN=false
command -v "python3"
if [[ $? -ne 0 ]]; then
printf 'Missing python3. Installed under a different name?\n'
exit 1
fi
# Check for gsed for MacOS
if [ -x "$(command -v gsed)" ]; then
printf 'Using gsed\n'
SEDVAR="gsed"
else
SEDVAR="sed"
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!
'
read -rp 'Press [ENTER] when you are ready, or Ctrl-C to exit.'
printf '[ Pulling APK from device ]\n'
adb shell pm list packages \
| grep -m1 steam.community \
| cut -d: -f2 \
| xargs -r -n1 -I@ adb shell pm path @ \
| cut -d: -f2 \
| xargs -r -n1 -I@ adb pull @ steam.apk
printf '\n[ Disassembling APK ]\n'
apktool d steam.apk
rm steam.apk
printf '\n[ Patching AndroidManifest.xml ]\n'
$SEDVAR -i 's/android:allowBackup="false"/android:allowBackup="true"/g' steam/AndroidManifest.xml
printf '\n[ Rebuilding APK ]\n'
apktool b steam
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 \
-keyalg RSA \
-keysize 2048 \
-validity 10000 \
-storepass $PASS \
-keypass $PASS \
-keystore key.keystore \
-alias attemptone \
-dname "CN=example.com, OU=dont, O=use, L=this, S=in, C=production"
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'
adb uninstall com.valvesoftware.android.steam.community
printf '\n[ Installing patched APK ]\n'
adb install steam/dist/steam.apk
adb shell monkey -p com.valvesoftware.android.steam.community 1
printf '
Sign in to Steam and ENABLE Steam Guard Mobile Authenticator.
'
read -rp 'Press [ENTER] when you are ready.'
printf '
Extracting data. Please confirm "back up my data" on device. DO NOT set a password.
'
adb backup -f backup.ab com.valvesoftware.android.steam.community
dd if=backup.ab bs=24 skip=1 | python3 -c "import zlib,sys;sys.stdout.buffer.write(zlib.decompress(sys.stdin.buffer.read()))" | tar -xf -
cat apps/com.valvesoftware.android.steam.community/f/* | python3 -m json.tool