firmware 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. # This is a script for easy locking, and unlocking of open firmware
  3. showHelp () {
  4. echo -e " List of possible commands:"
  5. echo -e "\tprint = prints the current setting"
  6. echo -e "\tnone = turns off all protection"
  7. echo -e "\tcommand = blocks all ways to hack the commputer"
  8. echo -e "\tfull = requires a password to even boot the computer"
  9. }
  10. printLevel () {
  11. Level=$(echo `nvram security-mode`|cut -d\ -f 2)
  12. case $Level in
  13. "none" ) echo -e "\e[1;31m$Level\e[m"
  14. break ;;
  15. "command" ) echo -e "\e[1;32m$Level\e[m"
  16. break ;;
  17. "full" ) echo -e "\e[1;34m$Level\e[m"
  18. break ;;
  19. esac
  20. }
  21. if [ $# = 0 ]; then
  22. printf "choose your security level: "
  23. read Input
  24. if [ $Input ]; then
  25. case $Input in
  26. "print" | "p" ) printLevel
  27. break ;;
  28. "none" | "n") sudo nvram security-mode=none
  29. echo -e "\e[1;31mNONE\e[m"
  30. break ;;
  31. "command" | "c" ) sudo nvram security-mode=command
  32. echo -e "\e[1;32mCOMMAND\e[m"
  33. break ;;
  34. "full" | "f" ) sudo nvram security-mode=full
  35. echo -e "\e[1;34mFULL\e[m"
  36. break ;;
  37. "help" | "h" | * ) showHelp
  38. break ;;
  39. esac
  40. else
  41. showHelp
  42. fi
  43. else
  44. while [ $# == 1 ]; do
  45. Arg=$1
  46. case $Arg in
  47. "--print" | "-p" ) printLevel
  48. break ;;
  49. "--none" | "-n") sudo nvram security-mode=none
  50. echo -e "\e[1;31mNONE\e[m"
  51. break ;;
  52. "--command" | "-c" ) sudo nvram security-mode=command
  53. echo -e "\e[1;32mCOMMAND\e[m"
  54. break ;;
  55. "--full" | "-f" ) sudo nvram security-mode=full
  56. echo -e "\e[1;34mFULL\e[m"
  57. break ;;
  58. "--help" | "-h" | * ) showHelp
  59. break ;;
  60. esac
  61. done
  62. fi