Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
siniStar7 committed Oct 13, 2024
2 parents 79659cf + f594d74 commit 7cab541
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-v4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Get changed modules
id: changed-modules
uses: tj-actions/changed-files@v44
uses: tj-actions/changed-files@v45
with:
files: 4/*.cpp
path: contrib
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/regen-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
- push
jobs:
build:
if: github.repository == 'inspircd/inspircd-contrib'
if: github.repository == 'inspircd/inspircd-contrib' && github.ref_name == 'master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 3 additions & 1 deletion 3/m_upgradecheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ class ModuleUpgradeCheck CXX11_FINAL
CheckModule("hostchange", "moved to inspircd-contrib");
CheckModule("lockserv", "moved to inspircd-contrib");
CheckModule("modenotice", "moved to inspircd-contrib");
CheckModule("regex_pcre", "moved to inspircd-contrib");
CheckModule("regex_tre", "moved to inspircd-contrib");
CheckModule("ssl_mbedtls", "moved to inspircd-contrib");
CheckModule("userip", "moved to inspircd-contrib");
CheckNoValue("class", "snomasks", "no longer defaults to *");
CheckTag("power", "replaced with oper command privs");
CheckTag("hostchange", "replaced with the cloak_user and cloak_static <cloak> methods");
CheckTag("power", "replaced with oper command privs");
CheckValue("bind", "sslprofile", "gnutls", "ssl config moved from <gnutls> to <sslprofile>");
CheckValue("bind", "sslprofile", "mbedtls", "ssl config moved from <mbedtls> to <sslprofile>");
CheckValue("bind", "sslprofile", "openssl", "ssl config moved from <openssl> to <sslprofile>");
Expand Down
38 changes: 28 additions & 10 deletions 4/m_antiknocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

/// $ModAuthor: Sadie Powell <[email protected]>
/// $ModConfig: <antiknock nickregex="(st|sn|cr|pl|pr|fr|fl|qu|br|gr|sh|sk|tr|kl|wr|bl|[bcdfgklmnprstvwz])([aeiou][aeiou][bcdfgklmnprstvwz])(ed|est|er|le|ly|y|ies|iest|ian|ion|est|ing|led|inger|[abcdfgklmnprstvwz])" docmd="yes" donick="yes" donotice="yes" doshun="yes" shunduration="15" shunreason="User was caught in an antiknock trap">
/// $ModDesc: Attempts to block a common IRC spambot.
/// $ModDepends: core 4

Expand All @@ -31,22 +32,29 @@ class ModuleAntiKnocker final
: public Module
{
public:
bool docmd;
bool donick;
bool donotice;
bool doshun;
std::regex nickregex;
IntExtItem seenmsg;
unsigned long shunduration;
std::string shunreason;

void PunishUser(LocalUser* user)
{
auto* sh = new Shun(ServerInstance->Time(), shunduration, MODNAME "@" + ServerInstance->Config->ServerName, shunreason, user->GetAddress());
if (ServerInstance->XLines->AddLine(sh, nullptr))
if (doshun)
{
ServerInstance->XLines->ApplyLines();
return;
}
auto* sh = new Shun(ServerInstance->Time(), shunduration, MODNAME "@" + ServerInstance->Config->ServerName, shunreason, user->GetAddress());
if (ServerInstance->XLines->AddLine(sh, nullptr))
{
ServerInstance->XLines->ApplyLines();
return;
}

// No shunning? Annoying. Just quit em.
delete sh;
// No shunning? Annoying. Just quit em.
delete sh;
}

std::string message;
if (!user->IsFullyConnected())
Expand Down Expand Up @@ -78,13 +86,17 @@ class ModuleAntiKnocker final
throw ModuleException(this, INSP_FORMAT("<antiknock:nickregex> is invalid: {}", err.what()));
}

shunduration = tag->getDuration("shunduration", 60*60, 60);
docmd = tag->getBool("docmd", true);
donick = tag->getBool("donick", true);
donotice = tag->getBool("donotice", true);
doshun = tag->getBool("doshun", true);
shunduration = tag->getDuration("shunduration", 60*15, 60);
shunreason = tag->getString("shunreason", "User was caught in an antiknock trap", 1);
}

ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) override
{
if (!validated || !user->IsFullyConnected())
if (!docmd || !validated || !user->IsFullyConnected())
return MOD_RES_PASSTHRU;

if (command == "PRIVMSG" && irc::equals(parameters[0], "NickServ"))
Expand Down Expand Up @@ -113,7 +125,7 @@ class ModuleAntiKnocker final

ModResult OnUserPreNick(LocalUser* user, const std::string& newnick) override
{
if (!std::regex_match(newnick, nickregex))
if (!donick || !std::regex_match(newnick, nickregex))
return MOD_RES_PASSTHRU;

ServerInstance->SNO.WriteToSnoMask('a', "User {} ({}) was prevented from using a knocker nick: {}",
Expand All @@ -122,6 +134,12 @@ class ModuleAntiKnocker final
PunishUser(user);
return MOD_RES_DENY;
}

void OnUserConnect(LocalUser* user) override
{
if (donotice)
user->WriteNotice("*** You are not welcome on this network if you are a malicious bot. If you are not a malicious bot bot please ignore this message.");
}
};

MODULE_INIT(ModuleAntiKnocker)
Expand Down
2 changes: 1 addition & 1 deletion 4/m_asn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ASNExtBan final

public:
ASNExtBan(Module* Creator, IntExtItem& asn)
: ExtBan::MatchingBase(Creator, "asn", 'n')
: ExtBan::MatchingBase(Creator, "asn", 'b')
, asnext(asn)
{
}
Expand Down
4 changes: 2 additions & 2 deletions 4/m_clientcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ class ModuleClientCheck final
size_t msgsize = parameters[1].size();
size_t lastpos = msgsize - (parameters[1][msgsize - 1] == '\x1' ? 9 : 10);

const std::string version = parameters[1].substr(9, lastpos);
const std::string versionstr = parameters[1].substr(9, lastpos);
for (const auto& ci : clients)
{
if (!ci.pattern->Matches(version))
if (!ci.pattern->Matches(versionstr))
continue;

switch (ci.action)
Expand Down
3 changes: 0 additions & 3 deletions 4/m_forceusername.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
*/

