pyirccat is a self contained irccat clone written in Python. It was primarily developed for use at Lovestruck.com which uses IRC extensively for logging and reporting various things from servers back to IRC. Pull requests, comments etc are welcome.
First, irccat doesn't support SSL enabled IRC servers, which if your IRC servers are SSL only presents a bit of a problem. Second, other irccat clones usually have some dependency on a big external IRC/networking library (twisted, irclib and various others) and I just wanted something simple and lightweight which is trivially installed -- Lovestruck was rolling a JRE in production just to support catting things back to IRC, which seemed a bit silly. Third, because I'm the kind of idiot who enjoys being subjected to sockets programming and threads. pyirccat's only external dependency is pyOpenSSL (which is fair enough, right?)
pyirccat listens on a specific ip and port and writes incoming data back to an irc channel. This is useful for sending various things (logs, whatever) to IRC from shell scripts or whatever else. As previously mentioned, it supports plain and SSL enabled IRC servers, and password protected IRC servers too.
> python pyirccat.py
usage: pyirccat.py [-h] -s HOST [-p PORT] [--password PASSWORD] [-n NICKNAME]
-c CHANNEL -ba BIND_ADDR -bp BIND_PORT [--ssl] [-v]
pyirccat - cat to irc
optional arguments:
-h, --help show this help message and exit
-s HOST, --server HOST
IRC Server hostname
-p PORT, --port PORT IRC Server port
--password PASSWORD IRC server password
-n NICKNAME, --nickname NICKNAME
Nickname of bot
-c CHANNEL, --channel CHANNEL
Channel to join, without # prefix
-ba BIND_ADDR, --bind-addr BIND_ADDR
IP to bind to
-bp BIND_PORT, --bind-port BIND_PORT
Port to bind to
--ssl Join server via SSL
--ssl-no-verify Disable SSL cert verification
-v, --verbose Noisy mode
Example:
> python pyirccat.py -s irc.freenode.net -p 6667 -n mybotnickname -c mychannel -ba 0.0.0.0 -bp 4444
then send some data to it (telnet, netcat, whatever - examples shown use netcat)
> echo "Hello World" | netcat -q0 localhost 4444
> tail -f /var/log/www/error.log | netcat localhost 4444
You can also prefix output with an arbitary channel to send to, e.g. -
> echo "#someotherchannel foo" | netcat -q0 localhost 4444
(would send to #someotherchannel even if you invoked the bot with a channel other than #someotherchannel)
Just make sure you've pyOpenSSL available, and it will be good to go on python 2.7+. Included is a pip requirements file which can be used via
> pip install -r requirements.txt
You'll probably need libffi in order to install pyopenssl (most linux package managers will have it readily available)