IRC mask watcher, akin to Atheme's OperServ RWATCH
.
$ cp config.example.yaml config.yaml
$ vim config.yaml
$ sqlite3 ~/.masks.db < make-database.sql
$ python3 -m bismite config.yaml
<jess> addreason spam Spam is not welcome on Libera Chat. Email $email with questions.
-bismite- added $spam
<jess> addreason email bans@libera.chat
-bismite- added $email
<jess> listreason
-bismite- $spam: Spam is not welcome on Libera Chat. Email $email with questions.
-bismite- $email: bans@libera.chat
<jess> addmask /^jesstest!/ $spam|!dnsbl
-bismite- added 1 (hits 1 out of last 8 users)
<jess> listmask
-bismite- 1: /^jesstest!/ (0 hits) WARN [$spam|!dnsbl]
<jess> setmask 1 lethal
-bismite- /^jesstest!/ changed from WARN to LETHAL
<jess> getmask 1
-bismite- 1: /^jesstest!/ (0 hits) LETHAL [$spam|!dnsbl]
-bismite- changes:
-bismite- 2021-06-03T19:01:02 by jess: add
-bismite- 2021-06-03T19:01:10 by jess: type LETHAL
/msg bismite addmask /<regex>/[<flags>] <reason>[|<oper reason>]
/msg bismite addmask %<glob>%[<flags>] <reason>[|<oper reason>]
/msg bismite addmask "<string>"[<flags>] <reason>[|<oper reason>]
Adds a "mask", a pattern that will be tested against new connections' masks
(formatted as nick!user@host realname
).
By default, all new masks are WARN
masks.
The delimiters on /<regex>/
can be any non-alphanumeric character, e.g. ,<regex>,
.
bismite's regex syntax can be found here.
flags
is an optional sequence of flag characters
that further controls how the provided pattern matches.
reason
is the publicly-visible reason for any actions (e.g. K-lines) taken by bismite.
oper-reason
is private.
This command will return an integer ID for the newly-added mask,
which should be used in any commands with an <id>
parameter.
/msg bismite setmask <id> <mask-type>
Changes the action taken when a mask matches. See mask types.
Lists all masks and their IDs.
/msg bismite togglemask <id>
Enables or disables a mask.
/msg bismite listmask
Lists all masks and their IDs.
/msg bismite getmask <id>
Gets detailed information about a mask, including a log of changes to it and who made them.
/msg bismite addreason <alias> <text>
Adds a reason template.
In mask reasons, $alias
will be replaced with text
.
/msg bismite delreason <alias>
Deletes a reason template.
/msg bismite listreason
Lists all reason templates.
Every mask type is made up of one action and zero or more modifiers separated by |
,
e.g. LETHAL|DELAY|QUICK
.
By default, every action except EXCLUDE
is logged to two channels,
both of which are configured in config.yaml
as channel
and verbose
.
The actions are as follows:
WARN
: Does nothing except send a warning message to the channel.RESV
: Applies a temporaryRESV
with the user's nick.KILL
: Disconnects the user using aKILL
command.LETHAL
: Bans the user using thebancmd
inconfig.yaml
.EXCLUDE
: Does nothing. Takes priority over other mask types, preventing them from matching.
The modifiers are as follows:
DELAY
: Waits for a small random number of seconds before performing an action.QUICK
: When combined withDELAY
, waits for a shorter-on-average and consistent duration before performing an action.QUIET
: Only logs to the verbose channel.SILENT
: Prevents logging to either channel.
You can specify different flags to limit when a mask will be matched. For example, to perform case-insensitive matching on connections without accounts, use:
addmask /^beep!/iA $spam
The mask flags are as follows:
i
- case insensitive matcha
- only match users with an accountA
- only match users without an accountN
- also match on nick changes instead of just on connectionsz
- only match users who are using TLSZ
- only match users who are not using TLS