PySilc is a near-complete set of Python bindings for creating SILC clients using the silc-toolkit. It allows developers to write simple bots and clients for connecting to SILC servers.

Also included is a simple test client bot in 'examples/' and a experimental SILC driver for Supybot.


Building and Installing

  • python build
  • python install (as root)

Authors and License

Copyright (c) 2006. Alastair Tse Licensed under the BSD License. See COPYING for details.

Usage Overview

All the classes are documented using Python Docstrings. You can see descriptions of classes and modules by simply using pydoc or help() in the python console.

All the functionality is contained within the module 'silc'.

The main classes are as follows:

SilcClient - This is the main class that represents a SILC client. You must subclass SilcClient and override some key callback methods.

SilcKeys - Represents a pair of public and private keys that can be generated using 'silc.loadkeypair()' and 'silc.createkeypair()'.

SilcUser - Represents a user on a SILC server. You will not create these automatically but will be able to access them by

Callbacks Overview

The majority of the work will be to write callbacks that react to messages the server sends to the client. These can be either asynchronous events such as channel messages, or responses to commands that are sent by the client.

Callbacks are callable members of the SilcClient class (or subclass) and their signature is on the SilcClient docstring. An example implementation would look like this:

import silc

class EchoClient(silc.SilcClient):
 def channel_message(self, sender, channel, flags, message):
      print message
      self.send_channel_message(channel, message)

  def private_message(self, sender, flags, message):
      print message
      self.send_private_message(sender, message)

  def connected(self):
      print "* Connected"
      self.command_call("JOIN crazybotchannel")

  def disconnected(self):
      print "* Disconnected"

  # catch responses to commands

  def command_reply_join(self, channel, name, topic, hmac, x, y,

      print "* Joined channel %s" % name
      self.send_channel_message(channel, "Hello!")
 # catch async notifications from the server

  def notify_join(self, user, channel):
      print "* A user named %s has joined the channel %s" % \
            (user.username, channel.channel_name)
      self.send_channel_message(channel, "Hello, %s" %

if __name__ == "__main__":
   keys = silc.create_key_pair("", "silc.prv")
   client = EchoClient(keys, "echobot", "echobot", "Echo Bot")

   while True:
     except KeyboardInterrupt:

You can reply to me about this on Twitter: