Created
November 28, 2021 22:33
-
-
Save macmule/f81debc74d35f6842fb4e28390a54625 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#################################################################################################### | |
# | |
# License: https://macmule.com/license/ | |
# | |
#################################################################################################### | |
# Check to see if setregproptool exists in correct location. | |
if [ -f "/Library/Application Support/JAMF/bin/setregproptool" ]; | |
then | |
# Use expect so command times out | |
EFIPasswordSet=$(expect <<- DONE | |
# Timeout after 2 seconds | |
set timeout 2 | |
# Try & delete firmware password but without sending a password. | |
# Password prompt is only received is password set. | |
spawn sudo /Library/Application\ Support/JAMF/bin/setregproptool -d | |
# If "Enter current password:" prompt returned | |
expect "*nter current password:*" | |
DONE) | |
# If $EFIPasswordSet contains the word "current" then we have been prompted | |
# for a firmware password, then return "Set" | |
if [[ "$EFIPasswordSet" == *current* ]]; | |
then | |
echo "<result>Set</result>" | |
# Else return "Not Set" | |
else | |
echo "<result>Not Set</result>" | |
fi | |
# If setregproptool does not exist in correct location. | |
else | |
echo "<result>Not Found</result>" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment