Beispiel #1
0
    def __init__(self, login, password, server):
        self.client = Client(server, debug=[])

        self.client.connect()
        if not self.client.auth(login, password):
            self.client.disconnect()
            raise JabberAuthException()
Beispiel #2
0
 def __init__(self, args):
     self.args = args
     self.xmpp = Client(self.args.jid,
                        self.args.password,
                        pubsub=False,
                        priority=127)
     self.xmpp.run(args.server, threaded=True)
     self.pubsub = self.xmpp['xep_0060']
Beispiel #3
0
    def reconnect(self):
        try:
            time.sleep(7)
            self.client.disconnect()
        except:
            pass

        if self.debug:
            self.client = Client(self.jid.getDomain())
        else:
            self.client = Client(self.jid.getDomain(), debug=[])

        try:
            if not self.connect():
                self.reconnect()
        except:
            self.reconnect()
Beispiel #4
0
 def send(self, recipients, message):
     """Send message to recipients via xmpp."""
     jid = JID(self.user)
     if self.server:
         server = self.server
     else:
         server = jid.getDomain()
     cl = Client(server, port=self.port, debug=[])
     if not cl.connect():
         raise IOError("Couldn't connect to xmpp server %s" % server)
     if not cl.auth(jid.getNode(), self.password, resource=self.resource):
         cl.Connection.disconnect()
         raise IOError("Xmpp auth erro using %s to %s", jid, server)
     for recip in recipients:
         cl.send(Message(recip[2], message))
Beispiel #5
0
def xmppBrute0x00(ip, usernames, passwords, port, delay):
    client = Client(str(ip))
    client.connect(server=(str(ip), port))
    for username in usernames:
        for password in passwords:
            try:
                if client.auth(username, password):
                    client.sendInitPresence()
                    print(G + ' [+] Username: %s | Password found: %s\n' % (username, password))
                    client.disconnect()
            except Exception as e:
                print(R+" [-] Error caught! Name: "+str(e))
            except KeyboardInterrupt:
                client.disconnect()
                sys.exit(1)
            except:
                print(GR+ " [*] Checking : "+C+"Username: %s | "+B+"Password: %s "+R+"| Incorrect!\n" % (username, password))
                sleep(delay)
Beispiel #6
0
def _get_connected_client(account):
    client = Client(account['server'], debug=[])
    if not client.connect():
        logging.error(
            "Can not connect to %s server, please check your configuration",
            account['server'])
        raise IOError('Can not connect to server.')
    if not client.auth(account['user'], account['password'],
                       account['resource']):
        logging.error("Can not auth as %s@%s, please check your configuration",
                      account['user'], account['server'])
        raise IOError('Can not auth with server.')

    logging.info("Logged in as %s@%s", account['user'], account['server'])
    client.RegisterHandler('message', _handle_messages)
    client.sendInitPresence()
    client.Process(1)

    return client
Beispiel #7
0
def test():

	client = Client('localhost')

	def message_handler(conn, mess_node):
		client.send(Message('tim@localhost', 'reponse!'))

	if not client.connect(server=('127.0.0.1', 5222)):
		raise IOError('Can not connect to server.')

	if not client.auth('abitbol', 'abitbol', 'abitbol'):
		raise IOError('Can not auth with server.')

	client.RegisterHandler('message', message_handler)

	client.sendInitPresence()

	client.send(Message('tim@localhost', 'Test message'))

	while 1:
		client.Process(1)
Beispiel #8
0
    def connect(self):
        """
		Connects to an XMPP server.

		"""
        self.client = Client(self.domain)

        if not self.client.connect(server=(self.host, self.port)):
            raise IOError('Cannot connect to server.')

        if not self.client.auth(self.user, self.password, self.presence):
            raise IOError('Cannot auth with server.')

        self.client.RegisterHandler('message', message_handler)

        self.client.sendInitPresence()

        self.connected = True

        while True:
            self.client.Process(1)