Microstar301

CCTERMSERV/SERVER

Dec 1st, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.33 KB | None | 0 0
  1. term.clear()
  2. if fs.exists("math")==true then
  3.  print("OK")
  4.  sleep(1)
  5. else
  6.  shell.run("pastebin","get","cNe8cRkn","math")
  7. end
  8. if fs.exists("list")==true then
  9.  print("OK")
  10.  sleep(1)
  11. else
  12.  shell.run("pastebin","get","sZzAdPLu","list")
  13. end
  14. if fs.exists("menu")==true then
  15.  print("OK")
  16.  sleep(1)
  17. else
  18.  term.setCursorPos(-99,-99)
  19.  shell.run("pastebin","get","iDyUBqVM","menu")
  20.  os.reboot()
  21. end
  22. if fs.exists("dirs")==true then
  23.  print("OK")
  24.  sleep(1)
  25. else
  26.  term.setCursorPos(-99,-99)
  27.  shell.run("pastebin","get","VJY6UgdG","dirs")
  28. end
  29. monitor=peripheral.wrap("right")
  30. function m()
  31.  monitor.clear()
  32.  monitor.setCursorPos(1,1)
  33. end
  34. rednet.open("top")
  35. term.clear()
  36. term.setCursorPos(1,1)
  37. print("Microtech Terminas Server v0.9")
  38. print("\(c\)Microtech")
  39. print("***LOG***")
  40. while true do
  41. x,y=rednet.receive()
  42. if y=="CONNECT" then
  43. RAM=x
  44. m()
  45. print("USER ",x," connected.")
  46. monitor.write("User ")
  47. monitor.write(x)
  48. monitor.write(" connected.")
  49.  
  50. rednet.send(x,"write")
  51. rednet.send(x,"LOCK:")
  52. rednet.send(x,"PASS")
  53. x,y=rednet.receive()
  54. if y=="0000" then
  55.  m()
  56.  print("USER ",x," logged on.")
  57.  monitor.write("User ")
  58.  monitor.write(x)
  59.  monitor.write(" logged on.")
  60.  
  61.   while true do
  62.    shell.run("/menu")
  63.    rednet.send(x,"INPUT")
  64.     G,y=rednet.receive()
  65.    if y=="1" then
  66.     m()
  67.     print("User ",x," ran Option 1")
  68.     monitor.write("User ")
  69.     monitor.write(x)
  70.     monitor.write(" ran Option 1")
  71.     rednet.send(RAM,"CLEAR")
  72.     rednet.send(RAM,"RANDOM TEXT")
  73.     rednet.send(RAM,"MICROTECH \(c\)")
  74.     rednet.send(RAM,"Made by Microstar301")
  75.     rednet.send(RAM,"WAIT")
  76.     rednet.send(RAM,"2")
  77.     sleep(2)
  78.     shell.run("monitor","right","menu")
  79.    end
  80.    if y=="2" then
  81.     m()
  82.     print("User ",x," ran Option 2")
  83.     monitor.write("User ")
  84.     monitor.write(x)
  85.     monitor.write(" ran Option 2")
  86.     rednet.send(RAM,"CLEAR")
  87.     rednet.send(RAM,"write")
  88.     rednet.send(RAM,"RUN:")
  89.     rednet.send(RAM,"INPUT")
  90.     G,y=rednet.receive()
  91.     m()
  92.     print("User ",x," ran: ",y,".")
  93.     monitor.write("User ")
  94.     monitor.write(x)
  95.     monitor.write(" ran: ")
  96.     monitor.write(y)
  97.     monitor.write(".")
  98.     if G==RAM then
  99.      if y=="reset" or y=="reset" then
  100.       rednet.send(RAM,"EXIT")
  101.       os.reboot()
  102.      end
  103.      if y=="update" or y=="UPDATE" then
  104.       print("User ",x," updated System.")
  105.       rednet.send(RAM,"WAIT")
  106.       rednet.send(RAM,"1")
  107.       shell.run("rm","/startup")
  108.       shell.run("rm","/menu")
  109.       shell.run("pastebin","get","LBuMEMAD","/startup")
  110.       shell.run("pastebin","get","iDyUBqVM","/menu")
  111.       rednet.send(RAM,"CLEAR")
  112.       rednet.send(RAM,"To Complete the Updating Process, restart the System.")
  113.       rednet.send(RAM,"PULL")
  114.       local wt=0
  115.       rednet.send(RAM,"PULL")
  116.       while wt==0 do
  117.        local wi,it=rednet.receive()
  118.        if wi==RAM then
  119.         if it=="PULLED" then
  120.          wt=1
  121.         end
  122.        end
  123.       end
  124.      end
  125.      shell.run(y)
  126.     end
  127.     m()
  128.     monitor.write("DONE")
  129.     sleep(1)
  130.    end
  131.    if y=="3" then
  132.     m()
  133.     monitor.write("User ")
  134.     monitor.write(x)
  135.     monitor.write(" logged out.")
  136.     sleep(1)
  137.     rednet.send(RAM,"EXIT")
  138.     os.reboot()
  139.    end
  140.    
  141.    
  142.   end
  143.  else
  144.  m()
  145.  monitor.write("User ")
  146.  monitor.write(x)
  147.  monitor.write(" refused.")
  148.  
  149.  rednet.send(x,"EXIT")
  150. end
  151. end
  152. end
  153. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment