forked from SteamDatabase/SteamTracking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract_client.sh
executable file
·101 lines (71 loc) · 1.98 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
#!/bin/bash
#
# PREPARE EVERYTHING
#
export LC_ALL=C
DIR="$(dirname "$(readlink -f "$0")")"
cd "$DIR/.support"
echo Deleting existing files
# Scary!
rm -rf "$DIR"/ClientExtracted/*
rm -rf bins/*
rm -f "$DIR"/BuildbotPaths/*
rm -rf "$DIR"/Protobufs/*
#
# EXTRACT EVERYTHING
#
echo Extracting archives
for z in *.zip;
do
if [[ "$z" == *"bins"* ]];
then
unzip -q -n "$z" -d bins/
else
unzip -q -o "$z" -d "$DIR/ClientExtracted/"
fi
done
#
# PROTOBUF DUMP
#
echo Dumping protobufs
# https://github.com/SteamRE/SteamKit/tree/master/Resources/ProtobufDumper
dotnet ~/ProtobufDumper/ProtobufDumper.dll bins/steamui.dylib "$DIR/Protobufs/" > /dev/null
dotnet ~/ProtobufDumper/ProtobufDumper.dll bins/steamclient.dylib "$DIR/Protobufs/" > /dev/null
~/ValveProtobufs/update.sh
# https://github.com/m4dEngi/steamworks_dumper
echo Dumping structs
./MachoDumper/swdumper bins/steamclient.dylib "$DIR/Structs/"
#
# BUILDBOT PATHS
#
echo Dumping buildbot paths
#find ubuntu/ | sort > "$DIR/BuildbotPaths/ubuntu_binaries.txt"
for i in $(find bins/ -name '*.dylib');
do
echo "Dumping $i"
name=$(basename "$i" .dylib);
strings "$i" | grep "/buildbot/" | sed "s/^[^\/]*\//\//" | sed "s/\:[0-9]*$//" | sort -u > "$DIR/BuildbotPaths/$name.txt"
./nm-with-macho -C -p "$i" | grep -Evi "GCC_except_table|google::protobuf|steam_rel_osx_builder" | awk '{$1=""; print $0}' | sort -u > "$DIR/Symbols/$name.txt"
done
strings bins/steamui.dylib | grep "/api/" | sort > "$DIR/API/Storefront.txt"
#
# CHANGE CRAPPY ENCODINGS TO UTF-8
#
cd "$DIR/ClientExtracted/"
echo Fixing encodings
for i in $(find -name '*.txt' -o -name '*.xml' -o -name '*.cfg' -o -name '*.res');
do
encoding=$(file -bi "$i" | sed -e 's/.*[ ]charset=//');
if [ "$encoding" != "utf-8" ] && [ "$encoding" != "binary" ];
then
iconv -f "$encoding" -t UTF-8 "$i" -o "$i.tmp" && mv "$i.tmp" "$i"
fi
done
#
# CONVERT .TGA AND .ICO TO .PNG
#
#echo Converting images to pngs
#for i in $(find -name '*.tga');
#do
# convert -strip "$i" "$i.png"
#done