Pissfilter User's Guide

From pisswiki
Revision as of 14:40, 15 October 2023 by Chmod (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Pissfilter is a spam filtering bot that uses rules.

Getting started

The bot can be used in the #pissfilter, #services or #opers channels by mentioning it like so: Pissfilter: help. Logs can be accessed via #services or #pissfilter.

Rules syntax

  • Regexes are formatted as /REGEX/FLAGS.
  • Strings are formatted as "string".
  • Parameters are formatted literally (hostmask, for example)
  • Durations are formatted as a number followed by a unit (d/h/m/s), or forever.

The rules syntax is defined as on EVENT: CONDITION -> ACTION # COMMENT. The comment is optional.

Valid events are:

  • message: when a message is sent
  • connect: when a user connects
  • violation: when a violation is added
  • part: when a user parts
  • quit: when a user quits

Conditions can be one of the following:

  • <string param> match <regex>: Checks for a regex match.
  • not <condition>: Inverts a condition.
  • <condition> and <condition>: Takes the AND of both conditions.
  • <condition> or <condition>: Takes the OR of both conditions.
  • <integer param> <gt|lt|gte|lte|eq> <number>: Compares an integer.
  • <string param> eq <string>: Compares a string.

Valid string parameters are:

  • server: The server the user is on.
  • hostmask: The hostmask of the user.
  • message: The message sent (message event only).
  • gecos: The realname/GECOS of the user.
  • channel: The channel the message was sent to (message/quit/part events only).
  • type: The violation type that triggered this event (violation event only).

Valid integer parameters are are:

  • connected_for: How many seconds the user is connected for.
  • violation <string: violation name>: The amount of violations for the given type.

Valid actions are:

  • gzline <str: duration> <str: reason>: GZ-lines the IP
  • gline <str: duration> <str: reason>: G-lines the IP
  • shun <str: duration> <str: reason>: Shuns the IP
  • kill <str: reason>: Kills the user
  • tempshun: Tempshuns the user
  • log <str: message>: Log a message
  • violation <str: name> <int: points> <duration: exp>: Adds points to the violation counter name (name must be a string in quotes) which expire in exp.

Commands

  • help: Get a list of commands
  • add <rule>: Add a rule
  • del <rule ID>: Delete a rule
  • test <rule IDs...>: Test a set of rules on the last 60 minutes of events.
  • list: List staging rules
  • list exec: List current rules
  • rollback: Rollback the staging ruleset to the current rules
  • apply: Apply the current staging rules

Creating your first rule

For this example, we will be using the rule on message: channel eq "#opers" and message match /test/ -> kill # test rule, which:

  • when a message is sent,
  • if the message is sent to the channel #opers, and
  • it contains test,
  • kill the user

You can create the rule by doing Pissfilter: add on message: channel eq "#opers" and message match /test/ -> kill # test rule. To test it, post "test" in opers and run Pissfilter: test <rule ID>, and it should show you that it would have KILLed you. To remove the rule, do Pissfilter: del <rule ID>.