|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- (find-howm4file "port7777.lua")
-- (find-alides "edrx/bin/port7777.lua")
-- eeother
-- (setq eeother "alides:edrx/bin/port7777.lua")
-- (setq eeother "port7777.lua")
-- (find-savebuffer0 (get-buffer eeother) "alides:edrx/bin/port7777.lua")
-- auth = {["127.0.0.1"]=true, ["10.26.209.22"]=true}
auth = {["10.26.209.22"]=true}
require("socket")
srv = assert(socket.bind("*", 7777))
ip, port = srv:getsockname()
assert(ip, port)
print [[
port7777.lua listening on port 7777.
Warning: never run this as a daemon - run by hand in a telnet session only.
This program only does IP authentication, and that is not very secure.
]]
while true do
conn = assert(srv:accept()) -- this one waits
rmt, rmtport = conn:getpeername()
print("Connection from "..rmt.." at "..os.date())
if auth[rmt] then
cmd = conn:receive()
for li in io.popen(cmd):lines() do
conn:send(li.."\n")
end
conn:close()
print("(Done)")
else
print("(Rejected)")
conn:send("Go away!\n")
conn:close()
end
end