TOC
  1. NEWS
  2. WHAT IS THIS?
  3. LOGGING MY CHATS? YOU ARE EVIL!
  4. CONTRIBUTIONS AND THANKS
  5. WARNINGS AND LIMITATIONS
  6. DOWNLOADS
  7. INSTALLATION
  8. CONFIGURATION
  9. NOTES
  10. TODO AND FUTURE PLANS
  11. FEEDBACK
  12. REFERENCES AND LINKS
NEWS

2008-04-04 Added instructions for setting up IMSpector with Squid.

2008-03-13 Released IMSpector 0.5. This version adds support for the Gadu-Gadu protocol, improves the filtering and content manipulation functionality by combinding it into one plugin type, and incorporates a database-backed filter. This filter is able to automatically whitelist. SQL logging plugins now log the client IP address. 0.5 also includes a number of bug-fixes.

2008-01-16 After a six month or more delay, IMSpector 0.4 has been released! Various things, mostly related to work and a new, gorgeous, woman in my life, meant I had very little free time available for IMSpector. 0.4 adds PostgreSQL logging, ACLs, more group chat support, and countless bug fixes, especially in the areas of MSN support and the MySQL plugin. This version also introduces changes to the log format.

2007-06-21 IMSpector developement has not stopped! I have finally setup a CVS repository on sourceforge. IMSpector 0.4 should be ready by the end of June and will add some new features like blocking, Postgres logging, and a number of bug fixes.

2006-12-22 IMSpector has been incorporated into SmoothWall Express. IMSpector is included in the latest alpha build of Express 3, codenamed "Koala". See the news story for more information.

2006-12-11 Added two Sourceforge mailing lists: imspector-users and imspector-devel. See the FEEDBACK section for information on joining.

2006-12-05 Released 0.3. This release greatly improves AIM/ICQ support by properly logging the local IDs. Also added a content manipulator that can remove naughty words. MySQL support has been made robust. Also the config file has been moved under PREFIX. IMSpector now runs on BSD (using pf). SQL plugins will now create the message table if it dosn't exist. Protocol plugins now need to be enabled.

2006-11-04 Released 0.2, with SQLite logging support, a Yahoo protocol plugin, and an experimental IRC protocol plugin. Also fixed a build problem that will prevent IMSpector building on some systems.

WHAT IS THIS?

IMSpector is an Instant Messenger transparent proxy with monitoring and blocking, and content-filtering capabilities. Currently it supports MSN, AIM, ICQ, Yahoo, IRC and Gadu-Gadu to different degrees. MSN is the principle protocol, as it's the most popular these days, at least in the UK, where I'm based. The supported platform are at present Linux and BSD when using the pf firewall, but porting to other UNIXs should be trivial (the only platform-specific code is the routine which determines the original destination address). It is able to log to plain files, as well as several types of SQL database including MySQL, SQLite and PostreSQL.

This software is licenced under the GPL v2. The original author is Lawrence Manning.

The program is currently somewhere between alpha and beta quality, but the following features have been implemented and at least work to some degree:

  • Written in C++, with a minimal set of dependiancies. Nice and small code footprint - 5000 lines thus far. Plugin based.
  • Supports the following IM protocols via "protocol plugins":
    • MSN - Logging of incoming and outgoing messages and file transfers.
    • ICQ/AIM - Supports the "new" protocol, ie. prehistoric ICQ is not supported.
    • Yahoo - Logs chats and filetransfers. Also supports webcam events. Nice and easy protocol to examine.
    • IRC - Kind of "play thing". Logs channel and private messages. Currently proxying this protocol through IMSpector will break DCC SENDs.
    • Gadu-Gudu - A protocol popular in Poland, this plugin currently only supports the logging of text messages.
  • Can log to various places via "logging plugins":
    • Files - The conversations are written to a file within a path resembling {protocol}/{local id}/{remote id}/{year}-{month}-{day}. See the CONFIGURATION section for more info.
    • MySQL - Can connect to a DB and dump the chats into a table. Not compiled by default.
    • SQLite - Can log to a local SQLite DB file. Requires sqlite3. Not compiled by default.
    • PostgreSql - Can connect to a DB and dump chats into a table. Not compiled by default.
    • Debug - A trivial example plugin which logs to the syslog, which when in debug mde, will end up on STDERR.
  • Can filter in various ways via "filtering plugins":
    • Content manipulation. Replace bad words with a user defined character. All protocols supported by IMSpector can be filtered in this way.
    • Can block messages and other events based on white and black-lists. A database-backed filter (which uses SQLite) is able to automatically add remote users to the whitelist when local users send them messages. Can also blanket block file transfers and webcam events (Yahoo only at present).
  • All the usual deamon things. Drop privs, a simple config file etc.