/// $ModAuthor: Sadie Powell <[email protected]>
/// $ModConfig: <connect forceident="example">
/// $ModDepends: core 4
/// $ModDesc: Allows forcing idents on users based on their connect class.
/// $ModConfig: <connect forceusername="example">
/// $ModDepends: core 4
/// $ModDesc: Allows forcing usernames on users based on their connect class.
Expand Down
12 changes: 5 additions & 7 deletions modules.lst
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ module m_timedstaticquit 3.752 https://raw.githubusercontent.com/inspircd/inspir
module m_totp 3.752 https://raw.githubusercontent.com/inspircd/inspircd-contrib/9705e755cd2f51ee45b6df7dabf127bd6b435966/3/m_totp.cpp
description Enables two factor authentification for oper blocks
depends core 3
module m_upgradecheck 3.805 https://raw.githubusercontent.com/inspircd/inspircd-contrib/fe1550a6b1dbf117be248caff3fb8377261c119f/3/m_upgradecheck.cpp
module m_upgradecheck 3.893 https://raw.githubusercontent.com/inspircd/inspircd-contrib/203de04f52437240e156977e8cc6dfb0f72af79a/3/m_upgradecheck.cpp
description Checks the server config for deprecated config entries that might cause trouble when upgrading to v4.
depends core 3
module m_xlinetools 3.752 https://raw.githubusercontent.com/inspircd/inspircd-contrib/9705e755cd2f51ee45b6df7dabf127bd6b435966/3/m_xlinetools.cpp
Expand All @@ -264,13 +264,13 @@ module m_xlinetools 3.752 https://raw.githubusercontent.com/inspircd/inspircd-co
module m_zombie 3.752 https://raw.githubusercontent.com/inspircd/inspircd-contrib/9705e755cd2f51ee45b6df7dabf127bd6b435966/3/m_zombie.cpp
depends core 3
description Provides support for zombifying users who have split because of a network issue.
module m_antiknocker 4.829 https://raw.githubusercontent.com/inspircd/inspircd-contrib/0bc07531f939fc6d3ad12a06c8e7fdfaac01d6ef/4/m_antiknocker.cpp
module m_antiknocker 4.887 https://raw.githubusercontent.com/inspircd/inspircd-contrib/fcf25a6621351cbfa21699b233816043ca997275/4/m_antiknocker.cpp
description Attempts to block a common IRC spambot.
depends core 4
module m_antisnoop 4.847 https://raw.githubusercontent.com/inspircd/inspircd-contrib/7f09d3cfdbeba535984854b1d6be4f632a150877/4/m_antisnoop.cpp
description Adds a channel mode which limits the ability of snoopers.
depends core 4
module m_asn 4.838 https://raw.githubusercontent.com/inspircd/inspircd-contrib/f80fc0433652502ebf0b0bc2574e8ea1f6321609/4/m_asn.cpp
module m_asn 4.894 https://raw.githubusercontent.com/inspircd/inspircd-contrib/76a126d4d48587fb5b5276b2f999fbb996b14ce3/4/m_asn.cpp
depends core 4
description Allows banning users based on Autonomous System number.
module m_autoaway 4.838 https://raw.githubusercontent.com/inspircd/inspircd-contrib/f80fc0433652502ebf0b0bc2574e8ea1f6321609/4/m_autoaway.cpp
Expand All @@ -288,7 +288,7 @@ module m_blockhighlight 4.847 https://raw.githubusercontent.com/inspircd/inspirc
module m_censor 4.847 https://raw.githubusercontent.com/inspircd/inspircd-contrib/7f09d3cfdbeba535984854b1d6be4f632a150877/4/m_censor.cpp
depends core 4
description Allows the server administrator to define inappropriate phrases that are not allowed to be used in private or channel messages.
module m_clientcheck 4.812 https://raw.githubusercontent.com/inspircd/inspircd-contrib/530a46b200879d8df23209254dd22252f1a79d68/4/m_clientcheck.cpp
module m_clientcheck 4.885 https://raw.githubusercontent.com/inspircd/inspircd-contrib/a977b7ad09b270263c2325b16cafaba6d6746a70/4/m_clientcheck.cpp
description Allows detection of clients by version string.
depends core 4
module m_cloak_unreal 4.853 https://raw.githubusercontent.com/inspircd/inspircd-contrib/a29004e8665bf978ae513e5d23077ea897c91242/4/m_cloak_unreal.cpp
Expand Down Expand Up @@ -324,9 +324,7 @@ module m_eventexec 4.838 https://raw.githubusercontent.com/inspircd/inspircd-con
module m_exmode 4.810 https://raw.githubusercontent.com/inspircd/inspircd-contrib/e5b22f69a1e5112f17a2e665d9e39691033d98ec/4/m_exmode.cpp
depends core 4
description Adds the /EXMODE command which explains a mode change.
module m_forceusername 4.812 https://raw.githubusercontent.com/inspircd/inspircd-contrib/530a46b200879d8df23209254dd22252f1a79d68/4/m_forceusername.cpp
depends core 4
description Allows forcing idents on users based on their connect class.
module m_forceusername 4.889 https://raw.githubusercontent.com/inspircd/inspircd-contrib/b32413e868fbdc6d6099d27f766fb8096eb417a4/4/m_forceusername.cpp
depends core 4
description Allows forcing usernames on users based on their connect class.
module m_geocmd 4.810 https://raw.githubusercontent.com/inspircd/inspircd-contrib/e5b22f69a1e5112f17a2e665d9e39691033d98ec/4/m_geocmd.cpp
Expand Down

0 comments on commit 7cab541

Please sign in to comment.