Advertisement
cul8ter

rsh_server.lua

Oct 1st, 2023
1,267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. local ot=term
  2. local nt={}
  3. local mod=peripheral.find("modem")
  4. mod.open(545)
  5. local function call_remote(k,...)
  6.     args={...}
  7.     mod.transmit(555,545,{"NSA",k,args})
  8. end
  9. for k,v in pairs(term) do
  10.     nt[k]=function(...) call_remote(k,...) return ot[k](...) end
  11.     print("Hooked: "..k)
  12.     os.sleep(0)
  13. end
  14. _G.term=nt
  15. nt.clear()
  16. nt.setCursorPos(1,1)
  17. local oldf=_G.os.pullEventRaw
  18. _G.os.pullEventRaw=function()
  19.     local name,a,b,c,d,e=oldf()
  20.     if name=="modem_message" then
  21.         if b==545 then
  22.             if d[3]~=_G.tmp then
  23.                 _G.tmp=d[3]
  24.                 os.queueEvent(d[1],d[2])
  25.             end
  26.         end
  27.     end
  28.     return name,a,b,c,d,e
  29. end
  30. shell.run("sh")
  31. _G.term=ot
  32. _G.os.pullEventRaw=oldf
  33. print("exited")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement