Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local oldPull = os.pullEvent
- os.pullEvent = os.pullEventRaw
- local serverId = 45
- function listenToInput()
- term.setTextColor(colors.yellow)
- write("> ")
- term.setTextColor(colors.white)
- local input = read()
- local lInput = string.lower(input)
- if lInput == "edit startup" then
- term.setTextColor(colors.red)
- print("edit:9: Access Denied.")
- listenToInput()
- elseif lInput == "startup" then
- term.setTextColor(colors.red)
- print("No such program")
- listenToInput()
- elseif string.find(lInput, "cp") and string.find(lInput, "startup") then
- term.setTextColor(colors.red)
- print("copy:9: Access Denied.")
- listenToInput()
- elseif string.find(lInput, "delete") and string.find(lInput, "startup") then
- term.setTextColor(colors.red)
- print("delete:9: Access Denied.")
- listenToInput()
- else
- shell.run(input)
- listenToInput()
- end
- end
- term.clear()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.purple)
- rednet.open("top")
- print("Started RedNet.")
- print("Pinging Server... This may take 10 seconds.")
- rednet.send(serverId, "RequestStatus")
- local id2 = rednet.receive(10)
- if id2 == nil then
- term.setTextColor(colors.red)
- print("Could not reach Server. Rebooting.")
- sleep(2)
- os.reboot()
- end
- term.setTextColor(colors.red)
- print(" ")
- print("Please Login to use this Computer.")
- print("Accounts are saved on the Server.")
- print(" ")
- term.setTextColor(colors.orange)
- write("Username: ")
- term.setTextColor(colors.cyan)
- local username = read()
- term.setTextColor(colors.orange)
- write("Password: ")
- term.setTextColor(colors.cyan)
- local password = read("*")
- rednet.send(serverId, username, password)
- term.setTextColor(colors.green)
- print("Please wait 30 seconds that the Server can respond.")
- while true do
- id,success = rednet.receive(30)
- if success == nil then
- success = false
- end
- if id == serverId then
- if success == true then
- term.setTextColor(colors.green)
- print("Access Granted.")
- term.setTextColor(colors.yellow)
- print(os.version())
- os.pullEvent = oldPull
- listenToInput()
- else
- term.setTextColor(colors.red)
- print("Access Denied or Server offline. Rebooting Computer.")
- sleep(3)
- os.reboot()
- end
- else
- term.setTextColor(colors.red)
- print("Invalid RedNet ID. Rebooting Computer.")
- sleep(3)
- os.reboot()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement