コード例 #1
0
def addSystem():
    g = request.args.get("groupName")
    t = request.args.get("team")
    n = request.args.get("notes")
    s = request.args.get("systems").split(";")
    components = []
    verifyAccess("system_group", "write", t, True)
    if len(request.args.get("components")) != 0:
        for x in request.args.get("components").split(","):
            components.append(Component(x.split("|")[1]))
    try:
        if vmdb.addSystemGroup(
            SystemGroup(groupID=None, groupName=g, team=t, notes=n, systems=s, components=components)
        ):
            status = ["system_added", "success"]
            error = ""
        else:
            status = ["action_failed", "error"]
            error = "Could not save the system to the database"
    except AlreadyExistsException:
        status = ["action_failed", "error"]
        error = "A group with this name already exists"
    except TeamRequiredException:
        status = ["action_failed", "error"]
        error = "There is no team selected to add this system group to."
    except InvalidVariableTypes:
        status = ["action_failed", "error"]
        error = "Some of the input is invalid"
    return jsonify({"status": status, "error": error, "groups": vmdb.getGroupVulns(t)})
コード例 #2
0
def addSystem():
    g = request.args.get('groupName')
    t = request.args.get('team')
    n = request.args.get('notes')
    s = request.args.get('systems').split(";")
    components = []
    verifyAccess("system_group", "write", t, True)
    if len(request.args.get('components')) != 0:
        for x in request.args.get('components').split(","):
            components.append(Component(x.split("|")[1]))
    try:
        if vmdb.addSystemGroup(
                SystemGroup(groupID=None,
                            groupName=g,
                            team=t,
                            notes=n,
                            systems=s,
                            components=components)):
            status = ["system_added", "success"]
            error = ""
        else:
            status = ["action_failed", "error"]
            error = "Could not save the system to the database"
    except AlreadyExistsException:
        status = ["action_failed", "error"]
        error = "A group with this name already exists"
    except TeamRequiredException:
        status = ["action_failed", "error"]
        error = "There is no team selected to add this system group to."
    except InvalidVariableTypes:
        status = ["action_failed", "error"]
        error = "Some of the input is invalid"
    return jsonify({
        "status": status,
        "error": error,
        "groups": vmdb.getGroupVulns(t)
    })
コード例 #3
0
def getSystems():
    team = request.form.get('team', type=str)
    verifyAccess("team", "read", team)
    return render_template("systems.html",
                           team=team,
                           systemGroups=vmdb.getGroupVulns(team, True))
コード例 #4
0
def getSystems():
    team = request.form.get("team", type=str)
    verifyAccess("team", "read", team)
    return render_template("systems.html", team=team, systemGroups=vmdb.getGroupVulns(team, True))