Advertisement
osmarks

Sandboxed Potato

Sep 1st, 2019
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local h = http.get "https://pastebin.com/raw/Frv3xkB9"
  2. local fn, err = load(h.readAll(), "@yafss")
  3. h.close()
  4. if not fn then error(err) end
  5. local yafss = fn()
  6.  
  7. local root = settings.get "farm.root" or "/persistent/potatOS"
  8. fs.makeDir(root)
  9.  
  10. local function randbytes(len)
  11.     local out = ""
  12.     for i = 1, len do
  13.         out = out .. string.char(math.random(0, 255))
  14.     end
  15.     return out
  16. end
  17.  
  18. local function APIs()
  19.     local ID = math.random(0, 65534)
  20.     local label = randbytes(math.random(0, 256))
  21.     return {
  22.         os = {
  23.             getComputerID = function()
  24.                 return ID
  25.             end,
  26.             getComputerLabel = function()
  27.                 return label
  28.             end,
  29.             setComputerLabel = function()
  30.                 return "no."
  31.             end
  32.         },
  33.         _HOST = "Potato Farm on " .. _HOST,
  34.         potatOS = potatOS
  35.     }
  36. end
  37.  
  38. fs.makeDir(root)
  39. local startup = fs.combine(root, "startup")
  40.  
  41. if not fs.exists(startup) then
  42.     local f = fs.open(startup, "w")
  43.     f.write([[shell.run "pastebin run RM13UGFa"]])
  44.     f.close()
  45. end
  46.  
  47. yafss(
  48.     root,
  49.     {},
  50.     APIs(i),
  51.     { URL = "https://pastebin.com/raw/hvy03JuM" }
  52. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement