Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- f = io.open("data.password", "r")
- password = f:read("*a")
- f:close()
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("Enter password:")
- local enteredpassword = read("*")
- if enteredpassword ~= password then
- print("Wrong password")
- sleep(0.3)
- else
- print("Accepted")
- sleep(1)
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("Security Terminal")
- if (rs.getOutput("back") == true) then
- print("Security system status: OFF")
- else
- print("Security system status: ON")
- end
- print("1. Toggle security system")
- print("2. Change password")
- print("3. Lock terminal")
- local choice = read()
- if choice == "1" then
- if (rs.getOutput("back") == false) then
- rs.setOutput("back",true)
- else
- rs.setOutput("back",false)
- end
- print("Toggling...")
- sleep(1)
- elseif choice == "2" then
- term.clear()
- term.setCursorPos(1,1)
- print("Enter new password:")
- local firstattempt = read("*")
- print("Confirm new password:")
- local secondattempt = read("*")
- if firstattempt == secondattempt then
- print("New password set")
- password = firstattempt
- f = io.open("data.password", "w")
- f:write(password)
- f:close()
- sleep(1)
- else
- print("Passwords don't match")
- sleep(0.6)
- end
- elseif choice == "3" then
- break
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment