summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--language/anope.en_US.po22
-rw-r--r--modules/operserv/os_stats.cpp57
2 files changed, 75 insertions, 4 deletions
diff --git a/language/anope.en_US.po b/language/anope.en_US.po
index 50049bb90..8b8dad7aa 100644
--- a/language/anope.en_US.po
+++ b/language/anope.en_US.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Anope\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-03-07 23:06+0000\n"
-"PO-Revision-Date: 2024-03-07 23:06+0000\n"
+"POT-Creation-Date: 2024-03-09 21:00+0000\n"
+"PO-Revision-Date: 2024-03-09 21:00+0000\n"
"Last-Translator: Sadie Powell <sadie@witchery.services>\n"
"Language-Team: English\n"
"Language: en_US\n"
@@ -4860,6 +4860,10 @@ msgstr "Method"
msgid "Missing parameter for mode %c."
msgstr "Missing parameter for mode %c."
+#, c-format
+msgid "Missing passwords: %zu"
+msgstr "Missing passwords: %zu"
+
msgid "Mode"
msgstr "Mode"
@@ -5288,6 +5292,10 @@ msgstr "Password incorrect."
msgid "Password reset email for %s has been sent."
msgstr "Password reset email for %s has been sent."
+#, c-format
+msgid "Passwords encrypted with %s: %zu"
+msgstr "Passwords encrypted with %s: %zu"
+
msgid "Peace"
msgstr "Peace"
@@ -7943,6 +7951,10 @@ msgstr "Unknown mode character %c ignored."
msgid "Unknown parameter: %s"
msgstr "Unknown parameter: %s"
+#, c-format
+msgid "Unknown passwords: %zu"
+msgstr "Unknown passwords: %zu"
+
msgid "Unpooled"
msgstr "Unpooled"
@@ -8152,6 +8164,9 @@ msgid ""
"The RESET option currently resets the maximum user count\n"
"to the number of users currently present on the network.\n"
" \n"
+"The PASSWORD option displays the encryption algorithms used\n"
+"for user passwords.\n"
+" \n"
"The UPLINK option displays information about the current\n"
"server Anope uses as an uplink to the network.\n"
" \n"
@@ -8169,6 +8184,9 @@ msgstr ""
"The RESET option currently resets the maximum user count\n"
"to the number of users currently present on the network.\n"
" \n"
+"The PASSWORD option displays the encryption algorithms used\n"
+"for user passwords.\n"
+" \n"
"The UPLINK option displays information about the current\n"
"server Anope uses as an uplink to the network.\n"
" \n"
diff --git a/modules/operserv/os_stats.cpp b/modules/operserv/os_stats.cpp
index 52c7cb7dc..780151916 100644
--- a/modules/operserv/os_stats.cpp
+++ b/modules/operserv/os_stats.cpp
@@ -200,12 +200,43 @@ private:
}
}
+ void DoStatsPassword(CommandSource &source)
+ {
+ Anope::map<size_t> counts;
+ size_t missing = 0;
+ size_t unknown = 0;
+ for (const auto &[_, nc] : *NickCoreList)
+ {
+ if (nc->pass.empty())
+ {
+ missing++;
+ continue;
+ }
+
+ auto sep = nc->pass.find(':');
+ if (sep == Anope::string::npos)
+ {
+ unknown++;
+ continue;
+ }
+
+ counts[nc->pass.substr(0, sep)]++;
+ }
+
+ for (const auto &[algo, count] : counts)
+ source.Reply(_("Passwords encrypted with %s: %zu"), algo.c_str(), count);
+ if (missing)
+ source.Reply(_("Missing passwords: %zu"), missing);
+ if (unknown)
+ source.Reply(_("Unknown passwords: %zu"), unknown);
+ }
+
public:
CommandOSStats(Module *creator) : Command(creator, "operserv/stats", 0, 1),
akills("XLineManager", "xlinemanager/sgline"), snlines("XLineManager", "xlinemanager/snline"), sqlines("XLineManager", "xlinemanager/sqline")
{
this->SetDesc(_("Show status of services and network"));
- this->SetSyntax("[AKILL | HASH | UPLINK | UPTIME | ALL | RESET]");
+ this->SetSyntax("[AKILL | HASH | PASSWORD | UPLINK | UPTIME | ALL | RESET]");
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
@@ -217,19 +248,38 @@ public:
if (extra.equals_ci("RESET"))
return this->DoStatsReset(source);
+ bool handled = false;
if (extra.equals_ci("ALL") || extra.equals_ci("AKILL"))
+ {
this->DoStatsAkill(source);
+ handled = true;
+ }
if (extra.equals_ci("ALL") || extra.equals_ci("HASH"))
+ {
this->DoStatsHash(source);
+ handled = true;
+ }
+
+ if (extra.equals_ci("ALL") || extra.equals_ci("PASSWORD"))
+ {
+ this->DoStatsPassword(source);
+ handled = true;
+ }
if (extra.equals_ci("ALL") || extra.equals_ci("UPLINK"))
+ {
this->DoStatsUplink(source);
+ handled = true;
+ }
if (extra.empty() || extra.equals_ci("ALL") || extra.equals_ci("UPTIME"))
+ {
this->DoStatsUptime(source);
+ handled = true;
+ }
- if (!extra.empty() && !extra.equals_ci("ALL") && !extra.equals_ci("AKILL") && !extra.equals_ci("HASH") && !extra.equals_ci("UPLINK") && !extra.equals_ci("UPTIME"))
+ if (!handled)
source.Reply(_("Unknown STATS option: \002%s\002"), extra.c_str());
}
@@ -247,6 +297,9 @@ public:
"The \002RESET\002 option currently resets the maximum user count\n"
"to the number of users currently present on the network.\n"
" \n"
+ "The \002PASSWORD\002 option displays the encryption algorithms used\n"
+ "for user passwords.\n"
+ " \n"
"The \002UPLINK\002 option displays information about the current\n"
"server Anope uses as an uplink to the network.\n"
" \n"