-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathuuid
executable file
·48 lines (37 loc) · 1.75 KB
/
uuid
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
#!/usr/bin/env zsh
# macos-scripts/uuid
# uuid
# Print paths and files which potentially contain the UUID (IOPlatformUUID)
# Instead of executing something like ioreg -d2 -c IOPlatformExpertDevice | awk -F\" '/IOPlatformUUID/{print $(NF-1)}'
set -uo pipefail
# -u prevent using undefined variables
# -o pipefail force pipelines to fail on first non-zero status code
setopt null_glob
# Make any glob that doesn't match expand to nothing
# prevents errors when trying to iterate over non-existent files
function main {
declare -a UUID_PATHS=("${HOME}/Library/Application Support/CrashReporter/" \
"${HOME}/Library/Dictionaries/CoreDataUbiquitySupport/" \
"${HOME}/Library/Containers/*/Data/Library/Application Support/CrashReporter/")
# $HOME/Library/Keychains/$UUID/
# Inside $HOME/Library/Keychains/ there will be a directory named after the UUID of the system
# $HOME/Library/Preferences/ByHost/com.apple.loginwindow.UUID.plist
declare -a UUID_FILES=("$HOME/Pictures/Photos Library.photoslibrary/database/Photos.sqlite.lock")
echo "Paths which potentially contain UUID:"
for UUID_PATH in "${UUID_PATHS[@]}"; do
echo "${UUID_PATH}"*
done
echo
echo "Files which potentially contain UUID:"
for UUID_FILE in "${UUID_FILES[@]}"; do
echo "${UUID_FILE}"
# cat "${UUID_FILE}" | grep -oE '[[:alnum:]]{8}(-[[:alnum:]]{4}){3}-[[:alnum:]]{12}'
done
UUID=$(echo "$HOME/Library/Application Support/CrashReporter/"* | grep -oE '[[:alnum:]]{8}(-[[:alnum:]]{4}){3}-[[:alnum:]]{12}' | head -n 1)
echo
echo "UUID is probably: ${UUID}"
echo
echo "Other files which might contain the UUID:"
mdfind "${UUID}" | grep -v '/Library/Application\ Support/' | grep -v 'CoreDataUbiquitySupport' | grep -v 'Photos.sqlite.lock'
}
main "$@"