コード例 #1
0
ファイル: views.py プロジェクト: chyla/pat-lms
def configure_anomaly_detection_select_data_range(request):
    agent_name = request.GET.get("agent_name", "")
    virtualhost_name = request.GET.get("virtualhost_name", "")
    begin_date = request.GET.get("begin_date", util.get_default_begin_date())
    end_date = request.GET.get("end_date", util.get_default_end_date())
    sessions = []
    exception = None

    try:
        sessions = util.get_apache_sessions(agent_name, virtualhost_name, begin_date, end_date)
    except Exception as e:
        exception = str(e)

    return render(
        request,
        "apache/configure_anomaly_detection/select_data_range.html",
        {
            "exception": exception,
            "agent_name": agent_name,
            "virtualhost_name": virtualhost_name,
            "begin_date": begin_date,
            "end_date": end_date,
            "sessions": sessions,
            "CLASSIFICATION_ANOMALY": Classification.ANOMALY,
            "CLASSIFICATION_NORMAL": Classification.NORMAL,
            "CLASSIFICATION_UNKNOWN": Classification.UNKNOWN,
        },
    )
コード例 #2
0
ファイル: views.py プロジェクト: chyla/pat-lms
def review_detection_results_show_results(request):
    agent_name = request.GET.get("agent_name", "")
    virtualhost_name = request.GET.get("virtualhost_name", "")
    begin_date = request.GET.get("begin_date", util.get_default_begin_date())
    end_date = request.GET.get("end_date", util.get_default_end_date())
    sessions = []
    exception = None

    try:
        if begin_date != "" and end_date != "":
            sessions = util.get_apache_sessions_without_learning_set(agent_name, virtualhost_name, begin_date, end_date)
    except Exception as e:
        exception = str(e)

    return render(
        request,
        "apache/review_detection_results/show_results.html",
        {
            "exception": exception,
            "agent_name": agent_name,
            "virtualhost_name": virtualhost_name,
            "begin_date": begin_date,
            "end_date": end_date,
            "sessions": sessions,
            "CLASSIFICATION_ANOMALY": Classification.ANOMALY,
            "CLASSIFICATION_NORMAL": Classification.NORMAL,
            "CLASSIFICATION_UNKNOWN": Classification.UNKNOWN,
        },
    )
コード例 #3
0
ファイル: views.py プロジェクト: chyla/pat-lms
def configure_anomaly_detection_select_date_range(request):
    exception = None
    configurations = None
    selected_agent_id = request.GET.get('agent_name_id', '')
    begin_date = request.GET.get('begin_date', util.get_default_begin_date())
    end_date = request.GET.get('end_date', util.get_default_end_date())
    commands_statistics = None

    try:
        configurations = util.bash_get_anomaly_detection_configurations()
        commands_statistics = util.bash_get_commands_statistics(selected_agent_id, begin_date, end_date)
    except Exception as e:
        exception = str(e)

    return render(request,
                  'bash/configure_anomaly_detection/select_date_range.html',
                  {'exception' : exception,
                   'agent_name_id' : selected_agent_id,
                   'configurations' : configurations,
                   'begin_date' : begin_date,
                   'end_date' : end_date,
                   'commands_statistics' : commands_statistics,
                   })
コード例 #4
0
ファイル: views.py プロジェクト: chyla/pat-lms
def review_detection_results_show_results(request):
    exception = None
    sessions = None
    agent_name_id = request.GET.get('agent_name_id', None)
    begin_date = request.GET.get('begin_date', util.get_default_begin_date())
    end_date = request.GET.get('end_date', util.get_default_end_date())

    try:
        sessions = util.bash_get_daily_user_statistics_without_learning_set_for_agent(agent_name_id, begin_date, end_date)
    except Exception as e:
        exception = str(e)

    return render(request,
                  'bash/review_detection_results/show_results.html',
                  {'exception' : exception,
                   'sessions' : sessions,
                   'agent_name_id' : agent_name_id,
                   'begin_date' : begin_date,
                   'end_date' : end_date,
                   'CLASSIFICATION_ANOMALY' : Classification.ANOMALY,
                   'CLASSIFICATION_NORMAL' : Classification.NORMAL,
                   'CLASSIFICATION_UNKNOWN' : Classification.UNKNOWN,
                   })