コード例 #1
0
def main(inner,username,password):
    collabinstance = sys.argv[1]
    delay = float(sys.argv[2])
    if re.search('[^a-z|0-9|\.]',collabinstance):
        print 'non-allowed chars in collab instance'
        sys.exit(1)

        
    xmppuser = '******' % (re.sub('@','%',username))
    xmppmucs = "conference.clarifiednetworks.com"
    room = "%s@%s" % (collabinstance,xmppmucs)

    myxmpp = yield xmpp.connect(xmppuser,password)
    myxmpp.core.presence()
    room = yield myxmpp.muc.join(room,"/collablogger")
    print 'joined room'                                                      
    collab = CLIWiki('https://www.clarifiednetworks.com/collab/%s/' %
                     (collabinstance))
    collab.authenticate(username=username,password=password)

    attachFilename = "log.txt"
    basePage = "CollabChatLog"
    
    txt2collab = Txt2Collab(collab,basePage,attachFilename,
                            timestampformat="%Y-%m-%d")
    srcjid_filter = "conference.clarifiednetworks.com"

    yield inner.sub(room |roomparser(srcjid_filter)|
                    logger(txt2collab,0,delay) )
コード例 #2
0
ファイル: 02-read-room.py プロジェクト: Rafiot/Abusehelper
def main(inner, jid, password, roomname):
    # Join the XMPP network
    conn = yield xmpp.connect(jid, password)

    # Join the XMPP room
    room = yield conn.muc.join(roomname, "bot")

    # Pipe XML elements from the room to read_room
    yield room | read_room()
コード例 #3
0
ファイル: bridgebot.py プロジェクト: Rafiot/Abusehelper
    def _join(inner, self, _type, jid, password, room_name):
        self.log.info("Connecting to XMPP %s server with JID %r", _type, jid)
        connection = yield inner.sub(xmpp.connect(jid, password))
        
        self.log.info("Connected to XMPP %s server with JID %r", _type, jid)
        connection.core.presence()

        self.log.info("Joining %s room %r", _type, room_name)
        room = yield inner.sub(connection.muc.join(room_name, self.bot_name))
        
        self.log.info("Joined %s room %r", _type, room_name)
        inner.finish(room)
コード例 #4
0
ファイル: bot.py プロジェクト: Exploit-install/abusehelper
    def xmpp_connect(self):
        verify_cert = not self.xmpp_ignore_cert

        self.log.info("Connecting to XMPP service with JID " + repr(self.xmpp_jid))
        xmpp = yield connect(
            self.xmpp_jid, self.xmpp_password,
            host=self.xmpp_host,
            port=self.xmpp_port,
            ssl_verify_cert=verify_cert,
            ssl_ca_certs=self.xmpp_extra_ca_certs)
        self.log.info("Connected to XMPP service with JID " + repr(self.xmpp_jid))
        idiokit.stop(xmpp)
コード例 #5
0
ファイル: 03-forward-room.py プロジェクト: Rafiot/Abusehelper
def main(inner, jid, password, src_roomname, dst_roomname):
    # Join the XMPP network
    conn = yield xmpp.connect(jid, password)

    # Join the XMPP rooms
    src = yield conn.muc.join(src_roomname, "bot")
    dst = yield conn.muc.join(dst_roomname, "bot")

    # Forward body elements from the src room to the dst room,
    # but filter away stuff by the bot itself to avoid nasty loops.
    own_jid = src.nick_jid
    yield src | room_filter(own_jid) | dst | threado.dev_null()
コード例 #6
0
    def xmpp_connect(self):
        verify_cert = not self.xmpp_ignore_cert

        self.log.info("Connecting to XMPP service with JID " + repr(self.xmpp_jid))
        xmpp = yield connect(
            self.xmpp_jid, self.xmpp_password,
            host=self.xmpp_host,
            port=self.xmpp_port,
            ssl_verify_cert=verify_cert,
            ssl_ca_certs=self.xmpp_extra_ca_certs)
        self.log.info("Connected to XMPP service with JID " + repr(self.xmpp_jid))
        idiokit.stop(xmpp)
コード例 #7
0
ファイル: 01-join-room.py プロジェクト: Rafiot/Abusehelper
def main(inner, jid, password, roomname):
    # Join the XMPP network
    conn = yield xmpp.connect(jid, password)

    # Join the XMPP room
    room = yield conn.muc.join(roomname, "bot")

    # Create an XML body element and send it to the room
    body = xmpp.Element("body")
    body.text = "EHLO World"
    room.send(body)

    # Exit the room
    yield room.exit("Gotta go / feel the funky flow / yo")
コード例 #8
0
ファイル: xmpp-echobot.py プロジェクト: abusesa/idiokit
def main():
    xmpp = yield connect(raw_input("Username: "******"Channel: "))

    while True:
        elements = yield room.next()

        for message in elements.named("message").with_attrs("from"):
            sender = jid.JID(message.get_attr("from"))
            if sender == room.jid:
                continue

            for body in message.children("body"):
                yield room.send(body)
コード例 #9
0
    def _join(self, _type, jid, password, host, port, ignore_cert, ca_certs, room_name):
        verify_cert = not ignore_cert

        self.log.info("Connecting to XMPP %s server with JID %r", _type, jid)
        connection = yield xmpp.connect(
            jid, password,
            host=host,
            port=port,
            ssl_verify_cert=verify_cert,
            ssl_ca_certs=ca_certs)

        self.log.info("Connected to XMPP %s server with JID %r", _type, jid)
        connection.core.presence()

        self.log.info("Joining %s room %r", _type, room_name)
        room = yield connection.muc.join(room_name, self.bot_name)

        self.log.info("Joined %s room %r", _type, room_name)
        idiokit.stop(room)
コード例 #10
0
ファイル: bridgebot.py プロジェクト: heikipikker/abusehelper
    def _join(self, _type, jid, password, host, port, ignore_cert, ca_certs,
              room_name):
        verify_cert = not ignore_cert

        self.log.info("Connecting to XMPP %s server with JID %r", _type, jid)
        connection = yield xmpp.connect(jid,
                                        password,
                                        host=host,
                                        port=port,
                                        ssl_verify_cert=verify_cert,
                                        ssl_ca_certs=ca_certs)

        self.log.info("Connected to XMPP %s server with JID %r", _type, jid)
        connection.core.presence()

        self.log.info("Joining %s room %r", _type, room_name)
        room = yield connection.muc.join(room_name, self.bot_name)

        self.log.info("Joined %s room %r", _type, room_name)
        idiokit.stop(room)
コード例 #11
0
ファイル: alerta2xmpp.py プロジェクト: regit/CDMCS-1
    def __init__(self, name=None):

        self.xmpp = yield connect(XMPP_USER, XMPP_PASS)
        self.room = yield xmpp.muc.join(XMPP_MUC)

        super(XMPP, self).__init__(name)
コード例 #12
0
ファイル: bot.py プロジェクト: Rafiot/Abusehelper
 def xmpp_connect(inner, self):
     self.log.info("Connecting to XMPP server with JID %r", self.xmpp_jid)
     xmpp = yield inner.sub(connect(self.xmpp_jid, self.xmpp_password))
     self.log.info("Connected to XMPP server with JID %r", self.xmpp_jid)
     xmpp.core.presence()
     inner.finish(xmpp)