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,
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)};
}

View File

@ -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