示例#1
0
def users():

   return render_template("users.html",
        common          = sysLib.getCommonInfo({"username": session['username']}, "admin"),
        roles           = modLib.getValidRoles(session['username']),
        users           = modLib.getUsers()
    )
示例#2
0
文件: logs.py 项目: timyardley/ARMORE
def logsFiltered(thePath=None):

    sort = request.args.get("sort")
    order = request.args.get("order")

    if sort == "" or sort is None:
        sort = "mtime"
    if order == "" or order is None:
        order = "desc"

    if thePath is None:
        thePath = "/var/log"
    else:
        thePath = "/var/log/{}".format(thePath)
    if not logsLib.pathIsValid(thePath):
        addToFlash("Path is invalid: redirecting to {}".format(thePath))
        return redirect("/logs")

    return render_template("logsFiltered.html", 
        common          = sysLib.getCommonInfo({"username": session['username']}, "logs"),
        logs            = logsLib.getLogsInfo(thePath, sort, order),
        headerName      = thePath,
        path            = thePath,
        sort            = sort,
        order           = order
    )
示例#3
0
def security():

    sort = request.args.get("sort")
    order = request.args.get("order")
    theFilter = request.args.get("filter")

    if sort == "" or sort is None:
        sort = "timestamp"
    if order == "" or order is None:
        order = "desc"
    if theFilter == "" or theFilter is None:
        theFilter = "all"

    return render_template("security.html",
                           common=sysLib.getCommonInfo(
                               {"username": session["username"]}, "security"),
                           systems=sysLib.getStatuses(['bro', 'encryption']),
                           sort=sort,
                           order=order,
                           filter=theFilter,
                           logs=polLib.getLogEvents(sort,
                                                    order,
                                                    theFilter,
                                                    amt=100),
                           count=polLib.getLogCounts())
示例#4
0
def example_settings():

    return render_template(
        "example/settings.html",
        common=sysLib.getCommonInfo({"username": session['username']},
                                    "settings"),
    )
示例#5
0
def rrdTest():
    return render_template("rrdGraph.html",
                           common=sysLib.getCommonInfo(
                               {"username": session["username"]},
                               "statistics"),
                           rrdFiles=rrd.getRrdFiles()[0],
                           rrdFilesNew=rrd.getRrdFiles()[1])
示例#6
0
def welcome():
    if 'username' in session:
        return redirect(url_for("dashboard.dashboard"))

    if isInitialSetup():
        return redirect("/admin/initialUserSetup")

    return render_template("welcome.html",
                           common=sysLib.getCommonInfo({"username": ""},
                                                       "welcome"))
示例#7
0
def dashboard():

    return render_template("dashboard.html",
                           common=sysLib.getCommonInfo(
                               {"username": session["username"]}, "dashboard"),
                           uptime=sysLib.getUptime(),
                           currUser={"username": session['username']},
                           page="dashboard",
                           systems=sysLib.getDashboardInfo(),
                           logs=polLib.getLogEvents(severity="alert", amt=5))
示例#8
0
def profile(username):

    if session['role'] != "admin" and username != session['username']:
        flash("Invalid Profile: Only able to view your own profile")
        return redirect(url_for("admin.profile", username=session['username']))

    return render_template("profile.html",
        common          = sysLib.getCommonInfo({"username": session['username']}, "admin"),
        roles           = modLib.getValidRoles(session['username']),
        username        = {"name": username, "role": modLib.getRole(username)}
    )
示例#9
0
文件: logs.py 项目: timyardley/ARMORE
def example_view_log():
    filename = request.args.get('filename')
    seekTail = request.args.get('seek_tail')
    if seekTail:
        return logsLib.getLogContent(filename)
    else:
        return render_template("example/log.html", 
            common          = sysLib.getCommonInfo({"username": session['username']}, "logs"),
            content         = logsLib.getLogContent(filename),
            filename        = filename,
        )
示例#10
0
def addPolicy(num=None):

    if request.method == 'POST':
        polLib.updatePolicyConfig(request.form, num)
        #comLib.startNewThread(confLib.restartBro)
        return redirect(url_for(".currentPolicies"))

    return render_template("addPolicy.html",
                           common=sysLib.getCommonInfo(
                               {"username": session["username"]}, "policy"),
                           policy=polLib.getPolicy(num))
示例#11
0
def example_network():

    connections, types, families, theStates = netLib.getConnections()

    return render_template("example/network.html",
                           common=sysLib.getCommonInfo(
                               {"username": session["username"]}, "network"),
                           network_interfaces=netLib.getInterfaceStats(),
                           socket_types=types,
                           states=theStates,
                           socket_families=families,
                           connections=connections)
示例#12
0
def settings():
    err = ""
    config = {}
    try:
        config = confLib.getCurrentConfig()
    except:
        #err = "Error reading config: " + sys.exc_info()[0]
        session['flash'] = "Unable to get current config"

    if err != "":
        if 'flash' in session:
            if session['flash']:
                flash(session['flash'])

    confLib.synchConfigs()
    if 'Operation' not in config:
        config['Operation'] = None
    if 'Roletype' not in config:
        config['Roletype'] = None
    if 'Interface' not in config:
        config['Interface'] = None
    if 'Encryption' not in config:
        config['Encryption'] = None
    if 'Capture' not in config:
        config['Capture'] = None
    if 'Bind' not in config:
        config['Bind'] = None
    if 'Port' not in config:
        config['Port'] = None

    proxyState = sysLib.getProcessDict("ARMOREProxy")
    broState = sysLib.getProcessDict("bro")
    armoreState = sysLib.getArmoreStatus()
    #armoreState = sysLib.getArmoreState(proxyState, broState)

    return render_template(
        "settings.html",
        common=sysLib.getCommonInfo({"username": session['username']},
                                    "settings"),
        interfaces=netLib.getInterfaceIps(),
        armoreCfg=confLib.getArmoreConfig(),
        proxyCfg=confLib.getProxyConfig(),
        passvCfg=confLib.getPassiveConfig(),
        transCfg=confLib.getTransparentConfig(),
        armore=armoreState,
        bro=broState,
    )
