Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --os.pullEvent = os.pullEventRaw
- local monitor = peripheral.find("monitor")
- pro = shell.getRunningProgram()
- function lock()
- if fs.exists(userNameFile) then
- local file = fs.open(userNameFile, "r")
- user = file.readLine()
- end
- if fs.exists(passFile) then
- local file = fs.open(passFile, "r")
- pass = file.readLine()
- if prompt == nil then
- term.clear()
- term.setCursorPos(1,1)
- textutils.slowPrint("Hello, what would you like your username to be?")
- userInput = term.setTextColor(colors.yellow)
- userInput = read()
- term.setTextColor(colors.white)
- -------------------------------------
- while true do
- userNameFile = tostring(math.random(1,65535))
- if not fs.exists(userNameFile) then
- local file = fs.open(userNameFile, "w")
- file.write(userInput)
- file.close()
- break
- end
- end
- -------------------------------------
- textutils.slowPrint("Hello ", user, ". What would you like your password to be?")
- passInput = term.setTextColor(colors.yellow)
- passInput = read()
- term.setTextColor(colors.white)
- -------------------------------------
- while true do
- passFile = tostring(math.random(1,65535))
- if not fs.exists(passFile) then
- local file = fs.open(passFile, "w")
- file.write(passInput)
- file.close()
- break
- end
- end
- -------------------------------------
- textutils.slowPrint("What would you like your message to say before displaying your login prompt?")
- promptInput = term.setTextColor(colors.yellow)
- promptInput = read()
- term.setTextColor(colors.white)
- -------------------------------------
- while true do
- promptFile = tostring(math.random(1,65535))
- if not fs.exists(promptFile) then
- local file = fs.open(promptFile)
- file.write(promptInput)
- file.close()
- break
- end
- end
- -------------------------------------
- textutils.slowPrint("Okay, setup finished, reloading in 2 seconds")
- sleep(2)
- lock()
- end
- if peripheral.find("monitor") then
- monitor.setTextScale(3)
- monitor.setBackgroundColor(colors.red)
- monitor.clear()
- monitor.setCursorPos(2,5)
- monitor.write("Currently Locked")
- end
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- textutils.slowPrint(mess)
- term.setTextColor(colors.white)
- sleep(1)
- textutils.slowWrite("Username: ")
- input1= term.setTextColor(colors.yellow)
- input1 = read()
- term.setTextColor(colors.white)
- textutils.slowWrite("Password: ")
- input2 = term.setTextColor(colors.yellow)
- input2 = read("*")
- if user == input1 and pass == input2 then
- if peripheral.find("monitor") then
- monitor.setTextScale(3)
- monitor.setBackgroundColor(colors.green)
- monitor.clear()
- monitor.setCursorPos(2,5)
- monitor.write("Currently Unlocked")
- end
- term.setTextColor(colors.green)
- term.setCursorPos(1,4)
- term.slowPrint("Valid Login Credentials. Welcome to the System.")
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- print(os.version())
- term.setCursorPos(1,2)
- else
- term.setCursorPos(1,4)
- term.setTextColor(colors.red)
- textutils.slowPrint("Invalid Login Credenials, Please Don't Try Again.")
- sleep(2)
- lock()
- end
- end
- if not fs.exists("startup") then
- file = fs.open("startup", "w")
- file.write("shell.run(\"")
- file.write(pro)
- file.write("\")")
- file.close()
- os.reboot()
- end
- lock()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement