Work resumes on the Perl monstrosity

Filed under: Harlie, Perl by tamber
18 June 2010 @ 14:49

Picked up work on Harlie again, and finally created the module that’s been missing and breaking the fresh-out-of-vcs bot. (Anyone inconvenienced by this, let me know by email and I’ll give you your money back. :p )

Still on the whiteboard are the changes to build in multithreading; working plugins; user and permission controls and so forth. I’m spending this afternoon working on the user and permission side of things.

Whilst I’m on the topic, I thought of a method to allow the owner of a bot to add themselves to the permissions database. This is a little bit of a chicken-and-egg problem, they need admin permissions to add themselves to the database that tells the bot that they have admin permissions. And then there’s the risk that someone ‘steals’ the bot by registering themselves as the owner before you do. (Which would be annoying at best.)

My solution to this? If the users database is empty, a single-use key is generated and displayed on the console. Anyone attempting to register themselves as the bot’s owner must identify themselves with the single-use key. (If an attacker can see the owner’s console, there are bigger issues than just being able to take over the irc bot. :P )

This adds the owner to the users database with full permissions, and they can take it from there; using the bot commands to add/delete/etc users. :)

Comment from Terrorbite @ 2010/07/05 08:12:

I’d like to know what your thoughts are on creating an IRC bot, in terms of user and channel management, identification, etc. Ideally I’d like it to be as hassle-free as possible and have the bot recognise names that are identified (ie logged in) with Nickserv – this is possible via reading flags that are set on the reply to the WHO command.

My bot’s written in Python, with dynamic loading, reloading and removal of modules (ie plugins). Almost everything is a plugin and can be changed and reloaded at runtime. I’m using a generic IRC module for Python, but considering going a bit lower-level for my own purposes. Contact me if you want more into.

What thoughts in particular would you like to know about? :) So far, I haven’t attempted to try use data from WHOIS or WHO, mainly due to the way that the data is returned (As a separate event, which is dealt with in a separate handler, so I can’t get at it from the handler that actually sent the WHO(IS)+ )

Mine’s written in Perl (Obviously. :) ), and does have plugins so that it can be extended. However, whilst you can currently load plugins, they can’t really do that much. :p I have some idea of how to make them add handlers so that they can listen for events, but if they want to add commands they’re on their own for now. A side effect of insufficient planning early on.

Altogether now… “Proper Planning Prevents…” ;)