-
Notifications
You must be signed in to change notification settings - Fork 3
/
report_Filevault_v1.2.sh
144 lines (116 loc) · 4.52 KB
/
report_Filevault_v1.2.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
# by Travelling Tech Guy
# 28th of August 2020
# travellingtechguy.blog
# This script will grab all useful information on a macOS system to throubleshoot FileVault
# Output will be written to a .txt file on the Desktop of the logged-in user
###### WARNING #####
# THIS SCRIPT WILL DISCLOSE CONFIDENTIAL INFORMATION LIKE:
# Usernames
# FileVault Recovery Keys
# SecureToken-enabled accounts
# !!! REMOVE THE INFORMATION YOU DO NOT WANT TO SHARE
# !!! DELETE THE FILE FROM THE DESKTOP WHEN DONE
# variables
currentDate=$(date "+%d%m%Y_%H%M")
echo $currentDate
currentFullDate=$(date)
echo $currentFullDate
loggedInUser=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
echo $loggedInUser
serial=$(system_profiler SPHardwareDataType | awk '/Serial/ {print $4}')
echo $serial
computerName=$(scutil --get ComputerName)
echo $computerName
osVer=$(sw_vers -productVersion)
echo $osVer
build=$(sw_vers -buildVersion)
echo $build
fdeSetupStatus=`/usr/bin/fdesetup status`
echo "$fdeSetupStatus"
diskUtil=`/usr/sbin/diskutil apfs listusers /`
echo "$diskUtil"
fdeSetup=`/usr/bin/fdesetup list -extended`
echo "$fdeSetup"
bootStrap=`/usr/bin/profiles status -type bootstraptoken`
echo "$bootStrap"
echo "Deferral Info:"
deferralInfo=`/usr/bin/fdesetup showdeferralinfo`
echo "$deferralInfo"
outputPath=""
outputPathContent=""
# Create dated file
rm -rf /Users/$loggedInUser/Desktop/reportFV-$serial-$currentDate.txt
touch /Users/$loggedInUser/Desktop/reportFV-$serial-$currentDate.txt
reportFile="/Users/$loggedInUser/Desktop/reportFV-$serial-$currentDate.txt"
##### PRINT INFO TO FILE #####
echo "################" >> $reportFile
echo "FileVault Report" >> $reportFile
echo "################" >> $reportFile
echo >> $reportFile
echo >> $reportFile
echo "Date: "$currentFullDate >> $reportFile
echo "---------------------------------------------" >> $reportFile
echo "Serial Number: "$serial >> $reportFile
echo "Computer Name: "$computerName >> $reportFile
echo "macOS Version: "$osVer >> $reportFile
echo "macOS Build: "$build >> $reportFile
echo "---------------------------------------------" >> $reportFile
echo >> $reportFile
echo "---------------" >> $reportFile
echo "Logged In User: "$loggedInUser >> $reportFile
echo "---------------" >> $reportFile
echo >> $reportFile
echo "----------------" >> $reportFile
echo "FileVault Status" >> $reportFile
echo "----------------" >> $reportFile
echo "(fdesetup status)" >> $reportFile
echo >> $reportFile
echo "$fdeSetupStatus" >> $reportFile
echo >> $reportFile
echo "-------------------------" >> $reportFile
echo "Secure Tokens - Disk Util" >> $reportFile
echo "-------------------------" >> $reportFile
echo "(disktutil apfs listusers /)" >> $reportFile
echo >> $reportFile
echo "$diskUtil" >> $reportFile
echo >> $reportFile
echo "------------------------" >> $reportFile
echo "Secure Tokens - fdesetup" >> $reportFile
echo "------------------------" >> $reportFile
echo "(sudo fdesetup list -extended)" >> $reportFile
echo >> $reportFile
echo "$fdeSetup" >> $reportFile
echo >> $reportFile
echo "---------" >> $reportFile
echo "BOOTSTRAP" >> $reportFile
echo "---------" >> $reportFile
echo "(sudo profiles status -type bootstraptoken)" >> $reportFile
echo >> $reportFile
echo "$bootStrap" >> $reportFile
echo >> $reportFile
echo "-------------" >> $reportFile
echo "Deferral Info" >> $reportFile
echo "-------------" >> $reportFile
echo "(sudo fdesetup showdeferralinfo)" >> $reportFile
echo >> $reportFile
echo "$deferralInfo" >> $reportFile
echo >> $reportFile
echo "----------------------" >> $reportFile
echo "Content of OutPut Path" >> $reportFile
echo "----------------------" >> $reportFile
if [ "$deferralInfo" != "Not found." ]; then
outputPath=$(echo "$deferralInfo" | sed -e 's/.*OutputPath = \"\(.*\)\";/\1/' | sed -n '3 p')
echo "$outputPath"
outputPathContent=$(cat $outputPath)
echo "($outputPath)" >> $reportFile
echo >> $reportFile
echo "$outputPathContent" >> $reportFile
fi
echo >> $reportFile
echo >> $reportFile
echo "#############################################" >> $reportFile
echo "Report script provided by Travelling Tech Guy" >> $reportFile
echo "Blog: https://travellingtechguy.blog" >> $reportFile
echo "GitHub: https://github.com/TravellingTechGuy/reportFileVault" >> $reportFile
echo "#############################################" >> $reportFile