Exemple #1
0
def count_notes(workspace=None):
    validate_workspace(workspace)
    get_logger(__name__).debug("Request parameters: {!r}"\
        .format(request.args))

    services_dao = NoteDAO(workspace)
    result = services_dao.count()
    if result is None:
        abort(400)

    return jsonify(result)
Exemple #2
0
def count_notes(workspace=None):
    validate_workspace(workspace)
    get_logger(__name__).debug("Request parameters: {!r}"\
        .format(request.args))

    services_dao = NoteDAO(workspace)
    result = services_dao.count()
    if result is None:
        abort(400)

    return jsonify(result)
Exemple #3
0
def list_notes(workspace=None):

    validate_workspace(workspace)
    get_logger(__name__).debug("Request parameters: {!r}".format(request.args))

    note_filter = filter_request_args()

    dao = NoteDAO(workspace)

    result = dao.list(note_filter=note_filter)

    return jsonify(result)
Exemple #4
0
def list_notes(workspace=None):
    
    validate_workspace(workspace)
    get_logger(__name__).debug(
        "Request parameters: {!r}".format(request.args))

    note_filter = filter_request_args()

    dao = NoteDAO(workspace)

    result = dao.list(note_filter=note_filter)

    return jsonify(result)
Exemple #5
0
def workspace_summary(workspace=None):
    validate_workspace(workspace)

    services_count = ServiceDAO(workspace).count()
    vuln_count = VulnerabilityDAO(workspace).count(vuln_filter=flask.request.args)
    host_count = HostDAO(workspace).count()
    iface_count = InterfaceDAO(workspace).count()
    note_count = NoteDAO(workspace).count()

    response = {
        'stats': {
            'services':    services_count.get('total_count', 0),
            'total_vulns': vuln_count.get('total_count', 0),
            'web_vulns':   vuln_count.get('web_vuln_count', 0),
            'std_vulns':   vuln_count.get('vuln_count', 0),
            'hosts':       host_count.get('total_count', 0),
            'interfaces':  iface_count.get('total_count', 0),
            'notes':       note_count.get('total_count', 0),
        }
    }

    return flask.jsonify(response)
Exemple #6
0
def workspace_summary(workspace=None):
    validate_workspace(workspace)

    services_count = ServiceDAO(workspace).count()
    vuln_count = VulnerabilityDAO(workspace).count(vuln_filter=flask.request.args)
    host_count = HostDAO(workspace).count()
    iface_count = InterfaceDAO(workspace).count()
    note_count = NoteDAO(workspace).count()

    response = {
        'stats': {
            'services':    services_count.get('total_count', 0),
            'total_vulns': vuln_count.get('total_count', 0),
            'web_vulns':   vuln_count.get('web_vuln_count', 0),
            'std_vulns':   vuln_count.get('vuln_count', 0),
            'hosts':       host_count.get('total_count', 0),
            'interfaces':  iface_count.get('total_count', 0),
            'notes':       note_count.get('total_count', 0),
        }
    }

    return flask.jsonify(response)