Advertisement
Guest User

startup

a guest
Oct 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. os.loadAPI("loginutils")
  2. os.loadAPI("textutils2")
  3.  
  4. loginutils.setPW("developer")
  5. local loginpw = "developer"
  6.  
  7. function loginmask()
  8. os.pullEvent = loginutils.secureMode
  9.  
  10. textutils2.clear()
  11. textutils2.writeCenterX("---------------",3)
  12. textutils2.writeCenterX("-Please Login:-",4)
  13. textutils2.writeCenterX("---------------",5)
  14. print("")
  15. local pw = loginutils.read("")
  16.  
  17. if pw ~= loginpw then
  18.   print("Wrong password.")
  19.   loginutils.sleep(2)  
  20.   os.reboot()
  21. end
  22.  
  23. textutils2.clear()
  24. textutils2.writeCenterX("Willkommen.", 4)
  25. textutils2.writeCenterX("anghenOS 0.1", 5)
  26. loginutils.sleep(2)
  27. textutils2.clear()
  28. end
  29.  
  30. function commandHandler()
  31.   write(">")
  32.   cmd = loginutils.read()
  33.   local args = {}
  34.   local count = 1
  35.   for i in string.gmatch(cmd, "%S+") do
  36.     args[count] = i
  37.     count = count+1
  38.   end
  39.   if args[0] == "devmode" then
  40.     loginutils.restore()
  41.     error("Devmode activated")
  42.   elseif args[0] == "status" then
  43.     modem = peripheral.wrap("bottom")
  44.     devices = modem.getNamesRemote()
  45.    
  46.     for x = 1, #devices do
  47.       print(peripheral.getType(devices[x]).." at "..devices[x])
  48.     end
  49.   end
  50. end
  51.  
  52. loginmask()
  53. local ended = false
  54.  
  55. while ended == false do
  56.   commandHandler()
  57. end
  58. loginutils.restore()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement