This commit is contained in:
Eric Mertens 2025-01-30 08:27:57 -08:00
parent 0e88f3bd7a
commit 5218ea0892
2 changed files with 43 additions and 26 deletions

View File

@ -68,9 +68,15 @@ const SnotePattern static patterns[] = {
{SnoteTag::PossibleFlooder, {SnoteTag::PossibleFlooder,
R"(^Possible Flooder ([^ ]+)\[([^ ]+)@[^ ]+\] on ([^ ]+) target: ([^ ]+)$)"}, R"(^Possible Flooder ([^ ]+)\[([^ ]+)@[^ ]+\] on ([^ ]+) target: ([^ ]+)$)"},
{SnoteTag::Killed, {SnoteTag::KilledRemote,
R"(^Received KILL message for ([^ ]+)!([^ ]+)@([^ ]+)\. From ([^ ]+) Path: ([^ ]+) \((.*)\)$)"}, 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, {SnoteTag::TooManyGlobalConnections,
R"(^Too many global connections for ([^ ]+)\[([^ ]+)@([^ ]+)\] \[(.*)\]$)"}, R"(^Too many global connections for ([^ ]+)\[([^ ]+)@([^ ]+)\] \[(.*)\]$)"},
@ -102,7 +108,7 @@ const SnotePattern static patterns[] = {
R"(^Nick collision due to services forced nick change on ([^ ]+)$)"}, R"(^Nick collision due to services forced nick change on ([^ ]+)$)"},
{SnoteTag::NickCollision, {SnoteTag::NickCollision,
R"(^Nick collision on ([^ ]+)\(([^ ]+) <- ([^ ]+)\)\(([^ ]+) <- ([^ ]+)\)\(([^ ]+)\)$)"}, R"(^Nick collision on ([^ ]+)\(([^ ]+) <- ([^ ]+)\)\(([^ ]+)\)$)"},
{SnoteTag::TemporaryDline, {SnoteTag::TemporaryDline,
R"(^([^ ]+) added temporary ([^ ]+) min\. D-Line for \[([^ ]+)\] \[(.*)\]$)"}, R"(^([^ ]+) added temporary ([^ ]+) min\. D-Line for \[([^ ]+)\] \[(.*)\]$)"},
@ -123,7 +129,14 @@ const SnotePattern static patterns[] = {
R"(^Failed CHALLENGE attempt - missing SSL/TLS by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"}, R"(^Failed CHALLENGE attempt - missing SSL/TLS by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"},
{SnoteTag::FailedChallengeFingerprintMismatch, {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 * 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)) switch (hs_compile_multi(expressions.data(), flags.data(), ids.data(), expressions.size(), HS_MODE_BLOCK, platform, &db, &error))
{ {
case HS_COMPILER_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); hs_free_compile_error(error);
throw std::runtime_error{std::move(msg)}; throw std::runtime_error{std::move(msg)};
} }

View File

@ -16,35 +16,39 @@ enum class SnoteTag
{ {
ClientConnecting, ClientConnecting,
ClientExiting, ClientExiting,
RejectingKlined,
NickChange,
CreateChannel, CreateChannel,
TemporaryKlineExpired,
PropagatedBanExpired,
DisconnectingKlined, DisconnectingKlined,
NewPropagatedKline, DroppedChannel,
NewTemporaryKline,
LoginAttempts,
PossibleFlooder,
Killed,
TooManyGlobalConnections,
TooManyUserConnections,
SetVhostOnMarkedAccount,
IsNowOper,
NickCollision,
OperspyWhois,
Freeze,
Spambot,
FailedChallenge, FailedChallenge,
FailedChallengeFingerprintMismatch,
FailedChallengeHostMismatch, FailedChallengeHostMismatch,
FailedChallengeMissingSecure,
FailedChallengeNoBlock, FailedChallengeNoBlock,
FailedChallengeTls, FailedChallengeTls,
FailedChallengeFingerprintMismatch, Freeze,
FailedChallengeMissingSecure, IsNowOper,
SaveMessage, JoinedJuped,
Killed,
KilledRemote,
KilledRemoteOper,
LoginAttempts,
NewPropagatedKline,
NewTemporaryKline,
NickChange,
NickCollision,
NickCollisionServices, NickCollisionServices,
DroppedChannel, OperspyWhois,
TemporaryDline PossibleFlooder,
PropagatedBanExpired,
RejectingKlined,
SaveMessage,
SetVhostOnMarkedAccount,
SighupReloadingConf,
Spambot,
TemporaryDline,
TemporaryKlineExpired,
TooManyGlobalConnections,
TooManyUserConnections,
}; };
class SnoteMatch class SnoteMatch