Sanguin

CC S3RV3R

Apr 8th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.71 KB | None | 0 0
  1. --[[ TODO`s
  2. Get Officialmode to work
  3. ]]--
  4.  
  5.  
  6.  
  7. shell.run("clear")
  8. print("SKIPP3Rs S3RV3R B00TM3NU")
  9. os.pullEvent=os.pullEventRaw
  10. print("Establishing Rednetconnection...")
  11. print("checking for existing config...")
  12. x=fs.exists("serverstuff/rsetting") --may be a problrm here with /
  13. if x==true then
  14. redn=rednet.isOpen()
  15. h=fs.open("serverstuff/rsetting", "r")
  16. rednat=h.readAll()
  17. print("if u can read this call the support or the lazy coder")
  18. rednet.open(rednat)
  19. h.close()
  20. shell.run("clear")
  21. print("SKIPP3Rs S3RV3R B00TM3NU")
  22. print("Established")
  23. else
  24. write("Where is your Modem?: ")
  25. mod=read()
  26. rednet.open(mod)
  27.  h=fs.open("serverstuff/rsetting", "w")
  28. h.write(mod)
  29. h.close()
  30. end
  31. --rednet should be here established
  32.  
  33.  
  34.  
  35. --going to look if it is first use
  36. x=fs.exists("serverstuff/Password")
  37. if x==false then
  38. print("First Setup please fill in all of it and remember it!")
  39. pw=0;pw1=1
  40. while pw1~=pw do
  41. write("Password: ")  --think of a way to atleast cover the pw(maybe 100 dir and in one rdm )there is the pw
  42. pw=read()
  43. write("Retype Password: ")
  44. pw1=read()
  45. shell.run("clear")
  46. print("SKIPP3Rs B00TM3NU")
  47. end
  48. repeat
  49. write("Official (o)/Unofficial (u)")
  50. offic=read()
  51. if offic=="o" then
  52. lekey=1
  53. else if offic=="u" then
  54. lekey=1
  55. else
  56. lekey=0
  57. end
  58. end
  59. until lekey==1
  60. if offic=="o" then
  61. write("Preferred Domaimname: ")
  62. dmnm=read()
  63. resid=rednet.lookup("Resolver","Resolver")
  64. else
  65. end
  66. --insecure!!!!
  67.  h= fs.open("serverstuff/Password", "w")
  68. h.write(pw)
  69. h.close()
  70.  h=fs.open("serverstuff/OfficialLVL", "w")
  71. if offic=="o" then
  72. h.write("official")
  73. h.close()
  74.  h=fs.open("serverstuff/ResolverID", "w")
  75. h.write(resid)
  76. h.close()
  77.  h= fs.open("serverstuff/PrefDom", "w")
  78. h.write(dmnm)
  79. h.close()
  80. else if offic=="u" then
  81. h.write("unofficial")
  82. h.close()
  83. end
  84. end
  85. --damn girl that was "special"
  86. shell.run("clear")
  87. print("SKIPP3Rs Bootmenu")
  88. if offic=="o" then
  89. rednet.host("Server",dmnm)
  90. rednet.send(resid,"9aa1b03934893d7134a660af4204f2a9")
  91. sleep(0.05)
  92. rednet.send(resid,dmnm)
  93. sleep(3)
  94. else
  95. end
  96. os.reboot()
  97. else
  98. shell.run("clear")
  99. print("SKIPP3Rs S3RV3R")
  100.  h=fs.open("serverstuff/Password", "r")
  101. Pw=h.readAll()
  102. h.close()
  103.  h=fs.open("serverstuff/OfficialLVL", "r")
  104. Offic=h.readAll()
  105. h.close()
  106.  index=fs.open("serverstuff/sides/index", "a")
  107. if Offic=="official" then
  108.  h=fs.open("serverstuff/ResolverID", "r")
  109. Resolver=h.readAll()
  110. h.close()
  111.  h=fs.open("serverstuff/PrefDom", "r")
  112. PrefDom=h.readAll()
  113. h.close()
  114. else
  115. end
  116. end
  117. eing=0
  118. while eing~=Pw do
  119. write("Password: ")
  120. eing=read("*")
  121. print("Wrong")
  122. end
  123. shell.run("clear")
  124. print("SKIPP3Rs S3RV3R v0.2")
  125. print("Type 'help' for a list of commands")
  126. repeat
  127. write(":> ")
  128. com=read()
  129. if com=="new" then
  130. indexnam="index"
  131. while indexnam=="index"do
  132. write("indexed y/n: ")
  133. inde=read()
  134. if inde=="y" then
  135. write("Name the side: ")
  136. indexnam=read()
  137. index.writeLine(indexnam)
  138. index.flush()
  139. else
  140. write("Name of the side: ")
  141. indexnam=read()
  142. end
  143. end
  144. a=1
  145. side="serverstuff/sides/"..indexnam
  146. shell.run("clear")
  147. print("SKIPP3Rs S3RV3R")
  148. sid=fs.open(side, "w")
  149. while a~=18 do --look how many lines the hold
  150. write("")
  151. infsi=read()
  152. sid.writeLine(infsi)
  153. sid.flush()
  154. a=a+1
  155. end
  156. shell.run("clear")
  157. print("SKIPP3Rs server")
  158. print("File Saved")
  159. sid.close()
  160. else
  161. if com=="display" then
  162. write("Name of the side u want to display: ")
  163. file=read()
  164. file="serverstuff/sides/"..file
  165.  fil=fs.open(file, "r")
  166. inhalt=fil.readAll()
  167. print(inhalt)
  168. fil.close()
  169. else
  170. if com=="list" then
  171. local FileList = fs.list("serverstuff/sides/")
  172. for _, file in ipairs(FileList) do
  173.   print(file)
  174. end
  175. else
  176. if com=="delete" then
  177. write("Name the side u want to delete: ")
  178. file=read()
  179. if file~="index" then
  180. file="rm serverstuff/sides/"..file
  181. shell.run(file) --watcha here
  182. end
  183. else
  184. if com=="reboot" then
  185. os.reboot()
  186. else
  187. if com=="shutdown" then
  188. os.shutdown()
  189. else
  190. if com=="run" then
  191. write("rly want to set this online? y/n: ")
  192. yn=read()
  193. if yn=="y" then
  194. onlinekey=1
  195. else
  196. end
  197. else
  198. print("Commands: help, new, delete, display, list, reboot, shutdown, run")
  199. end
  200. end
  201. end
  202. end
  203. end
  204. end
  205. end
  206. until onlinekey==1
  207. logs=fs.open("serverstuff/log", "a")
  208. eing=0
  209. shell.run("clear")
  210. while eing~=Pw do
  211. write("Password: ")
  212. eing=read("*")
  213. end
  214. if Offic=="official" then
  215. rednet.host("Server",PrefDom)
  216. else
  217. end
  218. shell.run("clear")
  219. repeat
  220. id,msg=rednet.receive()
  221. local time = os.time()
  222. local tima = textutils.formatTime(time, true)
  223. logs.writeLine(tima..": "..id..": "..msg)
  224. print(tima..": "..id..": "..msg)
  225. logs.flush()
  226. stbr="serverstuff/sides/"..msg                          --side to be requested
  227. x=fs.exists(stbr)
  228. if x == true then
  229. h=fs.open(stbr, "r")
  230. req=h.readAll()
  231. h.close()
  232. sleep(0.05)
  233. rednet.send(id,req)
  234. else
  235. rednet.send(id,"This Page doesnt exists!")
  236. end
  237. until onlinekey==1337
Advertisement
Add Comment
Please, Sign In to add comment