Collection of muh ZNC modules m8 =]

Wazakindjes 5081274f24 kickban: Clarified multi-channel autokicker and wildcards imo tbh 11 months ago
.gitignore 4ea1d11537 Updated gitignore w/ OSX bullshit 2 years ago
LICENSE 3c6587eabf initial commit 2 years ago
README.md 5081274f24 kickban: Clarified multi-channel autokicker and wildcards imo tbh 11 months ago
kickban.cpp 641d72b4ae Changed the module to compile with the default kick reason enabled 1 year ago
queryspam_prot.cpp 1c5948eb8b queryspam_prot: Maybe it's a good idea to actually use the full message xd (muh tokens kek) 2 years ago
regexwatch.cpp 292fd4ded5 regexwatch: Now also supports nick regexes =]]]] Also exception handling for runtime regexing xd 2 years ago
sajoin_prot.cpp 6ec5a24347 sajoin_prot: Tfw forgot to change 10 sec interval back to 120 for rep0ts xd 2 years ago
sapart_rejoin.cpp 6a88efbbe5 sajoin_prot: Fixed bug where you couldn't attach to autojoined chans (like #opers, or autocycle'd ones) 2 years ago

README.md

This is now a collection of my modules for ZNC. ;3 Everything is tested with ZNC v1.6.3, UnrealIRCd v4.0.x and Anope v2.0.x, so it may or may not work with other versions/IRCds/services.

If you don't know how2compile modules: http://wiki.znc.in/Compiling_modules

Index lol

kickban

Derived from autovoice, this module automatically kicks and bans people matching a certain nick!ident@host mask when people join a channel, you get re-opped or someone changes their nick.

Commands:

  • adduser <user> <hostmask> [channel1,channel2,...] <reason> -- you need to add a user before you can do any of the below commands ;]
  • deluser <user>
  • listusers
  • addchans <user> <channel,[channel2[,...]>
  • delchans <user> <channel,[channel2[,...]>

The kick reason is required, unless you uncomment/change the following lines at the top of kickban.cpp and recompile it:

//#define ENABLE_DEFAULT_REASON 1
CString defaultKickReason = "Ayy lmao";

Usage:
An example for adding an autokicker would be: /msg *kickban adduser guests Guest*!*@* * lmao ur an fuckstick. This will kick everyone with a nick like Guest13, Guest239, etc and sets a ban on the specified hostmask (Guest*!*@*). This check runs for every channel (notice the individual *), meaning any channel you have hops/ops/etc in will see the Guest users being kicked. You can also restrict it to specific channels by doing something like: /msg *kickban adduser guests Guest*!*@* #chan1,#chan2,#chan3 lmao ur an fuckstick

Besides the wildcard * (matches 0 or more of any character), you can also use ? (must match exactly 1 character).

The user field is merely the display name of that entry, it doesn't affect who it kicks. The *chans commands are for maintaining channel restrictions, so you could do delchans guests * and addchans guests #privateshit for example. ;]

regexwatch

Similar to watch, but this one works with ECMASCRIPT regexes. Currently it watches an entire network and channel messages/notices only (I see no point in having more hooks atm =]). The regexes are all case-insensitive.

C++ regexes require a GCC version of v4.9 or greater

Usage:
Doesn't require any arguments at load time. Just load it at user or network level and add some regexes. Because of the nature of CString::Token, use \s for spaces instead of literal spaces

Commands:
The module has some in-IRC commands obviously. ;3

  • add [nickregex] <regex> => Add an entry to monitor for, optionally limited to nickregex
  • del <id> => Deletes id from the regex list
  • list => List all regex patterns yo
  • test <id> [nick] <string> => Check if regex pattern id matches the message string, optionally with a nickname
  • buffer [count] => Show/Set the amount of buffered lines while detached
  • halp => Show in-IRC halp

sapart_rejoin

Rejoins a channel after being SAPARTed. Since that shit actually sends a PART message on your behalf, it may get removed from ZNC entirely. The module tries to keep yo settings.

Usage:
Has one optional argument delay. That shit is in seconds and defines how long to wait before tryna rejoin. It's always at least 1 so clients don't shit themselves (i.e. Textual shows the channel grayed out even though you can send messages).

queryspam_prot

Prevents your client from opening up a bunch of tabs/windows for queries when getting spammed (usually by butts).

Usage:
Takes 2 arguments: threshold and timeout.
threshold is how many times a message must be seen before it gets blocked entirely (default = 5).
timeout is in minutes and defines how long this exact message will be blocked for (default = 15).

The module checks for PRIVMSGs aimed directly at you. If the message repeats more than threshold times (from any source) all messages exactly like that will be blocked for timeout minutes. This means your client will stop opening tabs/windows and you won't see any subsequent messages. =] When it gets unblocked you'll get a notification from the module.

Also, two minutes after receiving a message that wasn't classified as spam it will "cool down". This means the counter for that particular message will be reset to 0.

sajoin_prot

Protects you against forced joins (/sajoin etc). =]

This shit works by intercepting JOIN messages and verifying if you even initiated them. If you didn't then you're being SAJOINed and the mod will check if they are allowed ("trusted") channels (i.e. because you have them configured). If it's still like nope.avi it will send a PART message in response (this all is invisible to the ZNC user). This may induce some "lag" because of the IRCd throttling your shit, so bnice k?

It also reports back every 2 minutes how many channels you were tried to join into. If there are none there will be no message obviously.

Updated shit

  • Now reports back to the user how many channels they were SAJOINed into (or attempted to kek)
  • When opering up it wouldn't attach your client to the force-joined #opers but ZNC also wouldn't part it, resulting in a desync. The same happened with /cycles done by modules like autocycle. This is now fixed by temporarily holding off on joining such channels (2 seconds to be exact), then checking if you're supposed to attach to them.

Usage:
Doesn't take any arguments, just load it and go. ;3

If you wanna edit the reporting timespan, you'll have to edit the source and recompile. Just look for:

netwerk->PutUser(":" + prefix + "sajoin_prot!sjprot@znc.in NOTICE " + nick + " :*** Over the last 2 minutes you were (tried to be) SAJOINed into " + count + " channels");
....
AddTimer(new CReportTimer(this, 120, 0, "sajoin_prot_report", "sajoin_prot_report"));

And change the 120 to the amount of seconds it should wait for its next report. May also wanna adjust the message it sends you. =]