LOGGING MY CHATS? YOU ARE EVIL!

Possibly. You may be wondering why people would want to log IM conversations on the network. Well, yes clearly there is an avenue for abuse with this program. Spouses can use it to spy on each other. Parents can use it to spy on their teenagers. Bosses can spy on their staff. The list is endless. However, there are legitimate reasons why people would want to log IM chats, so this tool has been written. At this point it should be pointed out that as IMSpector is a proxy and not just a traffic-snooper; other things beyond simple logging are possible, such as AV scanning of file transfers. See the TODO list for more information. As of 0.4, IMSpector can both block messages based on the parties making the chats, and it can also block file-transfers, keeping bad files out of your systems.

In addition, some people may be of the opinion that if they cannot monitor use, they must block it. But blocking something can lead to conversations simply being made by other channels. Logging means the user's freedom to use IM is maintained, while giving the parents, teachers, etc, the knowledge that if they need to look at the chat logs for whatever reason, they can. So in some situations, IMSpector actually stimulates IM use.

If you are really interested in your privacy then you should be using some kind of end-to-end encryption on your IM sessions. See the REFERENCES section for more infromation on some IM encryption software.

CONTRIBUTIONS AND THANKS

All contributions from other authors are vetted and incorporated by me (Lawrence Manning), as the original author. All contributors automatically hand over all copyright to me. What contributors get in return is fame (listed on this webpage), the feature they want, the bug they fixed incorporated, and a warm fuzzy feeling that they are also helping others who get the software for free.

Please note that IMSpector is GPL software, free as in beer and free as in freedom. When it crashes, you get to the keep the coredump.

I haven't got an artistic bone in my body, so I'm greatful to my colleage at SmoothWall Ltd, Darren Taylor who produced not only the funky logo but also came up with the name IMSpector. Cheers Drutt! Oh and he also made the template for this webpage, cos he knows that I totally suck at HTML.

Tom Newton: SQLite plugin and ideas.

Ryan Wagoner: BSD pf port, ICQ/AIM local ID enhacement, MySQL plugin work

David Hinkle: PostgreSQL plugin.

Jose Carlos Benfati: Inital idea and implementation of ACL-based blocking.

WARNINGS AND LIMITATIONS

This software should be considered beta quality at best. It has not been audited by anyone, including myself. That said, I have had it running on my machines for a couple of weeks and it now seems reliable - hence I am releasing it to the wild to see if there is any interest.

Note that some things are missing, noteably IM over HTTP support. This means that if you wish to log people using MSN, you should probably also block HTTP traffic from getting to the MSN servers. How you do this depends on lots of factors, so you will have to work that out yourself. There may well be other ways to get around IMSpector chat logging. In addition, IMSpector may make a mess of logging group chats, which some IM protocols support.

DOWNLOADS

The following versions are available for download:

INSTALLATION

IMSpector is normally run on the routing machine in the network. This would typically be the Linux box shoved in the corner doing NATing onto an Internet connection. This machine would normally be performing NAT for the network, but does not have too. IMSpector should in theory run on a machine that is doing bridging. Basically it wll run anywhere that a webproxy could be used to do transparent proxying. Under Linux at least, it can also be ran on a machine which is running a webproxy such as Squid, which IM clients are connecting through.. System requirements are minimal, although with a large number of local users IMSpector will fork many copies of itself (a typical MSN connection can consist of a dozen or more concurrent connections).

