Esempio n. 1
0
def put_system_network_interface(system_id, iface):
    promisc = request.args.get("promisc")
    if promisc is not None:
        if not is_json_boolean(promisc):
            current_app.logger.error("network: put_system_network_interface error: Bad param 'promisc='%s'" % promisc)
            return make_bad_request("Bad param 'promisc=%s'" % promisc)
    else:
        current_app.logger.error("network: put_system_network_interface error: Missing parameter 'promisc'")
        return make_bad_request("Missing parameters")

    (success, msg) = put_interface(system_id, iface, is_json_true(promisc))
    if not success:
        current_app.logger.error("network: put_system_network_interface error: " + str(msg))
        return make_error(msg, 500)

    return make_ok()
Esempio n. 2
0
def get_pending_packages(system_id):
    """Get pending update packages from a given AlienVault system

    The blueprint handle the following url:
    GET /av/api/1.0/system/<system_id>/status/pending_packages

    Args:
        system_id (str): String with system id (uuid) or local

    """
    no_cache = request.args.get('no_cache')
    if not is_json_boolean(no_cache):
        return make_error("Invalid value for the no_cache parameter", 500)
    no_cache = is_json_true(no_cache)
    success, result = apimethod_get_pending_packges(system_id, no_cache)
    if not success:
        api_log.error("Error: " + str(result))
        return make_error("Cannot retrieve packages status " + str(result), 500)
    return make_ok(available_updates=result)
Esempio n. 3
0
def get_pending_packages(system_id):
    """Get pending update packages from a given AlienVault system

    The blueprint handle the following url:
    GET /av/api/1.0/system/<system_id>/status/pending_packages

    Args:
        system_id (str): String with system id (uuid) or local

    """
    no_cache = request.args.get('no_cache')
    if not is_json_boolean(no_cache):
        return make_error("Invalid value for the no_cache parameter", 500)
    no_cache = is_json_true(no_cache)
    success, result = apimethod_get_pending_packges(system_id, no_cache)
    if not success:
        api_log.error("Error: " + str(result))
        return make_error("Cannot retrieve packages status " + str(result), 500)
    return make_ok(available_updates=result)
Esempio n. 4
0
def put_system_network_interface(system_id, iface):
    promisc = request.args.get("promisc")
    if promisc is not None:
        if not is_json_boolean(promisc):
            current_app.logger.error(
                "network: put_system_network_interface error: Bad param 'promisc='%s'"
                % promisc)
            return make_bad_request("Bad param 'promisc=%s'" % promisc)
    else:
        current_app.logger.error(
            "network: put_system_network_interface error: Missing parameter 'promisc'"
        )
        return make_bad_request("Missing parameters")

    (success, msg) = put_interface(system_id, iface, is_json_true(promisc))
    if not success:
        current_app.logger.error(
            "network: put_system_network_interface error: " + str(msg))
        return make_error(msg, 500)

    return make_ok()
Esempio n. 5
0
def get_remote_software_status(system_id):
    """Get the software status from a given AlienVault system or all systems

    The blueprint handle the following url:
    GET /av/api/1.0/system/<system_id>/status/software

    Args:
        system_id (str): String with system id (uuid) local or all

    """
    no_cache = request.args.get('no_cache')
    if not is_json_boolean(no_cache):
        return make_error("Invalid value for the no_cache parameter", 500)
    no_cache = is_json_true(no_cache)

    success, result = apimethod_get_remote_software_update(system_id, no_cache)
    if not success:
        api_log.error("Error: " + str(result))
        return make_error("Cannot retrieve packages status " + str(result), 500)

    return make_ok(**result)
Esempio n. 6
0
def get_remote_software_status(system_id):
    """Get the software status from a given AlienVault system or all systems

    The blueprint handle the following url:
    GET /av/api/1.0/system/<system_id>/status/software

    Args:
        system_id (str): String with system id (uuid) local or all

    """
    no_cache = request.args.get('no_cache')
    if not is_json_boolean(no_cache):
        return make_error("Invalid value for the no_cache parameter", 500)
    no_cache = is_json_true(no_cache)

    success, result = only_one_call_without_caching(apimethod_get_remote_software_update)(system_id, no_cache)
    if not success:
        api_log.error("Error: " + str(result))
        return make_error("Cannot retrieve packages status " + str(result), 500)

    return make_ok(**result)