def configure_anomaly_detection_select_agent_and_virtualhost(request): agent_name = request.GET.get("agent_name", "") virtualhost_name = request.GET.get("virtualhost_name", "") agent_names = None virtualhosts_names = None configuration = None exception = None try: configuration = util.get_apache_anomaly_detection_configuration() agents = set(util.get_apache_agent_names()) vhs = {} for agent in agents: vhs[agent] = set(util.get_apache_virtualhost_names(agent)) for config in configuration: agent = config["agent_name"] vh = config["virtualhost_name"] vhs[agent].discard(vh) agent_names = [x for x in agents if len(vhs[x]) > 0] if agent_name != "": virtualhosts_names = vhs[agent_name] except Exception as e: exception = str(e) return render_to_response( "apache/configure_anomaly_detection/select_agent_and_virtualhost.html", { "exception": exception, "agent_name": agent_name, "virtualhost_name": virtualhost_name, "agent_names": agent_names, "virtualhosts_names": virtualhosts_names, "configuration": configuration, }, )
def status(request): exception = None configuration = None available_classification_for_agent_host_names = None try: configuration = util.get_apache_anomaly_detection_configuration() available_classification_for_agent_host_names = ( util.get_agents_and_virtualhosts_names_filtered_by_sessions_classification_exists() ) except Exception as e: exception = str(e) return render( request, "apache/status.html", { "exception": exception, "configuration": configuration, "available_classification_for_agent_host_names": available_classification_for_agent_host_names, }, )