From 5218ea08926cf3288323dfa6efc0a93df115fa8d Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Thu, 30 Jan 2025 08:27:57 -0800 Subject: [PATCH] snotes --- snote.cpp | 21 +++++++++++++++++---- snote.hpp | 48 ++++++++++++++++++++++++++---------------------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/snote.cpp b/snote.cpp index d68caee..bed7a60 100644 --- a/snote.cpp +++ b/snote.cpp @@ -68,9 +68,15 @@ const SnotePattern static patterns[] = { {SnoteTag::PossibleFlooder, R"(^Possible Flooder ([^ ]+)\[([^ ]+)@[^ ]+\] on ([^ ]+) target: ([^ ]+)$)"}, - {SnoteTag::Killed, + {SnoteTag::KilledRemote, R"(^Received KILL message for ([^ ]+)!([^ ]+)@([^ ]+)\. From ([^ ]+) Path: ([^ ]+) \((.*)\)$)"}, + {SnoteTag::KilledRemoteOper, + R"(^Received KILL message for ([^ ]+)!([^ ]+)@([^ ]+)\. From ([^ ]+) Path: ([^ ]+)!([^ ]+)!([^ ]+)!([^ ]+) (.*)$)"}, + + {SnoteTag::Killed, + R"(^Received KILL message for ([^ ]+)!([^ ]+)@([^ ]+)\. From ([^ ]+) (.*)$)"}, + {SnoteTag::TooManyGlobalConnections, R"(^Too many global connections for ([^ ]+)\[([^ ]+)@([^ ]+)\] \[(.*)\]$)"}, @@ -102,7 +108,7 @@ const SnotePattern static patterns[] = { R"(^Nick collision due to services forced nick change on ([^ ]+)$)"}, {SnoteTag::NickCollision, - R"(^Nick collision on ([^ ]+)\(([^ ]+) <- ([^ ]+)\)\(([^ ]+) <- ([^ ]+)\)\(([^ ]+)\)$)"}, + R"(^Nick collision on ([^ ]+)\(([^ ]+) <- ([^ ]+)\)\(([^ ]+)\)$)"}, {SnoteTag::TemporaryDline, R"(^([^ ]+) added temporary ([^ ]+) min\. D-Line for \[([^ ]+)\] \[(.*)\]$)"}, @@ -123,7 +129,14 @@ const SnotePattern static patterns[] = { R"(^Failed CHALLENGE attempt - missing SSL/TLS by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"}, {SnoteTag::FailedChallengeFingerprintMismatch, - R"(^Failed CHALLENGE attempt - client certificate fingerprint mismatch by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"} + R"(^Failed CHALLENGE attempt - client certificate fingerprint mismatch by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"}, + + {SnoteTag::SighupReloadingConf, + R"(^Got signal SIGHUP, reloading ircd conf\. file$)"}, + + {SnoteTag::JoinedJuped, + R"(^User ([^ ]+) \(([^ ]+)@([^ ]+)\) is attempting to join locally juped channel ([^ ]+) \((.*)\)$)"}, + }; static auto setup_database() -> hs_database_t * @@ -148,7 +161,7 @@ static auto setup_database() -> hs_database_t * switch (hs_compile_multi(expressions.data(), flags.data(), ids.data(), expressions.size(), HS_MODE_BLOCK, platform, &db, &error)) { case HS_COMPILER_ERROR: { - std::string msg = error->message; + std::string msg = std::to_string(error->expression) + ": " + error->message; hs_free_compile_error(error); throw std::runtime_error{std::move(msg)}; } diff --git a/snote.hpp b/snote.hpp index 81cff91..ab12f6c 100644 --- a/snote.hpp +++ b/snote.hpp @@ -16,35 +16,39 @@ enum class SnoteTag { ClientConnecting, ClientExiting, - RejectingKlined, - NickChange, CreateChannel, - TemporaryKlineExpired, - PropagatedBanExpired, DisconnectingKlined, - NewPropagatedKline, - NewTemporaryKline, - LoginAttempts, - PossibleFlooder, - Killed, - TooManyGlobalConnections, - TooManyUserConnections, - SetVhostOnMarkedAccount, - IsNowOper, - NickCollision, - OperspyWhois, - Freeze, - Spambot, + DroppedChannel, FailedChallenge, + FailedChallengeFingerprintMismatch, FailedChallengeHostMismatch, + FailedChallengeMissingSecure, FailedChallengeNoBlock, FailedChallengeTls, - FailedChallengeFingerprintMismatch, - FailedChallengeMissingSecure, - SaveMessage, + Freeze, + IsNowOper, + JoinedJuped, + Killed, + KilledRemote, + KilledRemoteOper, + LoginAttempts, + NewPropagatedKline, + NewTemporaryKline, + NickChange, + NickCollision, NickCollisionServices, - DroppedChannel, - TemporaryDline + OperspyWhois, + PossibleFlooder, + PropagatedBanExpired, + RejectingKlined, + SaveMessage, + SetVhostOnMarkedAccount, + SighupReloadingConf, + Spambot, + TemporaryDline, + TemporaryKlineExpired, + TooManyGlobalConnections, + TooManyUserConnections, }; class SnoteMatch