コード例 #1
0
 def __init__(self, irc, parent):
     self.nickname = conf.supybot.nick()
     self.username = conf.supybot.ident()
     self.realname = conf.supybot.user()
     
     keybase = os.path.join(conf.supybot.directories.conf(), 'silckey')
     pubkey = keybase + '.pub'
     privkey = keybase + '.prv'
     self.keys = None
     if os.path.exists(pubkey) and os.path.exists(privkey):
         self.keys = silc.load_key_pair(pubkey, privkey)
     else:
         self.keys = silc.create_key_pair(pubkey, privkey)
         
     silc.SilcClient.__init__(self, self.keys,
                              self.nickname,
                              self.username,
                              self.realname)
     
     self.irc = irc
     self.parent = parent
     self.isconnected = False
     self.last_ping = 0
     self.users = {}    # use this to lookup nick to SilcUser objects
     self.channels = {} # use this to lookup channels to SilcChannel objects
コード例 #2
0
    def __init__(self, irc, parent):
        self.nickname = conf.supybot.nick()
        self.username = conf.supybot.ident()
        self.realname = conf.supybot.user()

        keybase = os.path.join(conf.supybot.directories.conf(), SILC_KEY_NAME)
        pubkey = keybase + '.pub'
        privkey = keybase + '.prv'
        self.keys = None

        if os.path.exists(pubkey) and os.path.exists(privkey):
            try:
                self.keys = silc.load_key_pair(pubkey, privkey, "")
            except RuntimeError:
                self.keys = silc.load_key_pair(pubkey, privkey, None)
        else:
            drivers.log.info("SILC: Generating Keys")
            self.keys = silc.create_key_pair(pubkey, privkey, passphrase=None)

        silc.SilcClient.__init__(self, self.keys, self.nickname, self.username,
                                 self.realname)

        self.irc = irc
        self.parent = parent
        self.last_ping = 0
        self.users = {}  # use this to lookup nick to SilcUser objects
        self.channels = {
        }  # use this to lookup channels to SilcChannel objects
コード例 #3
0
ファイル: Silc.py プロジェクト: hecko/pysilc
    def __init__(self, irc, parent):
        self.nickname = conf.supybot.nick()
        self.username = conf.supybot.ident()
        self.realname = conf.supybot.user()

        keybase = os.path.join(conf.supybot.directories.conf(), SILC_KEY_NAME)
        pubkey = keybase + '.pub'
        privkey = keybase + '.prv'
        self.keys = None

        if os.path.exists(pubkey) and os.path.exists(privkey):
            try:
                self.keys = silc.load_key_pair(pubkey, privkey, "")
            except RuntimeError:
                self.keys = silc.load_key_pair(pubkey, privkey, None)
        else:
            drivers.log.info("SILC: Generating Keys")
            self.keys = silc.create_key_pair(pubkey, privkey, passphrase=None)

        silc.SilcClient.__init__(self, self.keys,
                                 self.nickname,
                                 self.username,
                                 self.realname)

        self.irc = irc
        self.parent = parent
        self.last_ping = 0
        self.users = {}    # use this to lookup nick to SilcUser objects
        self.channels = {} # use this to lookup channels to SilcChannel objects
コード例 #4
0
ファイル: silcplugin.py プロジェクト: gipi/Richie
 def __init__(self, config=None, dir=None):
   madcow.Madcow.__init__(self, config, dir)
   self.colorlib = ColorLib('mirc')
   keys = silc.create_key_pair("silc.pub", "silc.priv", passphrase="")
   nick = self.config.silcplugin.nick
   silc.SilcClient.__init__(self, keys, nick, nick, nick)
   self.channels = self._delim.split(self.config.silcplugin.channels)
コード例 #5
0
ファイル: silc.py プロジェクト: shoosen/ibid
 def __init__(self, name):
     IbidSourceFactory.__init__(self, name)
     self.log = logging.getLogger('source.%s' % self.name)
     pub = join(ibid.options['base'], self.public_key)
     prv = join(ibid.options['base'], self.private_key)
     if not exists(pub) and not exists(prv):
         keys = create_key_pair(pub, prv, passphrase='')
     else:
         keys = load_key_pair(pub, prv, passphrase='')
     self.client = SilcBot(keys, self.nick, self.nick, self.realname, self)
コード例 #6
0
ファイル: silc.py プロジェクト: B-Rich/ibid-1
 def __init__(self, name):
     IbidSourceFactory.__init__(self, name)
     self.log = logging.getLogger('source.%s' % self.name)
     pub = join(ibid.options['base'], self.public_key)
     prv = join(ibid.options['base'], self.private_key)
     if not exists(pub) and not exists(prv):
         keys = create_key_pair(pub, prv, passphrase='')
     else:
         keys = load_key_pair(pub, prv, passphrase='')
     self.client = SilcBot(keys, self.nick, self.nick, self.realname, self)
コード例 #7
0
ファイル: silcplugin.py プロジェクト: compbrain/madcow
    def __init__(self, config, prefix, scheme=None):
        if scheme is None:
            scheme = COLOR_SCHEME
        madcow.Madcow.__init__(self, config, prefix, scheme)
        keys = silc.create_key_pair('silc.pub', 'silc.priv', passphrase='')
        nick = self.config.silcplugin.nick
        silc.SilcClient.__init__(self, keys, nick, nick, nick,
                                 serverpass=self.config.silcplugin.password)
        self.channels = madcow.delim_re.split(self.config.silcplugin.channels)
        self.curchannels = []

        # throttling
        self.delay = self.config.silcplugin.delay / float(1000)
        self.last_response = 0.0
