Example #1
0
    def __init__(self, key, server="https://otx.alienvault.com/"):
        self.key = key
        self.server = server
        self.url_base = "%sapi/v1" % server

        self.pulse_db = PulseDB()
        self.pulse_correlation_db = PulseCorrelationDB()

        self.date_types = {
            "events": "latest_events_call_date",
            "subscribed": "latest_subscribed_call_date"
        }
Example #2
0
    def __init__(self, key, server="https://otx.alienvault.com/"):
        self.key = key
        self.server = server
        self.url_base = "{}api/v1".format(server)
        self.avproxy = AVProxy()
        self.pulse_db = PulseDB()
        self.pulse_correlation_db = PulseCorrelationDB()

        self.date_types = {
            "events": "latest_events_call_date",
            "subscribed": "latest_subscribed_call_date"
        }
        self.otx_user_version = self.get_otx_user_version()
Example #3
0
def apimethod_remove_otx_account():
    """Remove the OTX configuration from the database

    Returns:
        success (bool): True if successful, False elsewhere
        result(string): Error message if there was an error or empty string otherwise.
    """
    #Removing the OTX config vars
    keys = [
        "open_threat_exchange", "open_threat_exchange_key",
        "open_threat_exchange_username", "open_threat_exchange_user_id",
        "open_threat_exchange_last", "open_threat_exchange_latest_update",
        "open_threat_exchange_key_version"
    ]

    for k in keys:
        success, info = db_set_config(k, "")
        if not success:
            api_log.error("[apimethod_remove_otx_account] %s" % str(info))
            return False, str(info)

    #Removing the pulse database
    try:
        pulse_db = PulseDB()
        pulse_correlation_db = PulseCorrelationDB()

        pulse_db.flush_db()
        pulse_correlation_db.purge_all()
        pulse_correlation_db.sync()

        del pulse_db
        del pulse_correlation_db
    except Exception as err:
        api_log.error("[apimethod_remove_otx_account] %s" % str(err))
        return False, "Error removing OTX Account: Pulse List Cannot Be removed at this time."

    return True, ""