From 110d5e0a9b9ac5f5348fab2a2616f46f20505f1e Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 17 Mar 2015 18:43:27 +0000 Subject: [PATCH] - Added 'protocols' command which dumps a list of configured scanners and their associated protocols/ports to a channel git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5712 82007160-df01-0410-b94d-b575c5fd34c7 --- README | 4 +++- src/opercmd.c | 34 +++++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/README b/README index e8a3dc1..5daeb15 100644 --- a/README +++ b/README @@ -70,7 +70,9 @@ botnick check [scanner] -- Manually scan host for insecure proxies and o botnick stats -- Output scan stats, uptime and client connection count. -botnick fdstat -- Output some into about file descriptors in use. +botnick fdstat -- Output some info about file descriptors in use. + +botnick protocols -- Output configured scanners and their associated protocols/ports. Also if several HOPMs are present in one channel they will all respond to !all, for example !all stats. diff --git a/src/opercmd.c b/src/opercmd.c index 80babcd..18a13d3 100644 --- a/src/opercmd.c +++ b/src/opercmd.c @@ -46,16 +46,18 @@ static void command_free(struct Command *); static void cmd_check(char *, const struct ChannelConf *); static void cmd_stat(char *, const struct ChannelConf *); static void cmd_fdstat(char *, const struct ChannelConf *); +static void cmd_protocols(char *, const struct ChannelConf *); static const struct OperCommandHash COMMAND_TABLE[] = { - { "CHECK", cmd_check }, - { "SCAN", cmd_check }, - { "STAT", cmd_stat }, - { "STATS", cmd_stat }, - { "STATUS", cmd_stat }, - { "FDSTAT", cmd_fdstat }, - { NULL, NULL } + { "CHECK", cmd_check }, + { "SCAN", cmd_check }, + { "STAT", cmd_stat }, + { "STATS", cmd_stat }, + { "STATUS", cmd_stat }, + { "FDSTAT", cmd_fdstat }, + { "PROTOCOLS", cmd_fdstat }, + { NULL, NULL } }; @@ -331,3 +333,21 @@ cmd_fdstat(char *param, const struct ChannelConf *target) { fdstats_output(target->name); } + +static void +cmd_protocols(char *param, const struct ChannelConf *target) +{ + node_t *node, *node2; + + LIST_FOREACH(node, ScannerItemList->head) + { + const struct ScannerConf *sc = node->data; + irc_send("PRIVMSG %s :Scanner: '%s'", target->name, sc->name); + + LIST_FOREACH(node2, sc->protocols->head) + { + const struct ProtocolConf *proto = node2->data; + irc_send("PRIVMSG %s : %s:%d", target->name, scan_gettype(proto->type), proto->port); + } + } +} -- 2.30.2