- Added 'protocols' command which dumps a list of configured scanners and their assoc...
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 17 Mar 2015 18:44:34 +0000 (18:44 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 17 Mar 2015 18:44:34 +0000 (18:44 +0000)
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.0.x@5713 82007160-df01-0410-b94d-b575c5fd34c7

NEWS
README
src/opercmd.c

diff --git a/NEWS b/NEWS
index bec93435895dde16d32f00b2f0764a304812164c..eedce766253f19fb80aa16fc33e75dffad9c9d36 100644 (file)
--- 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 e8a3dc1e360aae92ff8c9afe437da2dcde6e4fe9..5daeb15e36f912080846668b804ac1909c3be829 100644 (file)
--- a/README
+++ b/README
@@ -70,7 +70,9 @@ botnick check <host> [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.
index 80babcd2419a1374abe95ceb2b7f007ca103d040..18a13d36c09fec7e950973f3e5f018f2eca2fc73 100644 (file)
@@ -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);
+    }
+  }
+}