コード例 #8
0
ファイル: scis.py プロジェクト: jomat/scis
    def __init__(self):
        keybase = tempfile.mkstemp("sciskey")[1]
        pubkey = keybase + '.pub'
        privkey = keybase + '.prv'
        self.keys = None
        if os.path.exists(pubkey) and os.path.exists(privkey):
            self.keys = silc.load_key_pair(pubkey, privkey)
        else:
            self.keys = silc.create_key_pair(pubkey, privkey)


        self.isconnected = False
        self.users = {}    # use this to lookup nick to SilcUser objects
        self.channels = {} # use this to lookup channels to SilcChannel objects
コード例 #9
0
ファイル: pysilc.py プロジェクト: Havvy/madcow
    def __init__(self, base, scheme=None):
        if scheme is None:
            scheme = COLOR_SCHEME
        Madcow.__init__(self, base, scheme=scheme)
        passphrase = settings.SILC_PASSPHRASE
        if not passphrase:
            passphrase = ''
        keys = silc.create_key_pair('silc.pub', 'silc.priv', passphrase=passphrase)
        nick = settings.BOTNAME
        silc.SilcClient.__init__(self, keys, nick, nick, nick)
        self.channels = settings.SILC_CHANNELS

        # throttling
        self.delay = settings.SILC_DELAY / float(1000)
        self.last_response = 0.0
コード例 #10
0
ファイル: demo.py プロジェクト: hecko/pysilc
    def __init__(self, irc=None):
        keybase = "./silckey"
        pubkey = keybase + ".pub"
        privkey = keybase + ".prv"
        self.keys = None
        if os.path.exists(pubkey) and os.path.exists(privkey):
            self.keys = silc.load_key_pair(pubkey, privkey)
        else:
            self.keys = silc.create_key_pair(pubkey, privkey)

        silc.SilcClient.__init__(self, keys=self.keys, nickname="bot", username="******")

        self.irc = irc
        self.isconnected = False
        self.users = {}  # use this to lookup nick to SilcUser objects
        self.channels = {}  # use this to lookup channels to SilcChannel objects
コード例 #11
0
    def __init__(self, base, scheme=None):
        if scheme is None:
            scheme = COLOR_SCHEME
        Madcow.__init__(self, base, scheme=scheme)
        passphrase = settings.SILC_PASSPHRASE
        if not passphrase:
            passphrase = ''
        keys = silc.create_key_pair('silc.pub',
                                    'silc.priv',
                                    passphrase=passphrase)
        nick = settings.BOTNAME
        silc.SilcClient.__init__(self, keys, nick, nick, nick)
        self.channels = settings.SILC_CHANNELS

        # throttling
        self.delay = settings.SILC_DELAY / float(1000)
        self.last_response = 0.0
コード例 #12
0
    def __init__(self, irc=None):
        keybase = './silckey'
        pubkey = keybase + '.pub'
        privkey = keybase + '.prv'
        self.keys = None
        if os.path.exists(pubkey) and os.path.exists(privkey):
            self.keys = silc.load_key_pair(pubkey, privkey)
        else:
            self.keys = silc.create_key_pair(pubkey, privkey)

        silc.SilcClient.__init__(self,
                                 keys=self.keys,
                                 nickname="bot",
                                 username="******")

        self.irc = irc
        self.isconnected = False
        self.users = {}  # use this to lookup nick to SilcUser objects
        self.channels = {
        }  # use this to lookup channels to SilcChannel objects
コード例 #13
0
    def __init__(self, irc, parent):
        self.nickname = conf.supybot.nick()
        self.username = conf.supybot.ident()
        self.realname = conf.supybot.user()

        keybase = os.path.join(conf.supybot.directories.conf(), 'silckey')
        pubkey = keybase + '.pub'
        privkey = keybase + '.prv'
        self.keys = None
        if os.path.exists(pubkey) and os.path.exists(privkey):
            self.keys = silc.load_key_pair(pubkey, privkey)
        else:
            self.keys = silc.create_key_pair(pubkey, privkey)

        silc.SilcClient.__init__(self, self.keys, self.nickname, self.username,
                                 self.realname)

        self.irc = irc
        self.parent = parent
        self.isconnected = False
        self.last_ping = 0
        self.users = {}  # use this to lookup nick to SilcUser objects
        self.channels = {
        }  # use this to lookup channels to SilcChannel objects
コード例 #14
0
        self.command_call("JOIN #cam")

    def disconnected(self, msg):
        print "* Disconnected: %s" % msg

    # catch responses to commands

    def command_reply_join(self, channel, name, topic, hmac, x, y, users):

        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" % user.username)


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

    while True:
        try:
            client.run_one()
            time.sleep(0.2)
        except KeyboardInterrupt:
            break
コード例 #15
0
ファイル: echo.py プロジェクト: hecko/pysilc
      def disconnected(self, msg):
          print "* Disconnected: %s" % msg

      # catch responses to commands

      def command_reply_join(self, channel, name, topic, hmac, x, y,
          users):

          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" %
          user.username)

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

   while True:
       try:
           client.run_one()
           time.sleep(0.2)
       except KeyboardInterrupt:
           break