12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #!/bin/sh
- # This is a script for easy locking, and unlocking of open firmware
- showHelp () {
- echo -e " List of possible commands:"
- echo -e "\tprint = prints the current setting"
- echo -e "\tnone = turns off all protection"
- echo -e "\tcommand = blocks all ways to hack the commputer"
- echo -e "\tfull = requires a password to even boot the computer"
- }
- printLevel () {
- Level=$(echo `nvram security-mode`|cut -d\ -f 2)
- case $Level in
- "none" ) echo -e "\e[1;31m$Level\e[m"
- break ;;
- "command" ) echo -e "\e[1;32m$Level\e[m"
- break ;;
- "full" ) echo -e "\e[1;34m$Level\e[m"
- break ;;
- esac
- }
- if [ $# = 0 ]; then
- printf "choose your security level: "
- read Input
- if [ $Input ]; then
- case $Input in
- "print" | "p" ) printLevel
- break ;;
- "none" | "n") sudo nvram security-mode=none
- echo -e "\e[1;31mNONE\e[m"
- break ;;
- "command" | "c" ) sudo nvram security-mode=command
- echo -e "\e[1;32mCOMMAND\e[m"
- break ;;
- "full" | "f" ) sudo nvram security-mode=full
- echo -e "\e[1;34mFULL\e[m"
- break ;;
- "help" | "h" | * ) showHelp
- break ;;
- esac
- else
- showHelp
- fi
- else
- while [ $# == 1 ]; do
- Arg=$1
- case $Arg in
- "--print" | "-p" ) printLevel
- break ;;
- "--none" | "-n") sudo nvram security-mode=none
- echo -e "\e[1;31mNONE\e[m"
- break ;;
- "--command" | "-c" ) sudo nvram security-mode=command
- echo -e "\e[1;32mCOMMAND\e[m"
- break ;;
- "--full" | "-f" ) sudo nvram security-mode=full
- echo -e "\e[1;34mFULL\e[m"
- break ;;
- "--help" | "-h" | * ) showHelp
- break ;;
- esac
- done
- fi
|