-
-
Save exzhawk/15aa572604eeb317ef05ab43906facce to your computer and use it in GitHub Desktop.
Primitive remote code execution via OC network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local m=component.proxy(component.list("modem")()) | |
m.open(2412) | |
local function respond(...) | |
local args=table.pack(...) | |
pcall(function() m.broadcast(2412, table.unpack(args)) end) | |
end | |
local function receive() | |
while true do | |
local evt,_,_,_,_,cmd=computer.pullSignal() | |
if evt=="modem_message" then return load(cmd) end | |
end | |
end | |
while true do | |
local result,reason=pcall(function() | |
local result,reason=receive() | |
if not result then return respond(reason) end | |
respond(result()) | |
end) | |
if not result then respond(reason) end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local component = require("component") | |
local event = require("event") | |
local modem = component.modem | |
modem.open(2412) | |
modem.broadcast(2412, "drone=component.proxy(component.list('drone')())") | |
while true do | |
local cmd=io.read() | |
if not cmd then return end | |
modem.broadcast(2412, cmd) | |
print(select(6, event.pull(5, "modem_message"))) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment