more snotes
This commit is contained in:
parent
8d544e31de
commit
0e88f3bd7a
@ -29,10 +29,9 @@ auto Challenge::on_ircmsg(IrcCommand cmd, const IrcMsg &msg) -> void {
|
||||
break;
|
||||
case IrcCommand::RPL_YOUREOPER:
|
||||
slot_.disconnect();
|
||||
BOOST_LOG_TRIVIAL(error) << "Challenge: Already oper";
|
||||
connection_.send_ping("mitigation");
|
||||
break;
|
||||
case IrcCommand::RPL_ENDOFRSACHALLENGE2:
|
||||
slot_.disconnect();
|
||||
finish_challenge();
|
||||
break;
|
||||
}
|
||||
@ -81,7 +80,7 @@ auto Challenge::finish_challenge() -> void
|
||||
mybase64::encode(std::string_view{(char*)digest, digestlen}, buffer_.data() + 1);
|
||||
|
||||
connection_.send_challenge(buffer_);
|
||||
connection_.send_ping("oper_up mitigation");
|
||||
buffer_.clear();
|
||||
}
|
||||
|
||||
auto Challenge::start(Connection &connection, const std::string_view user, EVP_PKEY_Ref ref) -> std::shared_ptr<Challenge>
|
||||
|
@ -126,7 +126,6 @@ public:
|
||||
template <typename... Ts>
|
||||
class Wait
|
||||
{
|
||||
|
||||
// State associated with each wait mode
|
||||
std::tuple<Ts...> modes_;
|
||||
|
||||
|
5
main.cpp
5
main.cpp
@ -9,6 +9,7 @@
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/log/expressions.hpp>
|
||||
|
||||
#include <openssl/pem.h>
|
||||
|
||||
@ -60,6 +61,9 @@ static auto start(boost::asio::io_context &io, const Settings &settings) -> void
|
||||
|
||||
bot->sig_command.connect([connection](const Command &cmd) {
|
||||
std::cout << "COMMAND " << cmd.command << " from " << cmd.account << std::endl;
|
||||
if (cmd.oper == "glguy" && cmd.command == "ping") {
|
||||
connection->send_notice("glguy", cmd.arguments);
|
||||
}
|
||||
});
|
||||
|
||||
connection->start({
|
||||
@ -87,6 +91,7 @@ static auto get_settings(const char *filename) -> Settings
|
||||
|
||||
auto main(int argc, char *argv[]) -> int
|
||||
{
|
||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::warning);
|
||||
if (argc != 2) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Bad arguments";
|
||||
return 1;
|
||||
|
47
snote.cpp
47
snote.cpp
@ -17,7 +17,7 @@ namespace {
|
||||
|
||||
struct SnotePattern
|
||||
{
|
||||
SnotePattern(SnoteTag tag, const char *expression, unsigned flags = 0)
|
||||
SnotePattern(SnoteTag tag, const char *expression)
|
||||
: tag{tag}
|
||||
, expression{expression}
|
||||
, regex{expression, std::regex_constants::ECMAScript | std::regex_constants::optimize}
|
||||
@ -29,6 +29,8 @@ struct SnotePattern
|
||||
std::regex regex;
|
||||
};
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
const SnotePattern static patterns[] = {
|
||||
{SnoteTag::ClientConnecting,
|
||||
R"(^Client connecting: ([^ ]+) \(([^@ ]+)@([^) ]+)\) \[(.*)\] \{([^ ]*)\} <([^ ]*)> \[(.*)\]$)"},
|
||||
@ -72,23 +74,56 @@ const SnotePattern static patterns[] = {
|
||||
{SnoteTag::TooManyGlobalConnections,
|
||||
R"(^Too many global connections for ([^ ]+)\[([^ ]+)@([^ ]+)\] \[(.*)\]$)"},
|
||||
|
||||
{SnoteTag::TooManyUserConnections,
|
||||
R"(^Too many user connections for ([^ ]+)\[([^ ]+)@([^ ]+)\] \[(.*)\]$)"},
|
||||
|
||||
{SnoteTag::SetVhostOnMarkedAccount,
|
||||
"^\x02([^ ]+)\x02 set vhost ([^ ]+) on the \x02MARKED\x02 account ([^ ]+).$"},
|
||||
|
||||
{SnoteTag::IsNowOper,
|
||||
R"(^([^ ]+) \(([^ ]+)!([^ ]+)@([^ ]+)\) is now an operator$)"},
|
||||
|
||||
{SnoteTag::NickCollision,
|
||||
R"(^Nick collision due to services forced nick change on ([^ ]+)$)"},
|
||||
|
||||
{SnoteTag::OperspyWhois,
|
||||
R"(^OPERSPY ([^ ]+)!([^ ]+)@([^ ]+)\{([^ ]+)\} WHOIS ([^ ]+)!([^ ]+)@([^ ]+) ([^ ]+)$)"},
|
||||
|
||||
{SnoteTag::Freeze,
|
||||
R"(^([^ ]+) froze the account ([^ ]+) \((.*)\)\.$)"},
|
||||
"^\x02([^ ]+)\x02 froze the account \x02([^ ]+)\x02 \\((.*)\\)\\.$"},
|
||||
|
||||
{SnoteTag::DroppedChannel,
|
||||
"^\x02([^ ]+)\x02 dropped the channel \x02([^ ]+)\x02$"},
|
||||
|
||||
{SnoteTag::Spambot,
|
||||
R"(User ([^ ]+) \(([^ ]+)@([^ ]+)\) trying to join ([^ ]+) is a possible spambot)"},
|
||||
R"(^User ([^ ]+) \(([^ ]+)@([^ ]+)\) trying to join ([^ ]+) is a possible spambot$)"},
|
||||
|
||||
{SnoteTag::SaveMessage,
|
||||
R"(^Received SAVE message for ([^ ]+) from ([^ ]+)$)"},
|
||||
|
||||
{SnoteTag::NickCollisionServices,
|
||||
R"(^Nick collision due to services forced nick change on ([^ ]+)$)"},
|
||||
|
||||
{SnoteTag::NickCollision,
|
||||
R"(^Nick collision on ([^ ]+)\(([^ ]+) <- ([^ ]+)\)\(([^ ]+) <- ([^ ]+)\)\(([^ ]+)\)$)"},
|
||||
|
||||
{SnoteTag::TemporaryDline,
|
||||
R"(^([^ ]+) added temporary ([^ ]+) min\. D-Line for \[([^ ]+)\] \[(.*)\]$)"},
|
||||
|
||||
{SnoteTag::FailedChallengeMissingSecure,
|
||||
R"(^Failed CHALLENGE attempt - missing secure connection by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"},
|
||||
|
||||
{SnoteTag::FailedChallenge,
|
||||
R"(^Failed CHALLENGE attempt by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"},
|
||||
|
||||
{SnoteTag::FailedChallengeHostMismatch,
|
||||
R"(^Failed CHALLENGE attempt - host mismatch by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"},
|
||||
|
||||
{SnoteTag::FailedChallengeNoBlock,
|
||||
R"(^Failed CHALLENGE attempt - user@host mismatch or no operator block for ([^ ]+) by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"},
|
||||
|
||||
{SnoteTag::FailedChallengeTls,
|
||||
R"(^Failed CHALLENGE attempt - missing SSL/TLS by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"},
|
||||
|
||||
{SnoteTag::FailedChallengeFingerprintMismatch,
|
||||
R"(^Failed CHALLENGE attempt - client certificate fingerprint mismatch by ([^ ]+) \(([^ ]+)@([^ ]+)\)$)"}
|
||||
};
|
||||
|
||||
static auto setup_database() -> hs_database_t *
|
||||
|
11
snote.hpp
11
snote.hpp
@ -28,12 +28,23 @@ enum class SnoteTag
|
||||
PossibleFlooder,
|
||||
Killed,
|
||||
TooManyGlobalConnections,
|
||||
TooManyUserConnections,
|
||||
SetVhostOnMarkedAccount,
|
||||
IsNowOper,
|
||||
NickCollision,
|
||||
OperspyWhois,
|
||||
Freeze,
|
||||
Spambot,
|
||||
FailedChallenge,
|
||||
FailedChallengeHostMismatch,
|
||||
FailedChallengeNoBlock,
|
||||
FailedChallengeTls,
|
||||
FailedChallengeFingerprintMismatch,
|
||||
FailedChallengeMissingSecure,
|
||||
SaveMessage,
|
||||
NickCollisionServices,
|
||||
DroppedChannel,
|
||||
TemporaryDline
|
||||
};
|
||||
|
||||
class SnoteMatch
|
||||
|
Loading…
x
Reference in New Issue
Block a user