ubuntu-bots/Bantracker
Krytarik Raido 669293de1e Encyclopedia: Add Python 3 support. 2018-05-16 23:45:04 +02:00
..
cgi Encyclopedia: Add Python 3 support. 2018-05-16 23:45:04 +02:00
README.txt * Update symlinks in the root. 2011-12-21 16:38:39 +00:00
__init__.py Update copyright/license/author/contributors information 2010-05-24 14:38:06 +01:00
config.py added configuration options: 2012-07-04 22:12:55 -03:00
plugin.py [Banatracker] 2014-10-23 20:48:14 +01:00
test.py add "seconds" unit 2012-11-03 19:00:31 -03:00

This plugin can store all bans/kicks etc in an sqlite database. It includes a
cgi script to view bans/kicks and comment on them. To view/user the bantracker
web interface a user must use the @btlogin command from the bot. They must also
have the 'bantracker' capability.
You can use the @mark <nick|hostmask> [<channel>] [<comment>]
command to manually add an entry to the bantracker without having to actially
kick/ban someone.

The schema of the SQLite2 database:

CREATE TABLE bans (
    id INTEGER PRIMARY KEY,
    channel VARCHAR(30) NOT NULL,
    mask VARCHAR(100) NOT NULL,
    operator VARCHAR(30) NOT NULL,
    time VARCHAR(300) NOT NULL,
    removal DATETIME,
    removal_op VARCHAR(30),
    log TEXT
);
CREATE TABLE comments (
    ban_id INTEGER,
    who VARCHAR(100) NOT NULL,
    comment MEDIUMTEXT NOT NULL,
    time VARCHAR(300) NOT NULL
);
CREATE TABLE sessions (
    session_id VARCHAR(50) PRIMARY KEY,
    user MEDIUMTEXT NOT NULL,
    time INT NOT NULL
);
CREATE INDEX comments_ban_id ON comments(ban_id);

To configure the plugin, create the SQLite2 database with above structure and
set supybot.plugins.bantracker.database to its filename. Then enable it, either
per-channel or globally, by setting the channel variable:
supybot.plugins.bantracker.enabled
You can create the database by using the "sqlite" command-line tool by passing
the file name and then copy/paste the above table schema. Then type ".quit" to
save and exit.
If you choose to enable this plugin during the initial setup (with the command
supybot-wizard), then the database will be created automatically for you.

If you wish to use the web interface, it also uses commoncgi.py which should be
on your sys.path (or as you can see in cgt/bans.cgi, sys.path is modified to
include the dir of commoncgi.py).
You should place the contents of the cgi/ directory somewhere accessible by
your web server, and modify the CONFIG_FILENAME variable near the top of the
script to point to the location of your bantracker.conf.
Then modify the bantracker.conf file to reflect the proper values for your
setup.

The meanings of the entries in bantracker.conf are:
Key                 Type    Description
anonymous_access    Boolean True if annonmous access is allowed, otherwise
                            False.
database            String  The full path to the SQLite bantracker database.
results_per_page    Number  The maximum number of results that should be shown
                            per page.
plugin_path         String  The full path to the directory that contains the
                            commoncgi.py file.
irc_network         String
                            The DNS name of the IRC network anonymous users are
                            directed to when anonymous access is disabled.
irc_channel         String  The channel name anonymous users are directed to
                            when anonmous access is disabled.