Advertisement
louino

door protection

Feb 29th, 2024
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. speaker = peripheral.wrap("right")
  2. os.loadAPI("sha.lua")
  3. password = "sha256 pasword"
  4. rs.setOutput("left", false)
  5. term.clear()
  6. term.setCursorPos(1,1)
  7. term.setBackgroundColor(colors.black)
  8. term.setTextColor(colors.yellow)
  9. term.write("EndtechOS v1.8")
  10. term.setCursorPos(1,2)
  11. term.write("ENDTECH SECURITY SYSTEM v1.0")
  12. term.setCursorPos(1,4)
  13. term.setTextColor(colors.white)
  14. term.write("Please enter your password: ")
  15. term.setCursorPos(1,5)
  16. term.write("> ")
  17. term.setTextColor(colors.gray)
  18. local pass = read("*")
  19. term.setCursorPos(1,6)
  20. term.setTextColor(colors.white)
  21. term.write("checking...")
  22. if sha.sha256(pass) == password then
  23. term.setCursorPos(1,7)
  24. term.setTextColor(colors.green)
  25. print("Access granted")
  26. rs.setOutput("left", true)
  27. speaker.playSound("mekanism:etc.success",0.3)
  28. sleep(5)
  29. for i=1,3 do
  30. sleep(1)
  31. speaker.playNote("hat", 1, 1)
  32. end
  33. rs.setOutput("left", false)
  34. os.reboot()
  35. else
  36. term.setCursorPos(1,7)
  37. term.setTextColor(colors.red)
  38. term.write("Invalid password")
  39. term.setCursorPos(1,8)
  40. term.setTextColor(colors.white)
  41. term.setBackgroundColor(colors.red)
  42. print("Access denied")
  43. speaker.playSound("mekanism:etc.error",3)
  44. sleep(2)
  45. os.reboot()
  46. end
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement