<section id="behavior">
    {% if results.behavior and results.behavior.summary %}
        <div class="section-title">
            <h4>Behavior Summary</h4>
        </div>
        <div class="well well-small">
            <b>Files</b>
            {% if results.behavior.summary.files %}
                <ul>
                    {% for file in results.behavior.summary.files %}
                    <li><span class="mono">{{file}}</span></li>
                    {% endfor %}
                </ul>
            {% else %}
                Nothing to display.
            {% endif %}
        </div>
        <div class="well well-small">
            <b>Mutexes</b>
            {% if results.behavior.summary.mutexes %}
                <ul>
                    {% for mutex in results.behavior.summary.mutexes %}
                    <li><span class="mono">{{mutex}}</span></li>
                    {% endfor %}
                </ul>
            {% else %}
                Nothing to display.
            {% endif %}
        </div>
        <div class="well well-small">
            <b>Registry Keys</b>
            {% if results.behavior.summary["keys"] %}
                <ul>
                    {% for key in results.behavior.summary["keys"] %}
                    <li><span class="mono">{{key}}</span></li>
                    {% endfor %}
                </ul>
            {% else %}
                Nothing to display.
            {% endif %}
        </div>
    {% endif %}

    <div class="section-title">
        <h4>Processes</h4>
    </div>
    <p>
        <span class="badge registry" style="color: black;">registry</span>
        <span class="badge filesystem" style="color: black;">filesystem</span>
        <span class="badge process" style="color: black;">process</span>
        <span class="badge services" style="color: black;">services</span>
        <span class="badge network" style="color: black;">network</span>
        <span class="badge synchronization" style="color: black;">synchronization</span>
    </p>
    {% if results.behavior and results.behavior.processes %}
        {% for process in results.behavior.processes %}
        <div>
            <h4><a href="javascript:showHide('process_{{process.process_id}}');">{{process.process_name}}</a> <small>PID: {{process.process_id}}, Parent PID: {{process.parent_id}}</small></h4>
            <div id="process_{{process.process_id}}" style="display: none;">
                <table class="table table-bordered table-condensed" style="width: 100%; word-wrap:break-word;table-layout: fixed;">
                    <tr>
                        <th>Timestamp</th>
                        <th>Thread</th>
                        <th>Function</th>
                        <th>Arguments</th>
                        <th>Status</th>
                        <th>Return</th>
                        <th>Repeated</th>
                    </tr>
                    {% for call in process.calls %}
                    <tr class="{{call.category}}">
                        <td>{{call.timestamp[11:]}}</td>
                        <td>{{call.thread_id}}</td>
                        <td><span class="mono">{{call.api}}</span></td>
                        <td style="word-wrap: break-word">
                        {% for argument in call.arguments %}
                            {{argument.name}} => <span class="mono">{{argument.value}}</span><br />
                        {% endfor %}
                        </td>
                        <td>{% if call.status %}SUCCESS{% else %}FAILURE{% endif %}</td>
                        <td>{{call.return}}</td>
                        <td>
                        {% if call.repeated and call.repeated > 0 %}
                            {{call.repeated}}
                            {% if call.repeated == 1 %}
                             time
                            {% elif call.repeated > 1 %}
                             times
                            {% endif %}
                        {% endif %}
                        </td>
                    </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
        {% endfor %}
    {% else %}
        Nothing to display.
    {% endif %}
</section>
