From: michael Date: Tue, 17 Mar 2015 18:44:34 +0000 (+0000) Subject: - Added 'protocols' command which dumps a list of configured scanners and their assoc... X-Git-Tag: 1.0.4~3 X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=2d89b3fabd7588bee0b8a35ffe33a13d44466755;p=hopm.git - 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/branches/1.0.x@5713 82007160-df01-0410-b94d-b575c5fd34c7 --- diff --git a/NEWS b/NEWS index bec9343..eedce76 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ -- Noteworthy changes in version 1.0.4 (2015-??-??) o) Log timestamp format is ISO8601 now +o) Added 'protocols' command which dumps a list of configured scanners + and their associated protocols/ports to a channel -- Noteworthy changes in version 1.0.3 (2015-01-28) 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); + } + } +}