-
Notifications
You must be signed in to change notification settings - Fork 22
/
discover.sh
executable file
·29 lines (21 loc) · 941 Bytes
/
discover.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
#!/usr/bin/env bash
set -e
DYLIB="libMobileGestalt.dylib"
HASHES="hashes.txt"
READABLE="readable.txt"
OBFUSCATED="discover-obfuscated.txt"
OBFUSCATED_MAPPED="discover-obfuscated-mapped.txt"
MAYBE_NON_GESTALT_KEYS="maybe-non-gestalt-keys.txt"
nm -g --defined-only $DYLIB | awk '{print $3}' | grep "^_MobileGestalt_" | grep -v "_obj$" | sed -e 's/^_MobileGestalt_get_//' -e 's/^_MobileGestalt_copy_//' | awk '{print toupper(substr($0,1,1))substr($0,2)}' > $READABLE
clang -framework Foundation util.m -o util -Wno-deprecated-declarations
rm -f $OBFUSCATED $OBFUSCATED_MAPPED
while IFS= read -r readable
do
hash=`./util obfuscate $readable`
echo "$hash: $readable" >> $OBFUSCATED_MAPPED
echo $hash >> $OBFUSCATED
done < $READABLE
sort -f $OBFUSCATED_MAPPED -o $OBFUSCATED_MAPPED
grep -v -f $OBFUSCATED $HASHES | sort -f > temp-$MAYBE_NON_GESTALT_KEYS
python3 gen_maybe_non_gestalt_keys.py
rm -f temp-$MAYBE_NON_GESTALT_KEYS