Download the code, and untar. Currently there is no configure script, so you must configure the Makefile by hand (if needed) and run make. There are no dependancies beyond a working C++ compiler, unless you are planning to use a SQL logging plugin. Please note that GCC prior to v3 is known not to work due to its incomplete STL implementation. In the event that you wish to build the SQL logging plugins, you will also need the client libraries. Please note that v3 of MySQL will probably not work with the MySQL plugin. The SQLite plugin requires the sqlite3 client libraries and headers to be installed.

The Makefile, trivial that it is, contains one variable, PREFIX that you can set to the target dir of the install. The default is /usr, which is probably ok for most people.

Note that if you chagne the PREFIX value (say to /usr/local) you will need to adjust the plugin_dir config option to tell IMSpector where to look for plugins.

To build IMSpector under BSD, follow the instructions in the Makefile.

make
sudo make install

IMSpector is capable of setuid-ing to a non root user (indeed it has no requirement to run as root, or even be started as the root user), but the install target does not currently attempt to make a special user. Thus the default config will run as the whatever use started the program. This kind of "tidying up" is on the TODO.

This will install the files as follows, assuming a PREFIX of /usr:

  • /usr/sbin/imspector - the imspector binary.
  • /usr/lib/libimspector.so - a shared library that the main program and plugins share.
  • /usr/lib/imspector/*protocolplugin.so - the protocol plugins.
  • /usr/lib/imspector/*loggingplugin.so - the logging plugins.
  • /usr/lib/imspector/*filterplugin.so - the filtering and content-manipulation plugins.
  • /usr/etc/imspector/imspector.conf - an example config file, good enough for quick playing.
  • /usr/etc/imspector/badwords.txt - an example list of swear words to block.
  • /usr/etc/imspector/acl.txt - an example of a trivial and useless ACL.

Note that the plugins are loaded at runtime and can use config file entries. The plugins loaded will be logged to syslog.

After compiling and installing IMSpector, the following iptables rules are required to transparently proxy the various IM ports. You can of course choose which protocols you wish to proxy into IMSpector:

  • MSN: iptables -t nat -A PREROUTING -p tcp --destination-port 1863 -j REDIRECT --to-ports 16667
  • ICQ/AIM: iptables -t nat -A PREROUTING -p tcp --destination-port 5190 -j REDIRECT --to-ports 16667
  • Yahoo: iptables -t nat -A PREROUTING -p tcp --destination-port 5050 -j REDIRECT --to-ports 16667
  • IRC: iptables -t nat -A PREROUTING -p tcp --destination-port 6667 -j REDIRECT --to-ports 16667
  • Gadu-Gadu: iptables -t nat -A PREROUTING -p tcp --destination-port 8074 -j REDIRECT --to-ports 16667

If you are also running a webproxy, like Squid, on the same machine which is operating as your network gateway, you can also redirect the outgoing Squid traffic into IMSpector:

  • MSN: iptables -t nat -A OUTPUT -p tcp --destination-port 1863 -m owner --uid-owner 100 -j REDIRECT --to-ports 16667
  • ICQ/AIM: iptables -t nat -A OUTPUT -p tcp --destination-port 5190 -m owner --uid-owner 100 -j REDIRECT --to-ports 16667
  • Yahoo: iptables -t nat -A OUTPUT -p tcp --destination-port 5050 -m owner --uid-owner 100 -j REDIRECT --to-ports 16667
  • IRC: iptables -t nat -A OUTPUT -p tcp --destination-port 6667 -m owner --uid-owner 100 -j REDIRECT --to-ports 16667
  • Gadu-Gadu: iptables -t nat -A OUTPUT -p tcp --destination-port 8074 -m owner --uid-owner 100 -j REDIRECT --to-ports 16667

Here, 100 is the User ID which the webproxy is running as; replace it as appropriate to your system. This is needed to stop a cyclic loop whereby IMSpector's outgoing packets to the IM servers are themselves fed into IMSpector.

These commands will obviously have to be run in your startup script.

For an inital test, run the program in debug mode:

imspector -d

Login to MSN and you should see some debug output. Finally, send someone a message and it should be logged both on the console and into a logfile within the logging directory. Rerun the program without the -d switch to force it into the background.

CONFIGURATION

Introduction

By default IMSpector will read the file /etc/imspector/imspector.conf but this can be changed at runtime with the -c /path/to/imspector.conf switch.

IMSpector will always fork into the background when started, unless it is running in debug mode with the -d switch.

General options

port=16667

This option sets the listening port, and is the port that a redirect rule should point outgoing connetion requests too. 16667 is the default port, for historical reasons (IMSpector started out as an IRC-only proxy).

plugin_dir=/usr/lib/imspector

Sets the directory that IMSpector will look in for its various plugins. /usr/lib/imspector is the default.

user=imspector
group=imspector

If set, IMSpector will setuid and setgid to this named user and group. By default, IMSpector will continue running as whatever user it was started by, including root (which is not recommended).

pidfilename=/var/run/imspector.pid

Sets the PID filename. The PID file is created before optionally dropping privs.

Enabling protocols

As well as creating the required redirection firewall rules, IMSpector also needs to be told to handle each protocol you wish it to process:

icq_protocol=on
irc_protocol=on
msn_protocol=on
yahoo_protocol=on
gg_protocol=on

Typing events

By default, IMSpector will not log "typing events", because they are not usually interesting. None the less, it is possible to log them if you desire:

log_typing_events=on

IRC, being line based, does not have the concept of typing events and thus IMSpector cannot log them.

IRC and group chats

IRC is alittle "special". With its channels, it suports group chatting. IMSpector copes with this in the following way.

The local ID is always the nickname of the person making the IRC connection. The remote ID will be a channel for channel messages, and the other persons nick for private messages. When a remote user says a message on a channel, the event data is prefixed with their nick and a colon followed be the message said.

MSN and Yahoo group chats are logged in a simular way; in both cases a remote party is created "on demand" to hold the group. ICQ/AIM support within IMSpector currently does not support group chats.

File log format

Logs are filed under a path like this:

{protocol}/{local id}/{remote id}/{year}-{month}-{day}

A prefix to this path is stored in the config file:

file_logging_dir=/var/log/imspector

This directory must be owned by whoever the imspector program will run as.

{protocol} is the name of a supported protocol (currently MSN or ICQ-AIM), {local id} is the local identity who sent or received a message (ie the person "behind" the machine running IMSpector, {remote id} is the person "in front" of the IMSpector machine, and the last item is obviously the date of the chat.

The local and remote IDs are different depending on the protocol. For MSN it is the persons registered passport email addresss, for AIM and ICQ it is just a simple string (ICQ is now the same as AIM but has a numeric user ID).

An actual log file will look something like this:

192.168.0.4:62013,1160853400,0,1,0,yep 
192.168.0.4:62013,1160853401,0,1,0,:~)
192.168.0.4:62013,1160853407,1,1,0,smoothie should be in the other rack

Columns are:

  1. IP address:Port of the client machine.
  2. UNIX timestamp.
  3. Outgoing. 1 for an outgoing event, 0 for an incoming event.
  4. Type of event. Currently supported are:
    • 1 - Message.
    • 2 - File transfer. Some protocols only.
    • 3 - Typing event. User is typing a message. Some protocols only.
    • 4 - Webcam event. User requested a webcam session. Yahoo only presently.
  5. Filtered. 0 means the message was not filtered (blocked), 1 means it was. Does not relate to content manipulation, but rather ACLs and other filter plugins.
  6. The event data, which for messages happens to be what ever was said. For file transfers, the name and length is logged here. Both the typing events and webcam events do not use this field. Note that the un-manipulated text is logged, ie. before it has been censored for bad words, if the option is enabled. If the message includes embedded new-lines, they are backslashed as \n. Note that, depending on the client software and protocol, the message may contain embedded HTML or other formatting elements.

MySQL logging

MySQL support is not built unless you invoke the make mysqlloggingplugin.so target. Of course, the client side C MySQL library is required to build this plugin. It adds the following options to the config file:

  • mysql_server - The hostname of the DB server.
  • mysql_database - The database name in the server.
  • mysql_username and mysql_password - Login details for the DB.

The table in the database should be called "messages". The following SQL can be used to be create it:

CREATE TABLE `messages` (
        `id` int(11) NOT NULL auto_increment,
        `timestamp` int(11) NOT NULL default '0',
	`clientaddress` text NOT NULL,
        `protocolname` text NOT NULL,
        `outgoing` int(11) NOT NULL default '0',
        `type` int(11) NOT NULL default '0',
        `localid` text NOT NULL,
        `remoteid` text NOT NULL,
        `filtered` int(11) NOT NULL default '0',
        `eventdata` blob NOT NULL,
        PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

If this table does not exist, and the DB user is capable of doing so, this table will automatically be created when IMSpector starts.

Note that only MySQL version 4 and 5 has been tested. Prepared statements are used for efficiency reasons and I believe that these will not work on version 3. Testing on this is welcome, as I am neither an MySQL or SQL bod. Then again, MySQL 3 is probably considered ancient.

The plugin supports some level of resiliance against server disconnects and other errors; if the server is remote and the connection between IMSpector and the DB server is broken, IMSpector will queue the events and periodically attempt a reconnection. When the connection is reestablished, the queued events will be logged at the database in one hit.

PostgreSQL logging

PostgreSQL support is not built unless you invoke the make postgresqlloggingplugin.so target. Of course, the clientside C PostgreSQL libary is needed to build this plugin. It adds the following options to the config file:

  • pgsql_connect - Connection paramaters.

The connection parameters are varied and it depends on the details of your client library and so on, but an example would be:

pgsql_connect=host=localhost dbname=imspector user=dbuser password=Password

The table in the database should be called "messages". The following SQL can be used to be create it:

CREATE TABLE messages (
        id serial primary key,
        "timestamp" timestamp with time zone default now(),
	clientaddress varchar,
        protocolname varchar,
        outgoing int default 0,
        type int default 0,
        localid varchar,
        remoteid varchar,
        filtered int default 0,
        eventdata text )

If this table does not exist, and the DB user is capable of doing so, this table will automatically be created when IMSpector starts.

The PostgreSQL plugin supports the same form of disconnected operation as the MySQL plugin.

SQLite logging

SQLite support is not built unless you invoke the make sqliteloggingplugin.so target. It adds the following options to the config file:

  • sqlite_file - The filename of the DB.

Once again, a "messages" table is required:

CREATE TABLE messages (
        id integer PRIMARY KEY AUTOINCREMENT,
        timestamp integer NOT NULL,
	clientaddress text NOT NULL, 
        protocolname text NOT NULL,
        outgoing integer NOT NULL,
        type integer NOT NULL,
        localid text NOT NULL,
        remoteid text NOT NULL,
        filtered integer NOT NULL,
        eventdata blob NOT NULL
);

This table is automatically created if it dosn't already exist.

Content manipulation

IMSpector is able to remove offensive words from all IM messages. Three config options are used:

  • badwords_filename - Should be pointed at a file of naughty words, one per line.
  • badwords_replace_character - Should be a single character. Bad words will be replaced with the character. Default is an asterisk.
  • badwords_block_count - If a message contains more then this many bad words then the message will be completely blocked, not just replaced.

This filter is by no means uncircumventable, but the supplied list of naughty words is enough to filter most strong swear words. The filter is not enabled by default.

File-backed filtering

In addition to content replacement, IMSpector is able to completely block messages and other events from reaching the recipient. This is useful for, say, limiting people to certain contacts, or from blocking a listed group of people. There are two implementations for this type of blocking: file based, and database (SQlite) based. In both cases, the mechanism used is a kind of ACL. In the file based filter, there are two lists: a blacklist and a whitelist. Inside these lists is a series of local IDs, tied to a list of remote IDs.

For example:

local@local.com: remote1@remote1.com remote2@remote2.com
1234: 5678 8765

If this list was used as a whitelist, for example, then 1234 could talk to 5678 and 87654, but none else. Likewise for the local@local.com user.

To enable ACL support, include the following options in the configuration file:

whitelist_filename=/path/to/file
blacklist_filename=/path/to/file

Of course, the file must be readable by the user IMSpector runs as.

Whitelists are processed first, so if a match is made on the whitelist then the blacklist is not examined. By default, if no match occures after all list processing then the request is allowed, but this behavior can be overridden:

block_unlisted=on

Database-backed filter

The DB-backed filter is not built by default. To build it, run make dbfilterplugin.so. SQLite client libraries are needed to build this plugin. It adds the following options to the config file:

  • db_filter_filename - The filename of the DB.

The table in this database will be called "lists", and will be automatically created if needed:

CREATE_TABLE "CREATE TABLE IF NOT EXISTS lists (
        id integer PRIMARY KEY AUTOINCREMENT,
        localid text,
        remoteid text,
        action integer NOT NULL,
        type integer NOT NULL,
        timestamp integer NOT NULL );

localid and remoteid may be NULL, which means when a search is done for an entry, it will match any value.

"action" can be one of the following values:

  • 1 - ACCEPT - allow the message to pass.
  • 2 - BLOCK - reject the message.
  • 3 - AWL - matching outgoing messages will have the localid and remote id automatically inserted as ACCEPT rules, so replies can pass.

"type" can be one of the following values:

  • 1 - MANUAL - the type value to use for manually added rules.
  • 2 - AUTO - AWL entries will be given ths type.

The timestamp is set when an entry is created by the AWL rules and is useful if one wished to, say, remove all entries over a month old.

The matching logic is as follows:

  1. First look for matches with action=ACCEPT, allowing the messages if we find any
  2. If a message is outgoing, then look for action=AWL. If we find a match, then allow this message to pass, and automatically create a rule with action=ACCEPT and type=AUTO.
  3. Look for a match with action=REJECT, blocking the message if we find any.
  4. Finally, allow the message.

Note that the ordering of rules within the table is not relevent; only the fact that a match was found somewhere in the table is important.

Example: to enable AWL for all local users except the user example@company.com - which is to always be allowed, create three rows:

  1. localid=example@company.com, remoteid=NULL, action=ACCEPT, type=MANUAL
  2. localid=NULL, remoteid=NULL, action=AWL, type=MANUAL
  3. localid=NULL, remoteid=NULL, action=BLOCK, type=MANUAL

Note 1: because of the way SQLite works, you can freely modify the table from outside of IMSpetor, while it is still running, without any problems.

Note 2: What would happen if this filter was combined with the file-based ACL filter is unclear.

Other blocking

Also two additional, global, options are available that are applied regardless of the outcome of ACL processing:

block_files=on

This option will block all file-transfers on all protocols that IMSpector is watching and understand file-transfers..

block_webcams=on

This option will block all webcam sessions. Currently IMSpector can only spot webcam sessions on Yahoo.

NOTES

Please skip this over if the thought of C++ objects, dynamic linking, and other stuff sends you into a coma.

Some readers might be wondering how IMSpector can log the messages without knowing all about the protocols involved. Luckily, you don't have to understand all of it, only the packets relevent to the events you are interested in. Everything else is simply passed between the client machine and the server. Essentially IMSpector is well capable of transparently proxying pretty much any TCP protocol. Luckily most IM protocols are fairly simple, at least as far as messages between users is concerned. The complicated stuff is in the handling of contact lists etc. IMSpector was written from following the work of some good people who have deconstructed various IM protocols, and by me looking at packet captures, and quite abit of trial and error.

Language wise, IMSpector is written in a strange dialect of C++ called "Lawrence's C++". I like the language, but I will not overuse inheritance, operator overloading or any fancy OO techniques. Character arrays are sometimes easier to use then std::strings so I use them.

The plugins are implemented as objects of a defined class which call to an implementation within a single object-less C file through dynamic runtime linking. On program start, the plugins are located via a glob call and then an object is created, the plugins init function called via the object, and then (assuming the init was successful) pushed onto a vector of objects. Logging plugins, protocol plugins, content-manipulation plugins and filtering plugins are very simular at this level.

The main.cpp file contains standard deamon-type code, including code to drop privs etc. The deamon operates in the classical fork-on-connect method. A child handles an outgoing connection. One of the first things a child does is work out the protocol the client is speaking. It does this by looking at the "original address" that the client was trying to reach before it was redirected and iterates down its vector of protocol plugins looking for this port. If it finds a match, it has a protocol class. At this point it also has to complete the connection to the server the client is trying to reach. Otherwise it will drop the connection, and log a message to the effect of "I don't know how to handle that protocol".

Inside the client handler (doproxy() in main.cpp) the program shuffles data between the client and the remote IM server using well-known techniques - a socket class (a thin layer atop the socket FD) is used. The protocol plugin is called with the socket object and other parameters. This protocol plugin implementation will then get the packets and assuming it contains a message it will push a so-called imevent onto a vector of imevents, which will then be passed to each logging plugin in turn. The protocol plugin will also copy the data to send back to the other party in a buffer supplied by the connection handler code.

Filtering is achieved by simply discarding packets that do not pass as clean through the filtering plugins, if any have been configured.

These plugins are also able to modify the data, which is then copied back into the packets for sending. Currently only a single plugin of this type has been implemented for the purposes of filtering swear words, but in the future other plugins could be written which don't replace text but simply generate some kind of alert when a particular word is spotted (for example). Also, it would be trivial to write a plugin to remove conent based on a collection of regular expressions.

Logging action is done in a single child process, with communication to the client handlers via a UNIX socket. The socket class (class Socket) can handle both TCP/UDP and UNIX sockets. The reason for using a logging process is that some logging mechanisms, most noteably MySQL, do not like having data transfers done on the same handle within different processes, and it would be much to slow and expensive to connect to the DB within each and every child.

TODO AND FUTURE PLANS

This is broadly broken down into 4 areas: cleanups, protocols, logging, and other.

Cleanups

  • Autoconf support - This would be nice. Means it could check for the presence of MySQL and build the plugin if it finds support for it. Also would give IMSpector more "acceptance". Autoconf looks a bastard though. :(
  • Security audit - Would be great to have someone look over the code and find the potential buffer problems and the like.
  • Custom string class - Right now IMSpector uses std::string and also the odd character array, because string lacks things, especially formatted printing. There are a few alternative string classes to look at; I'm sure one would be suitable. Or I could take the DIY approach.
  • Better socket getline - Currently the implementation for reading upto a \n from a socket sucks, to put it simply. Need a buffering read-a-line code.
  • Chroot support - This would be a very nice feature and go a long way to mitigating any security issues with IMSpector.
  • Fork-pool model - This would speed things up abit on very busy systems with loads of clients.

More protocols

  • Jabber/GoogleTalk - Should be fun. This protocol (at least with Google Talk) agressivly switches to TLS, which makes logging of messages impossible. A possible solution is to rewrite the TLS handshake XML to remove the request to switch to TLS.
  • MySpaceIM - Looks doable, but the server runs on many ports so this could be difficult for IMSpector to capture.

Logging

  • Other DB systems - Oracle etc.

Other

This is a collection of fairly random ideas, some of which are fairly trivial to implement, some are much harder.

  • Generating a warning message - One interesting idea is to generate our own messages from within the proxy. Such a message could be sent to both parties at the start of a chat to tell them that this chat will be logged. Simple experiments show that it is not too hard to generate MSN messages from within the proxy.
  • AV scanning - Would be very involved, but theoreticaly possible to hold files as they are transfered and only send the file onto the client if it passes AV scanning.
  • Regex-based text replacement - This could have many uses, from censoring peoples chats to stopping exploit attempts. While the current system of content replacement works, it could be better!
FEEDBACK

There are two mailing lists:

imspector-users@lists.sourceforge.net - IMSpector Users

To join the list, send a mail with "subscribe" in the subject to:

imspector-users-request@lists.sourceforge.net

This mailing list is meant for ordinary users of IMSpector.

imspector-devel@lists.sourceforge.net - IMSpector Devel

To join the list, send a mail with "subscribe" in the subject to:

imspector-devel-request@lists.sourceforge.net

This mailing list is meant for programmers and other dev-types.

You may also email me (Lawrence) directly, if you wish. I cannot guarantee to reply. My email address is as follows:

lawrence at aslak dot net

We are interested to hear from anyone who has downloaded and attempted to use IMSpector. If you have any problems getting it running, someone on the mailing lists can probably help. If IMSpector works for you then we'd would love to hear about it. Also, of course, please send any patches and bug reports.

REFERENCES AND LINKS