Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- SERVER SOFTWARE BY DENKDAETZ
- function shutdownserver()
- textutils.slowPrint("Shutting down.")
- textutils.slowPrint("Cutting connection.")
- rednet.close("back")
- textutils.slowPrint("Done.")
- os.reboot()
- end
- function idle()
- while true do
- ipr, com = rednet.receive()
- --com = tostring(com)
- if com == "exit" then
- shutdownserver()
- elseif com == "hello" then
- rednet.send(ipr, "Hello, Dave.")
- end
- end
- end
- function login()
- textutils.slowPrint("Awaiting login...")
- ipr, user = rednet.receive()
- --user = tostring(user)
- if user == "root" then
- textutils.slowPrint(user.." CONNECTED FROM: "..ip)
- textutils.slowPrint("Awaiting password...")
- rednet.send(ipr, "Welcome "..user.."\nPlease type in password")
- ipr, pass = rednet.receive()
- --pass = tostring(pass)
- if pass == rootpass then
- idle()
- else
- rednet.send(ip, "Wrong password.")
- login()
- end
- else
- --for i=0, 128, 1 do
- --end
- shutdownserver()
- end
- end
- user = {}
- pass = {}
- rootpass = ""
- term.clear()
- term.setCursorPos(1, 1)
- textutils.slowPrint("Loading root password.")
- rootfile = io.open("/root/pass.txt", "r")
- rootpass = rootfile:read()
- rootfile:close()
- textutils.slowPrint("Done.")
- textutils.slowPrint("Connecting to network.")
- rednet.open("back")
- textutils.slowPrint("Done.")
- login()
Add Comment
Please, Sign In to add comment