{% extends "analysis_plugins/general_information.html" %}

{% block analysis_result_details %}

    </table>
    <table class="table table-bordered">
        <colgroup>
            <col width="50">
            <col width="150">
            <col width="600">
        </colgroup>
        <tbody class="table-analysis">
            {% for key in firmware.processed_analysis[selected_analysis] %}
                {% if key | is_not_mandatory_analysis_entry %}
                    <tr>
                        <td class="table-head-light" rowspan=5>{{ loop.index - 1 }}</td>
                        <td class="table-head-light">Matched Rule</td>
                        <td class="table-head-light">{{ firmware.processed_analysis[selected_analysis][key]['rule'] }} </td>
                    </tr>
                    <tr>
                        <td> Description</td>
                        <td> {{ firmware.processed_analysis[selected_analysis][key]['meta']['description'] }} </td>
                    </tr>
                    <tr>
                        <td>Rule Version</td>
                        <td>{{ firmware.processed_analysis[selected_analysis][key]['meta']['date'] }}</td>
                    </tr>
                    <tr>
                        <td>Rule Author</td>
                        <td><a href="https://github.com/Yara-Rules/rules/blob/master/crypto/crypto_signatures.yar">{{ firmware.processed_analysis[selected_analysis][key]['meta']['author'] }}</a></td>
                    </tr>
                    <tr>
                        <td>Matches</td>
                        <td class="p-0 m-0">
                            <table class="table table-bordered" style="margin:0px;">
                                <colgroup>
                                    <col width="75">
                                    <col width="525">
                                </colgroup>
                                <tr>
                                    <td class="table-head-light">offset</td>
                                    <td class="table-head-light">value in hex</td>
                                </tr>
                                {% for offset, _, hex_value in firmware.processed_analysis[selected_analysis][key]['strings'] %}
                                    <tr>
                                        <td> 0x{{ '0%x' % offset }} </td>
                                        <td> {{ hex_value | bytes_to_str }} </td>
                                    </tr>
                                {% endfor %}
                            </table>
                        </td>
                    </tr>
                {% endif %}
            {% endfor %}
        </tbody>
{% endblock %}
