Guest User

Untitled

a guest
Jun 23rd, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. -- SERVER SOFTWARE BY DENKDAETZ
  2.  
  3. function shutdownserver()
  4. textutils.slowPrint("Shutting down.")
  5. textutils.slowPrint("Cutting connection.")
  6. rednet.close("back")
  7. textutils.slowPrint("Done.")
  8. os.reboot()
  9. end
  10.  
  11. function idle()
  12. while true do
  13. ipr, com = rednet.receive()
  14. --com = tostring(com)
  15. if com == "exit" then
  16. shutdownserver()
  17. elseif com == "hello" then
  18. rednet.send(ipr, "Hello, Dave.")
  19. end
  20. end
  21. end
  22.  
  23. function login()
  24. textutils.slowPrint("Awaiting login...")
  25. ipr, user = rednet.receive()
  26. --user = tostring(user)
  27. if user == "root" then
  28. textutils.slowPrint(user.." CONNECTED FROM: "..ip)
  29. textutils.slowPrint("Awaiting password...")
  30. rednet.send(ipr, "Welcome "..user.."\nPlease type in password")
  31. ipr, pass = rednet.receive()
  32. --pass = tostring(pass)
  33. if pass == rootpass then
  34. idle()
  35. else
  36. rednet.send(ip, "Wrong password.")
  37. login()
  38. end
  39. else
  40. --for i=0, 128, 1 do
  41. --end
  42. shutdownserver()
  43. end
  44. end
  45.  
  46. user = {}
  47. pass = {}
  48. rootpass = ""
  49.  
  50. term.clear()
  51. term.setCursorPos(1, 1)
  52. textutils.slowPrint("Loading root password.")
  53. rootfile = io.open("/root/pass.txt", "r")
  54. rootpass = rootfile:read()
  55. rootfile:close()
  56. textutils.slowPrint("Done.")
  57. textutils.slowPrint("Connecting to network.")
  58. rednet.open("back")
  59. textutils.slowPrint("Done.")
  60. login()
Add Comment
Please, Sign In to add comment