{% extends "base.html" %}
{% set active_page = "Info" %}
{% import 'macros.html' as macros %}
{% set count = [] %}
{% block head %}
{% endblock %}
{% block body %}
{% set query_url = "database/browse?query=" %}
{# ------ General Stats ------ #}
{% if stats["general_stats"] %}
{% call macros.stats_panel("General") %}
{{ macros.stats_table_row("firmware samples", stats["general_stats"]["number_of_firmwares"] | nice_number) }}
{{ macros.stats_table_row("firmware total size", stats["general_stats"]["total_firmware_size"] | number_format) }}
{{ macros.stats_table_row("firmware average size", stats["general_stats"]["average_firmware_size"] | number_format) }}
{% if stats["general_stats"]["number_of_unique_files"] %}
{{ macros.stats_table_row("unique included files", stats["general_stats"]["number_of_unique_files"] | nice_number) }}
{{ macros.stats_table_row("unique included files total size", stats["general_stats"]["total_file_size"] | number_format) }}
{{ macros.stats_table_row("unique included files average size", stats["general_stats"]["average_file_size"] | number_format) }}
{% endif %}
{% endcall %}
{% endif %}
{# ------ Crypto Material Stats ------ #}
{% if (stats["crypto_material_stats"]["crypto_material"] | length) > 0 %}
{% call macros.stats_panel("Crypto Material", "lock") %}
{% for item in (stats["crypto_material_stats"]["crypto_material"] | sort_chart_list_by_value) %}
|
{{ item[0] }}
|
{{ item[1] }} |
{% endfor %}
{% endcall %}
{% endif %}
{# ------ Known Vulnerability Stats ------ #}
{% if (stats["known_vulnerabilities_stats"]["known_vulnerabilities"] | length) > 0 %}
{% call macros.stats_panel("Known Vulnerabilities", "bolt") %}
{% for item in (stats["known_vulnerabilities_stats"]["known_vulnerabilities"] | sort_chart_list_by_value) %}
|
{{ item[0] }}
|
{{ item[1] }} |
{% endfor %}
{% endcall %}
{% endif %}
{# ------ Unpacker Stats ------ #}
{% if stats["unpacker_stats"]["overall_unpack_ratio"] %}
{% call macros.stats_panel("Unpacker Stats", "file-archive") %}
{{ macros.stats_table_row("Share of not-packed files", (stats["unpacker_stats"]["overall_unpack_ratio"] * 100) | nice_number, percent=True,
tooltip="Percentage of files that could not be further unpacked (outer vertices in the file tree), and are not considered packed") }}
{{ macros.stats_table_row("Average packed entropy", stats["unpacker_stats"]["average_packed_entropy"] | nice_number, tooltip="Average byte entropy of files that are considered packed") }}
{{ macros.stats_table_row("Average not-packed entropy", stats["unpacker_stats"]["average_unpacked_entropy"] | nice_number, tooltip="Average byte entropy of files that are not considered packed") }}
{{ macros.stats_table_row("Ratio of data loss", (stats["unpacker_stats"]["overall_data_loss_ratio"] * 100) | nice_number, percent=True,
tooltip="Percentage of files that were unpacked (inner vertices in the file tree), where some data was probably lost (some files were not unpacked)") }}
{% endcall %}
{% endif %}
{# ------ Charts ------ #}
{% set chart_list = [
["Vendors", "vendor", stats["firmware_meta_stats"], {"vendor": {"$eq": "PLACEHOLDER"}}],
["Device Classes", "device_class", stats["firmware_meta_stats"], {"device_class": {"$eq": "PLACEHOLDER"}}],
["Firmware Container", "firmware_container", stats["file_type_stats"],
{"$and": [{"processed_analysis.file_type.mime": {"$eq": "PLACEHOLDER"}}, {"vendor": {"$exists": True}}]}],
["File Types", "file_types", stats["file_type_stats"], {"processed_analysis.file_type.mime": {"$eq": "PLACEHOLDER"}}],
["Unpacker Usage", "used_unpackers", stats["unpacker_stats"], {"processed_analysis.unpacker.plugin_used": {"$eq": "PLACEHOLDER"}}],
["Unpacking Fail File Types", "packed_file_types", stats["unpacker_stats"],
{"processed_analysis.unpacker.summary": "packed","processed_analysis.file_type.mime": {"$eq": "PLACEHOLDER"}}],
["Data Lost File Types", "data_loss_file_types", stats["unpacker_stats"],
{"processed_analysis.unpacker.summary": "data lost","processed_analysis.file_type.mime": {"$eq": "PLACEHOLDER"}}],
["Architectures", "cpu_architecture", stats["architecture_stats"], {"processed_analysis.cpu_architecture.summary": {"$regex": "PLACEHOLDER"}}],
["Software Components", "software_components", stats["software_stats"], {"processed_analysis.software_components.PLACEHOLDER": {"$exists": "true"}}],
]%}
{% for title, key, data_set, query in chart_list %}
{% if data_set %}
{% if data_set[key] %}
{% call macros.stats_panel(title) %}
{% endcall %}
{% endif %}
{% endif %}
{% endfor %}
{# ------ Exploit Mitigation Stats ------ #}
{% if stats["exploit_mitigations_stats"] %}
{% if stats["exploit_mitigations_stats"]["exploit_mitigations"] %}
{% call macros.stats_panel("Exploit Mitigations") %}
{% endcall %}
{% endif %}
{% endif %}
{# ------ ELF Executable Stats ------ #}
{% if stats["elf_executable_stats"] %}
{% if stats["elf_executable_stats"]["executable_stats"] %}
{% call macros.stats_panel("ELF Executables") %}
{% endcall %}
{% endif %}
{% endif %}
{# ------ Malware Stats ------ #}
{% if (stats["malware_stats"]["malware"] | length) > 0 %}
{% call macros.stats_panel("Malware", "exclamation-triangle") %}
{% for malware in (stats["malware_stats"]["malware"] | sort_chart_list_by_value) %}
{% set query = {"processed_analysis.malware_scanner.scans.ClamAV.result": {"$eq": malware[0]}} %}
{{ macros.stats_table_row(malware[0], malware[1], link=query_url + query | json_dumps | urlencode) }}
{% endfor %}
{% endcall %}
{% endif %}
{# ------ IP Stats ------ #}
{% set ips_v4_num = stats["ip_and_uri_stats"]["ips_v4"] | length %}
{% if ips_v4_num > 0 %}
{% call macros.stats_panel("IPv4 Addresses (Top {}/{})".format([10, ips_v4_num] | min, ips_v4_num), "globe") %}
{% for ip in (stats["ip_and_uri_stats"]["ips_v4"] | sort_chart_list_by_value)[:10] %}
{% set query = {"processed_analysis.ip_and_uri_finder.ips_v4": {"$elemMatch": {"$elemMatch": {"$in": [ip[0], ]}}}} %}
{{ macros.stats_table_row(ip[0], ip[1], link=query_url + query | json_dumps | urlencode) }}
{% endfor %}
{% endcall %}
{% endif %}
{% set ips_v6_num = stats["ip_and_uri_stats"]["ips_v6"] | length %}
{% if ips_v6_num > 0 %}
{% call macros.stats_panel("IPv6 Addresses (Top {}/{})".format([10, ips_v6_num] | min, ips_v6_num), "globe") %}
{% for ip in (stats["ip_and_uri_stats"]["ips_v6"] | sort_chart_list_by_value)[:10] %}
{% set query = {"processed_analysis.ip_and_uri_finder.ips_v6": {"$elemMatch": {"$elemMatch": {"$in": [ip[0], ]}}}} %}
{{ macros.stats_table_row(ip[0], ip[1], link=query_url + query | json_dumps | urlencode) }}
{% endfor %}
{% endcall %}
{% endif %}
{% set uri_num = stats["ip_and_uri_stats"]["uris"] | length %}
{% if uri_num > 0 %}
{% call macros.stats_panel("URIs (Top {}/{})".format([10, uri_num] | min, uri_num), "globe") %}
{% for uri in (stats["ip_and_uri_stats"]["uris"] | sort_chart_list_by_value)[:10] %}
{% set query = {"processed_analysis.ip_and_uri_finder.uris": {"$eq": uri[0]}} %}
{{ macros.stats_table_row(uri[0], uri[1], link=query_url + query | json_dumps | urlencode) }}
{% endfor %}
{% endcall %}
{% endif %}
{# ------ Release Date Histogram ------ #}
{% if (stats["release_date_stats"]["date_histogram_data"] | length) > 0 %}