mod_portcheck/mod_portcheck.lua
author aidan@jmad.org
Sun, 25 Feb 2024 18:20:04 -0800
changeset 5880 c5df6d53f17f
parent 4905 3abbcb8584d2
permissions -rw-r--r--
mod_lastlog2: Fix typo from original copy-paste

module:set_global();
local portmanager = require "core.portmanager";

local commands = module:shared("admin_shell/commands")

function commands.portcheck(session, line)
	for desc, interface, port in line:gmatch("%s(%[?([%x:.*]+)%]?:(%d+))") do
		assert(portmanager.get_service_at(interface, tonumber(port)), desc);
	end
	session.print "OK";
end

function module.unload()
	commands.portcheck = nil;
end