{% extends "_layout.html" %} {%- import '_macros_site.html' as macros_site with context -%} {% block content %} {{ macros_site.report_header(item, macros_page.render_menu_actions(item), _('Report detail')) }}
{%- if item.structured_data -%} {%- import '_macros.common.txt.j2' as macros_common -%} {%- macro render_number_info(event_class, data, field_type, field_name, display_name, render_if_zero=True) -%} {%- set ns = namespace(value=none, should_be_rendered=false) -%} {{- macros_common.set_number_value(ns, event_class, data, field_type, field_name, render_if_zero) -}} {%- if ns.should_be_rendered -%} {{ _(display_name) }}: {{ ns.value }} {%- endif -%} {% endmacro %} {%- macro render_list_info(event_class, data, field_type, field_name, display_name) -%} {%- set ns = namespace() -%} {{- macros_common.set_list_values(ns, event_class, data, field_type, field_name) -}} {%- if ns.should_be_rendered -%} {{ _(display_name) }}: {%- for item in ns.values|sort -%} {%- if loop.index0 < search_widget_item_limit -%} {%- if field_name.lower() in ['ips', 'relevant_ips'] and current_user.is_authenticated -%} {{ macros_site.render_widget_csag_address([item], separate_dropdown=True, as_code=False) }} {%- elif field_name.lower() == 'hostname' and current_user.is_authenticated -%} {{ macros_site.render_widget_csag_hostname([item], separate_dropdown=True, as_code=False) }} {%- else -%} {%- if field_name == 'services' -%} {%- set name = item[0] -%} {%- set version = item[1] -%} {%- if version -%} {{ name }} ({{ _("version") }} {{ version }}) {%- else -%} {{ name }} {%- endif -%} {%- elif field_name == "Credentials" -%} ('{{ item[0] }}', '{{ item[1] }}') {%- elif field_name in ["Ref", "URL"] -%} {{ macros_site.ref_to_html_link(item) }} {%- else -%} {{ item }} {%- endif -%} {%- if not loop.last -%}, {% endif -%} {%- if not loop.last and loop.index0 + 1 == search_widget_item_limit %} ... {%- endif -%} {%- endif -%} {%- elif loop.index0 == search_widget_item_limit %} ({{ _('%(count)s more', count = loop.length - loop.index0) }}) {%- endif %} {%- endfor -%} {%- endif -%} {% endmacro %} {% macro render_detector_details(detector_data, event_class) %} {%- for field_list_name in REPORT_FIELDS -%} {%- set field_list, field_type = REPORT_FIELDS[field_list_name] -%} {%- for field, display in field_list -%} {%- if "NUMBER" in field_list_name -%} {{ render_number_info(event_class, detector_data, field_type, field, display) }} {%- else -%} {{ render_list_info(event_class, detector_data, field_type, field, display) }} {%- endif -%} {%- endfor -%} {%- endfor -%} {% endmacro %} {%- macro render_report_subsection(key, data, section_name, event_class) -%} {% set id = escape_id(section_name + '-' + key) %} {{ macros_site.report_table_header(item.type) }} {%- if current_user.is_authenticated %} {%- endif %} {{ macros_site.report_table_row(key, data, current_user.is_authenticated, item.type) }} {%- if current_user.is_authenticated %} {%- endif %}
{%- set section_url, exact = section_event_search_url(data, item, section_name, key) -%} {{ get_icon("module-events") }} {{ _('Search events') }}
{%- if "reference" in data -%}
{{ _("Initial incident report") }}: {{ data['reference'] }}
{% endif %} {%- if "detector_data" not in data -%} {# For backwards compatibility with old structured data format. #} {{ _("Additional information") }}: {% if section_name == "vulnerable-implementation" and data["references"] %} {% endif %} {% if section_name == "vulnerable-implementation" and data["source"]["services"] %} {% endif %} {%- if data["approx_conn_count"] -%} {%- endif -%} {%- if data["flow_count"] -%} {%- endif -%} {%- if data["packet_count"] -%} {%- endif -%} {%- if data["byte_count"] -%} {%- endif -%} {%- if data["source"]["hostname"] -%} {%- endif -%} {%- if data["source"]["proto"] + data["target"]["proto"] != [] -%} {%- endif -%} {%- if data["source"]["port"] + data["target"]["port"] != [] -%} {%- endif -%} {%- if section_name == "vulnerable-implementation" and data["source"]["ref"] -%} {%- endif -%}
{{ _("References") }}: {{ macros_site.ref_to_html_link(data["references"][0]) }}
{{ _("Service") }}: {{ macros_common.render_services(data["source"]["services"]) }}
{{ _("Approximated connection count") }}: {{ data["approx_conn_count"] }}
{{ _("Flow count") }}: {{ data["flow_count"] }}
{{ _("Packet count") }}: {{ data["packet_count"] }}
{{ _("Byte count") }}: {{ data["byte_count"] }}
{{ _("Hostname") }}: {{ data["source"]["hostname"] | sort | join(", ") }}
{{ _("Protocol") }}: {{ (data["source"]["proto"] + data["target"]["proto"]) | unique | sort | join(", ") }}
{{ _("Port") }}: {{ (data["source"]["port"] + data["target"]["port"]) | unique | sort | join(", ") }}
{{ _("CVE") }}: {% for ref in data["source"]["ref"]|sort %} {{ macros_site.ref_to_html_link(ref) }}{% if not loop.last %},{% endif %} {% endfor %}
{%- elif "detector_data" in data and event_class -%}
{%- for detector in data["detector_data"] -%} {%- set detector_data = data["detector_data"][detector] -%} {% if render_detector_details(detector_data, event_class).strip() %}
{{ render_detector_details(detector_data, event_class) }}
{% endif %} {%- endfor -%}
{%- else -%}

{{ _("Additional information is not available for this source.") }}

{%- endif -%} {%- endmacro -%} {%- macro render_feedback_form(id, key, section_data, type, section_name, is_target) -%} {%- endmacro -%} {%- macro render_report_section(section_number, section_name, section_data, type) %} {% set event_class = get_event_class(section_name) %} {% if babel_get_locale() == "cs" %} {%- set section_text = event_class.label_cz or "Zaznamenali jsme dosud neklasifikovaný problém. Prosím prostudujte si data a události, nebo nás kontaktujte." -%} {% else %} {%- set section_text = event_class.label_en or "We encountered a problem that was not yet classified. Please study the relevant data and events, or contact us." -%} {% endif %} {% if event_class and event_class.reference %} {{ '[' ~ section_number ~ '] ' }} {{ section_text }} {% else %} {{ '[' ~ section_number ~ '] ' ~ section_text }} {% endif %}
{%- if item.type == 'target' -%} {{ render_report_subsection('', section_data, section_name, event_class) }} {%- else -%} {%- for ip in section_data | dictsort %} {{ render_report_subsection(ip[0], ip[1], section_name, event_class) }} {%- if not loop.last %}
{% endif %} {%- endfor -%} {%- endif -%} {%- if current_user.is_authenticated and item.type != 'target' -%} {%- for ip in section_data | dictsort -%} {%- set id = escape_id(section_name + '-' + ip[0]) -%} {{ render_feedback_form(id, ip[0], ip[1], type, section_name, False) }} {%- endfor %} {%- elif current_user.is_authenticated -%} {%- set id = escape_id(section_name + '-') -%} {{ render_feedback_form(id, get_event_class_from_whole_class(section_name), section_data, type, section_name, True) }} {%- endif %} {% if event_class and permission_can('power') %} {% endif %}
{%- endmacro -%}
{{ _('Dear colleagues,') }}
{%- if item.structured_data['regular'] -%} {%- if item.type == 'summary' %}
{{ _('our detection systems registered possible problem(s) related to your IP address range or domain:') }}
{% elif item.type == 'extra' %}
{{ _('our detection systems registered the following possible problem(s) related to host {:s}, that appears to belong to your IP address range or domain:').format(item.structured_data['regular'].values() | list | first | first) }}
{% elif item.type == 'target' %}
{{ _('our detection systems registered problem(s) targeting your IP address range or domain:') }}
{% endif -%} {%- for section_name, section_data in item.structured_data['regular'] | dictsort %} {{ render_report_section(loop.index, section_name, section_data, 'regular') }} {%- if not loop.last -%}
{%- endif -%} {% endfor -%} {%- endif %} {%- if item.structured_data['relapsed'] -%} {%- if item.type == 'summary' %}
{{ _('our detection systems registered the following RECURRING possible problem(s) related to your IP address range or domain:') }}
{% elif item.type == 'extra' %}
{{ _('our detection systems registered the following RECURRING possible problem(s) related to host {:s}, that appears belong to your IP address range or domain:').format(item.structured_data['relapsed'].values() | list | first | first) }}
{% elif item.type == 'target' %}
{{ _('our detection systems registered the following RECURRING problem(s) targeting your IP address range or domain:') }}
{% endif -%} {% for section_name, section_data in item.structured_data['relapsed'] | dictsort %} {{ render_report_section(loop.index, section_name, section_data, 'relapsed') }} {% endfor %}
{{ _('These possible problem(s) were already reported to you some time before, however we have detected relapses.') }}
{% endif -%}
{{ macros_common.render_report_severity_message(item) }}
{% autoescape false %}
{%- if item.type == 'target' -%} {{ _('In case of issues or for further communication, please use the contact e-mail address <{:s}> and keep the identifier [{:s}] in e-mail subject.').format("{:s}", item.label).format(template_vars['contact_email'], item.label, template_vars['contact_email']) }} {%- else -%} {{ _('For further communication please use the contact e-mail address <{:s}> and keep the identifier [{:s}] in e-mail subject.').format("{:s}", item.label).format(template_vars['contact_email'], item.label, template_vars['contact_email']) }} {%- endif -%}
{% endautoescape %} {% else %}
{{ item.message | replace("&", "&") | replace("<", "<") | replace(">", ">") | replace("\n", "
\n") | replace(' ', ' ') | replace("\t", '    ') | safe }}
{% endif %}
{%- if permission_can('developer') %}
{{ macros_site.render_raw_var('item', item.to_dict_short()) }} {{ macros_site.render_raw_var('structured_data', item.structured_data) }} {{ macros_site.render_raw_var('statistics', statistics) }} {{ macros_site.render_raw_var('filtering', item.filtering) }} {%- endif %} {%- endblock content %} {%- block bodyjs %} {{ super() }} {%- endblock bodyjs %}