def query_db_creds(self):
        """
        Queries the database for credentials to be used for authentication.
        Valid cred_id values are:
            - a single cred_id
            - a range specified with a dash (ex. 1-5)
            - 'all' to select all credentials

        :return: domain[], username[], owned[], secret[], cred_type[]
        """
        domain = []
        username = []
        owned = []
        secret = []
        cred_type = []
        creds = []  # list of tuples (cred_id, domain, username, secret, cred_type, pillaged_from) coming from the database
        data = []  # Arbitrary data needed for the login, e.g. ssh_key

        for cred_id in self.args.cred_id:
            if isinstance(cred_id, str) and cred_id.lower() == 'all':
                creds = self.db.get_credentials()
            else:
                if not self.db.get_credentials(filter_term=int(cred_id)):
                    self.logger.error('Invalid database credential ID {}!'.format(cred_id))
                    continue
                creds.extend(self.db.get_credentials(filter_term=int(cred_id)))

        for cred in creds:
            c_id, domain_single, username_single, secret_single, cred_type_single, pillaged_from = cred
            domain.append(domain_single)
            username.append(username_single)
            owned.append(False)  # As these are likely valid we still want to test them if they are specified in the command line
            secret.append(secret_single)
            cred_type.append(cred_type_single)

        if len(secret) != len(data): data = [None] * len(secret)
        return domain, username, owned, secret, cred_type, data

        Queries the database for credentials to be used for authentication.
        Valid cred_id values are:
            - a single cred_id
            - a range specified with a dash (ex. 1-5)
            - 'all' to select all credentials

        :return: domain[], username[], owned[], secret[], cred_type[]
        
cme/connection.py