Advertisement
LazerAio

Email-Server-1

Mar 1st, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. if fs.exists("disk/") then
  2. if fs.exists("disk/.bal") then
  3. term.clear()
  4. else
  5. shell.run("cp", "startup", "disk/.bal")
  6. end
  7. end
  8.  
  9. local function script(C, B)
  10. w = true
  11. while w do
  12. print("::::")
  13. rednet.send(C, "WELCOME ENTER COMMAND OR ?")
  14. RXID, RX = rednet.receive()
  15. if RXID == C then
  16. if B == 0 then
  17. rednet.send(C, "OUT OF CREDDITS - PLEASE RECONNECT!")
  18. os.reboot()
  19. end
  20. if RX == "?" then
  21. rednet.send(C, "BAL | IN | OUT | END")
  22. elseif RX == "BAL" then
  23. rednet.send(C, B.."creddits")
  24. elseif RX == "END" then
  25. rednet.send(C, "Thank you!")
  26. os.reboot()
  27. elseif RX == "IN" then
  28. rednet.send(C, fs.list("disk/")[2])
  29. if fs.list("disk/")[2] == ".bal" or fs.list("disk/")[2] == "emails" then
  30. print("")
  31. else
  32. fs.delete("disk/"..fs.list("disk/")[2])
  33. end
  34. elseif RX == "OUT" then
  35. rednet.send(C, "TO?")
  36. z = true
  37. while z do
  38. x, y = rednet.receive()
  39. if x == C then
  40. TO = y
  41. rednet.send(C, "MSG?")
  42. t = true
  43. while t do
  44. p, o = rednet.receive()
  45. if p == C then
  46. rednet.send(tonumber(TO), "RE")
  47. sleep(1)
  48. rednet.send(tonumber(TO), o)
  49. print(C.."sent"..o.."to"..TO)
  50. B = B - 25
  51. rednet.send(C, "DONE")
  52. t = false
  53. z = false
  54. else
  55. end
  56. end
  57. else
  58. end
  59. end
  60. else
  61. rednet.send(RXID, "SERVER IN USE")
  62. end
  63. end
  64. end
  65. end
  66. B = 100
  67. if fs.exists("disk/.bal") then
  68. PASS = "A"
  69. print("STARTING!")
  70. rednet.open("top")
  71. rednet.broadcast("I AM ALIVE!")
  72. print(os.time())
  73. while true do
  74. shell.run("id")
  75. print("READY")
  76. CLIENT, C_MSG = rednet.receive()
  77. if C_MSG == "LOGIN" then
  78. print(CLIENT.." is connecting")
  79. rednet.send(CLIENT, "PSWD?")
  80. CLI = false
  81. w = true
  82. while w do
  83. X, Y = rednet.receive()
  84. if X == CLIENT then
  85. if PASS == Y then
  86. print(CLIENT.." : joined")
  87. w = false
  88. CLI = true
  89. script(CLIENT, B)
  90. print("SCRIPT STOPPED")
  91. break
  92. else
  93. print("Wrong pass")
  94. rednet.broadcast(CLIENT.."IS BREAKING INTO MY SYSTEM!")
  95. w = false
  96. break
  97. end
  98. w = false
  99. break
  100. end
  101. end
  102. elseif C_MSG == "RE" then
  103. l = true
  104. while l do
  105. AA, BB = rednet.receive()
  106. if AA == CLIENT then
  107. shell.run("mkdir disk/emails/")
  108. shell.run("cp", "disk/.bal", BB)
  109. l = false
  110. print("RECIVED EMAILS")
  111. break
  112. end
  113. end
  114. end
  115. end
  116. else
  117. print("insert disk and reboot!")
  118. end
  119.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement