-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathextract_client.sh
executable file
·121 lines (88 loc) · 2.65 KB
/
extract_client.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
116
117
118
119
120
121
#!/bin/bash
#
# PREPARE EVERYTHING
#
export LC_ALL=C
DIR="$(dirname "$(readlink -f "$0")")"
cd "$DIR/.support" || exit 1
echo Deleting existing files
# Scary!
rm -rf linux_bins/*
rm -rf "$DIR"/ClientExtracted/*
rm -f "$DIR"/BuildbotPaths/*
rm -rf "$DIR"/Protobufs/*
#
# EXTRACT EVERYTHING
#
echo Extracting archives
for z in linux_archives/*.zip;
do
if [[ "$z" == *"bins"* ]];
then
unzip -q -n "$z" -d linux_bins/
else
unzip -q -o "$z" -d "$DIR/ClientExtracted/"
fi
unzip -lv "$z" | head -n -2 | tail -n+4 | awk '{print $(NF-1),$NF}' >> "$DIR/ClientExtracted/ClientContentLinux.txt"
done
sort -k 2 -o "$DIR/ClientExtracted/ClientContentLinux.txt" "$DIR/ClientExtracted/ClientContentLinux.txt"
#
# PROTOBUF DUMP
#
echo Dumping protobufs
PROTOBUF_DUMPER="$DIR/SteamKit/Resources/ProtobufDumper/ProtobufDumper/bin/Release/linux-x64/publish/ProtobufDumper"
"$PROTOBUF_DUMPER" linux_bins/ubuntu12_32/steamui.so "$DIR/Protobufs/" > /dev/null
"$PROTOBUF_DUMPER" linux_bins/ubuntu12_32/steamclient.so "$DIR/Protobufs/" > /dev/null
# https://github.com/m4dEngi/steamworks_dumper
echo Dumping structs
#./steamworks_dumper/build/steamworks_dumper "linux_bins/ubuntu12_32/steamui.so" "$DIR/Structs/"
#./steamworks_dumper/build/steamworks_dumper "linux_bins/ubuntu12_32/steamclient.so" "$DIR/Structs/"
#
# STRINGS
#
echo Dumping strings
while IFS= read -r -d '' file
do
echo "Dumping $file"
name=$(basename "$file" .so)
"$DIR/DumpStrings/DumpStrings" -target elf -binary "$file" | sort --unique > "$DIR/Strings/$name.txt"
done < <(find linux_bins/ubuntu12_32/ -name '*.so' -print0)
"$DIR/DumpStrings/DumpStrings" -target elf -binary "$DIR/ClientExtracted/ubuntu12_32/steam" | sort --unique > "$DIR/Strings/steam.txt"
#
# Jump to extracted folder
#
ProcessClientFolder()
{
#
# PRETTIFY JAVASCRIPT
#
echo Prettifying javascript
while IFS= read -r -d '' file
do
if [[ "$file" == *.js ]]
then
php "$DIR/extract_json_from_webpack.php" "$(pwd)/$file"
if [ $? -eq 200 ]
then
echo "Extracted json from $file"
continue
fi
fi
echo "Prettifying $file"
npm run prettier "$(pwd)/$file"
done < <(find steamui/ clientui/ siteserverui/ \( -name '*.js' -o -name '*.css' \) -print0)
#
# CHANGE CRAPPY ENCODINGS TO UTF-8
#
echo Fixing encodings
while IFS= read -r -d '' file
do
encoding=$(file -bi "$file" | sed -e 's/.*[ ]charset=//');
if [ "$encoding" != "utf-8" ] && [ "$encoding" != "binary" ];
then
iconv -f "$encoding" -t UTF-8 "$file" -o "$file.tmp" && mv "$file.tmp" "$file"
fi
done < <(find . \( -name '*.txt' -o -name '*.xml' -o -name '*.cfg' -o -name '*.res' \) -print0)
}
cd "$DIR/ClientExtracted/" || exit 1
ProcessClientFolder