示例#13
0
def keys():

   sort = request.args.get("sort") or "name"
   order = request.args.get("order") or "desc"

   if sort not in ["name", "type", "mtime"]:
      sort = "name"

   if order not in ["asc", "desc"]:
      order = asc

   return render_template("keyManagement.html",
      common = sysLib.getCommonInfo({"username": session['username']}, "admin"),
      roles = modLib.getValidRoles(session['username']),
      keys = keysLib.getKeys(sort, order),
      sort = sort,
      order = order
   )
示例#14
0
def processes(sort=None, order=None, filter=None, pid=None, section=None):

    sort = request.args.get("sort")
    order = request.args.get("order")
    filter = request.args.get("filter")
    pid = request.args.get("pid")
    section = request.args.get("section")

    return render_template(
        "example/processes.html",
        common=sysLib.getCommonInfo({"username": session['username']},
                                    "processes"),
        order=order,
        sort=sort,
        num_procs=sysLib.getNumberOfProcs()[0],
        num_user_procs=sysLib.getNumberOfProcs()[1],
        processes=sysLib.getProcessStats(sort, order, filter, pid, section),
        filter=filter)
示例#15
0
def addUser():

    if request.method == 'POST':
        email = request.form.get('email', None)
        password = request.form.get('password', None)
        cPassword = request.form.get('confirm_password', None)
        md5_Digest = request.form.get('md5_Digest', None)
        role = request.form.get('role')
        if email not in modLib.getUsernames():
            newuser = modLib.Users(email, md5_Digest.encode('utf-8'), role)
            modLib.db.session.add(newuser)
            modLib.db.session.commit()
            return redirect("/admin/users")

    return render_template("addUser.html",
        common          = sysLib.getCommonInfo({"username": session['username']}, "admin"),
        roles           = modLib.getValidRoles(session['username']),
        isInitial       = False
    )
示例#16
0
文件: logs.py 项目: timyardley/ARMORE
def view_log():
    filename = request.args.get('filename')
    if not logsLib.pathIsValid(filename):
        flash("Invalid file path")
        return redirect("/logs")

    seekTail = request.args.get('seek_tail')
    content = logsLib.getLogContent(filename)
    if content == '':
        flash("Unable to load file")
        return redirect(request.referrer)
    if seekTail:
        return content 
    else:

        return render_template("log.html", 
            common          = sysLib.getCommonInfo({"username": session['username']}, "logs"),
            content         = content,
            filename        = filename,
        )
示例#17
0
def initialUserSetup():
    if not modLib.isInitialSetup():
        return redirect(url_for("admin.welcome"))
 
    if request.method == 'POST':
        email = request.form.get('email', None)
        password = request.form.get('password', None)
        cPassword = request.form.get('confirm_password', None)
        md5_Digest = request.form.get('md5_Digest', None)
        role = request.form.get('role')
        if email not in modLib.getUsernames():
            newuser = modLib.Users(email, md5_Digest.encode('utf-8'), role)
            modLib.db.session.add(newuser)
            modLib.db.session.commit()
        return redirect(url_for("signout"))

    initLib.initAll()

    return render_template("addUser.html",
        common          = sysLib.getCommonInfo({"username": "******"}, "initialUserSetup"),
        roles           = [{"value": "admin", "name":"Admin"}],
        isInitial       = True
    )   
示例#18
0
def currentPolicies():

    return render_template("policy.html",
                           common=sysLib.getCommonInfo(
                               {"username": session["username"]}, "policy"),
                           policies=polLib.getPolicies())
示例#19
0
文件: logs.py 项目: timyardley/ARMORE
def example_logs():

    return render_template("example/logs.html", 
        common          = sysLib.getCommonInfo({"username": session['username']}, "logs"),
        logs            = logsLib.getLogsInfo()
    )
示例#20
0
文件: logs.py 项目: timyardley/ARMORE
def logs():

    return render_template("logs.html", 
        common          = sysLib.getCommonInfo({"username": session['username']}, "logs"),
    )
示例#21
0
def accessDenied():
    return render_template(
        "access_denied.html",
        common=sysLib.getCommonInfo({"username": session["username"]},
                                    "accessDenied"),
    )
示例#22
0
def visualizeNodeDetails():
    return render_template(
        "nodeDetails.html",
        common=sysLib.getCommonInfo({"username": session["username"]},
                                    "nodeDetails"),
    )
示例#23
0
def visualizePage():
    return render_template(
        "visualization.html",
        common=sysLib.getCommonInfo({"username": session["username"]},
                                    "visualization"),
    )
示例#24
0
def admin():

    return render_template("admin.html",
        common          = sysLib.getCommonInfo({"username": session['username']}, "admin"),
    )
示例#25
0
def redirectTo(ip):
    return render_template("redirect.html",
                           common=sysLib.getCommonInfo(
                               {"username": session['username']}, "redirect"),
                           dest=ip + ":8080/signout")