def users(): return render_template("users.html", common = sysLib.getCommonInfo({"username": session['username']}, "admin"), roles = modLib.getValidRoles(session['username']), users = modLib.getUsers() )
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 )
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())
def example_settings(): return render_template( "example/settings.html", common=sysLib.getCommonInfo({"username": session['username']}, "settings"), )
def rrdTest(): return render_template("rrdGraph.html", common=sysLib.getCommonInfo( {"username": session["username"]}, "statistics"), rrdFiles=rrd.getRrdFiles()[0], rrdFilesNew=rrd.getRrdFiles()[1])
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"))
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))
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)} )
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, )
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))
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)
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, )
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 )
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)
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 )
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, )
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 )
def currentPolicies(): return render_template("policy.html", common=sysLib.getCommonInfo( {"username": session["username"]}, "policy"), policies=polLib.getPolicies())
def example_logs(): return render_template("example/logs.html", common = sysLib.getCommonInfo({"username": session['username']}, "logs"), logs = logsLib.getLogsInfo() )
def logs(): return render_template("logs.html", common = sysLib.getCommonInfo({"username": session['username']}, "logs"), )
def accessDenied(): return render_template( "access_denied.html", common=sysLib.getCommonInfo({"username": session["username"]}, "accessDenied"), )
def visualizeNodeDetails(): return render_template( "nodeDetails.html", common=sysLib.getCommonInfo({"username": session["username"]}, "nodeDetails"), )
def visualizePage(): return render_template( "visualization.html", common=sysLib.getCommonInfo({"username": session["username"]}, "visualization"), )
def admin(): return render_template("admin.html", common = sysLib.getCommonInfo({"username": session['username']}, "admin"), )
def redirectTo(ip): return render_template("redirect.html", common=sysLib.getCommonInfo( {"username": session['username']}, "redirect"), dest=ip + ":8080/signout")