mirror of https://github.com/CIRCL/lookyloo
				
				
				
			chg: make macros, deduplicate template
							parent
							
								
									89725b8ed0
								
							
						
					
					
						commit
						ef93734ded
					
				| 
						 | 
				
			
			@ -1,4 +1,6 @@
 | 
			
		|||
{% extends "main.html" %}
 | 
			
		||||
{% from "macros.html" import sanejs_details %}
 | 
			
		||||
{% from "macros.html" import indexed_hash %}
 | 
			
		||||
 | 
			
		||||
{% block title %}Details for {{ hostname }} {% endblock %}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,15 +44,19 @@
 | 
			
		|||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
  {# Headers #}
 | 
			
		||||
  <center>
 | 
			
		||||
    <h3>{{ hostname }}</h3>
 | 
			
		||||
    <button type="button" class="btn btn-info" onclick="whereAmI('{{ hostname_uuid }}')">Locate node on tree</button>
 | 
			
		||||
    <a href="{{ url_for('hostnode_details_text', tree_uuid=tree_uuid, node_uuid=hostname_uuid) }}" class="btn btn-info" role="button">Get URLs as text</a>
 | 
			
		||||
  </center>
 | 
			
		||||
  {# Start list of URLs #}
 | 
			
		||||
  <ul class="list-group-flush">
 | 
			
		||||
    {% for url in urls %}
 | 
			
		||||
    {# URL Display #}
 | 
			
		||||
    <li class="list-group-item">
 | 
			
		||||
      <div class="h3">
 | 
			
		||||
        {# Copy full URL to clipbard #}
 | 
			
		||||
        <button type="button" class="btn btn-default btn-copy js-copy"
 | 
			
		||||
                data-toggle="tooltip" data-placement="bottom" data-copy="{{ url['url_object'].name }}" title="Copy to clipboard">
 | 
			
		||||
          <svg class="bi bi-clipboard" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
 | 
			
		||||
| 
						 | 
				
			
			@ -58,6 +64,7 @@
 | 
			
		|||
            <path fill-rule="evenodd" d="M9.5 1h-3a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
 | 
			
		||||
          </svg>
 | 
			
		||||
        </button>
 | 
			
		||||
        {# HTTPs or not  #}
 | 
			
		||||
        {% if url['encrypted'] %}
 | 
			
		||||
        <svg class="bi bi-lock" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
 | 
			
		||||
          <path fill-rule="evenodd" d="M11.5 8h-7a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1zm-7-1a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-7zm0-3a3.5 3.5 0 1 1 7 0v3h-1V4a2.5 2.5 0 0 0-5 0v3h-1V4z"/>
 | 
			
		||||
| 
						 | 
				
			
			@ -67,6 +74,7 @@
 | 
			
		|||
          <path fill-rule="evenodd" d="M9.655 8H2.333c-.264 0-.398.068-.471.121a.73.73 0 0 0-.224.296 1.626 1.626 0 0 0-.138.59V14c0 .342.076.531.14.635.064.106.151.18.256.237a1.122 1.122 0 0 0 .436.127l.013.001h7.322c.264 0 .398-.068.471-.121a.73.73 0 0 0 .224-.296 1.627 1.627 0 0 0 .138-.59V9c0-.342-.076-.531-.14-.635a.658.658 0 0 0-.255-.237A1.122 1.122 0 0 0 9.655 8zm.012-1H2.333C.5 7 .5 9 .5 9v5c0 2 1.833 2 1.833 2h7.334c1.833 0 1.833-2 1.833-2V9c0-2-1.833-2-1.833-2zM8.5 4a3.5 3.5 0 1 1 7 0v3h-1V4a2.5 2.5 0 0 0-5 0v3h-1V4z"/>
 | 
			
		||||
        </svg>
 | 
			
		||||
        {%endif%}
 | 
			
		||||
        {# URL #}
 | 
			
		||||
        ... /{{ url['url_path_short'] }}
 | 
			
		||||
      </div>
 | 
			
		||||
      <ul class="list-group">
 | 
			
		||||
| 
						 | 
				
			
			@ -74,6 +82,7 @@
 | 
			
		|||
          {# Details of the response #}
 | 
			
		||||
          <p class="h4">Response</p>
 | 
			
		||||
 | 
			
		||||
          {# Download cookies #}
 | 
			
		||||
          <div>
 | 
			
		||||
          {% for key, path in keys_response.items() %}
 | 
			
		||||
            {% if url['url_object'][key] %}
 | 
			
		||||
| 
						 | 
				
			
			@ -88,8 +97,10 @@
 | 
			
		|||
          {% endfor %}
 | 
			
		||||
          </div>
 | 
			
		||||
 | 
			
		||||
          {# Response content block #}
 | 
			
		||||
          <div>
 | 
			
		||||
          {% if not url['url_object'].empty_response %}
 | 
			
		||||
            {# Download content #}
 | 
			
		||||
            <a href="{{ url_for('urlnode_details', tree_uuid=tree_uuid, node_uuid=url['url_object'].uuid) }}">
 | 
			
		||||
              Download response body.
 | 
			
		||||
            </a></br>
 | 
			
		||||
| 
						 | 
				
			
			@ -99,82 +110,39 @@
 | 
			
		|||
          {%endif%}
 | 
			
		||||
          </div>
 | 
			
		||||
 | 
			
		||||
          {# Status code of the response #}
 | 
			
		||||
          <div>
 | 
			
		||||
            Status Code: {{ url['url_object'].response['status'] }}
 | 
			
		||||
          </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
          {% if url['sane_js'] %}
 | 
			
		||||
          <div>
 | 
			
		||||
          {% if url['sane_js'] is string %}
 | 
			
		||||
            <b>{{ url['sane_js'] }} </b>
 | 
			
		||||
          {% else %}
 | 
			
		||||
            This file is known as part of <b>{{ url['sane_js'][0] }}</b>
 | 
			
		||||
            version <b>{{ url['sane_js'][1] }}</b>: <b>{{ url['sane_js'][2] }}</b>.
 | 
			
		||||
            {% if url['sane_js'][3] > 1%}
 | 
			
		||||
              It is also present in <b>{{ url['sane_js'][3] -1 }}</b> other libraries.
 | 
			
		||||
            {%endif%}
 | 
			
		||||
          {%endif%}
 | 
			
		||||
          </div>
 | 
			
		||||
            {# Result from SaneJS for the response #}
 | 
			
		||||
            {{ sanejs_details(url['sane_js']) }}
 | 
			
		||||
          {% endif %}
 | 
			
		||||
 | 
			
		||||
          {# Everything we know about the response content #}
 | 
			
		||||
          {% if url['body_hash_details'] %}
 | 
			
		||||
          <div>
 | 
			
		||||
            This file can be found <b>{{ url['body_hash_details']['hash_freq'] }}</b> times
 | 
			
		||||
            across all the captures on this lookyloo instance, in <b>{{ url['body_hash_details']['hash_domains_freq'] }}</b> unique domains.
 | 
			
		||||
            </br>
 | 
			
		||||
 | 
			
		||||
            {# other captures related wit the same dontent #}
 | 
			
		||||
            {% if 'other_captures' in url['body_hash_details'] %}
 | 
			
		||||
            {% set total_captures = url['body_hash_details']['other_captures']['different_url']|length + url['body_hash_details']['other_captures']['same_url']|length %}
 | 
			
		||||
 | 
			
		||||
            {% if total_captures > 0  %}
 | 
			
		||||
              {{ indexed_hash(url['body_hash_details']['other_captures'], url['url_object'].uuid) }}
 | 
			
		||||
            {% endif %}
 | 
			
		||||
            {# Link to list of captures with the same hash #}
 | 
			
		||||
            <p>
 | 
			
		||||
            The same file was seen in <b>{{ total_captures }}</b> other captures.
 | 
			
		||||
              <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#captureslist_{{ url['url_object'].uuid }}" aria-expanded="false" aria-controls="collapseExample">
 | 
			
		||||
                Toggle list.
 | 
			
		||||
              </button>
 | 
			
		||||
            </p>
 | 
			
		||||
            <div class="collapse" id="captureslist_{{ url['url_object'].uuid }}">
 | 
			
		||||
              <div class="card card-body">
 | 
			
		||||
              {% if url['body_hash_details']['other_captures']['different_url']|length > 0 %}
 | 
			
		||||
              <div>
 | 
			
		||||
                <p>The following captures get the same file from a <b>different URL</b></p>
 | 
			
		||||
                <ul>
 | 
			
		||||
                {% for capture_uuid, urlnode_uuid, title, hostname in url['body_hash_details']['other_captures']['different_url'] %}
 | 
			
		||||
                <li>
 | 
			
		||||
                    <a href="{{ url_for('tree', tree_uuid=capture_uuid, urlnode_uuid=urlnode_uuid) }}">{{ title }}</a> - {{ hostname }}
 | 
			
		||||
                </li>
 | 
			
		||||
                {% endfor %}
 | 
			
		||||
                </ul>
 | 
			
		||||
              </div>
 | 
			
		||||
              {% endif %}
 | 
			
		||||
 | 
			
		||||
              {% if url['body_hash_details']['other_captures']['same_url']|length > 0 %}
 | 
			
		||||
              </br>
 | 
			
		||||
              <div>
 | 
			
		||||
              <p>The following captures get the same file from the <b>same URL</b></p>
 | 
			
		||||
                <ul>
 | 
			
		||||
                {% for capture_uuid, urlnode_uuid, title, hostname in url['body_hash_details']['other_captures']['same_url'] %}
 | 
			
		||||
                <li>
 | 
			
		||||
                    <a href="{{ url_for('tree', tree_uuid=capture_uuid, urlnode_uuid=urlnode_uuid) }}">{{ title }}</a> - {{ hostname }}
 | 
			
		||||
                </li>
 | 
			
		||||
                {% endfor %}
 | 
			
		||||
                </ul>
 | 
			
		||||
              </div>
 | 
			
		||||
              {% endif %}
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            {% else %}
 | 
			
		||||
            <p>This file is loaded multiple times in this capture.</p>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
            <p><a href="{{ url_for('body_hash_details', body_hash=url['url_object'].body_hash) }}">
 | 
			
		||||
              <a href="{{ url_for('body_hash_details', body_hash=url['url_object'].body_hash) }}">
 | 
			
		||||
              Show more information about this response body.
 | 
			
		||||
            </a></p>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
              </a>
 | 
			
		||||
            </p>
 | 
			
		||||
          <div>
 | 
			
		||||
          {% endif %}
 | 
			
		||||
 | 
			
		||||
          {% if url['embedded_ressources'] %}
 | 
			
		||||
          {# Details on embedded resources #}
 | 
			
		||||
          <div><b>This response contains embedded ressources</b></div>
 | 
			
		||||
          <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#embedded_full_list_{{ url['url_object'].uuid }}" aria-expanded="false" aria-controls="collapseExample">
 | 
			
		||||
            Toggle list of embedded resources.
 | 
			
		||||
| 
						 | 
				
			
			@ -183,17 +151,8 @@
 | 
			
		|||
            <div class="card card-body">
 | 
			
		||||
              {% for hash, details in url['embedded_ressources'].items() %}
 | 
			
		||||
              {% if details['sane_js'] %}
 | 
			
		||||
              <div>
 | 
			
		||||
              {% if details['sane_js'] is string %}
 | 
			
		||||
                <b>{{ details['sane_js'] }} </b>
 | 
			
		||||
              {% else %}
 | 
			
		||||
                This file is known as part of <b>{{ details['sane_js'][0] }}</b>
 | 
			
		||||
                version <b>{{ details['sane_js'][1] }}</b>: <b>{{ details['sane_js'][2] }}</b>.
 | 
			
		||||
                {% if details['sane_js'][3] > 1%}
 | 
			
		||||
                  It is also present in <b>{{ details['sane_js'][3] -1 }}</b> other libraries.
 | 
			
		||||
                {%endif%}
 | 
			
		||||
              {%endif%}
 | 
			
		||||
              </div>
 | 
			
		||||
                {# Result from SaneJS for the embedded ressources #}
 | 
			
		||||
                {{ sanejs_details(details['sane_js']) }}
 | 
			
		||||
              {% endif %}
 | 
			
		||||
              <div>
 | 
			
		||||
                  This file (<b>{{ details['type'] }}</b>) can be found <b>{{ details['hash_freq'] }}</b> times
 | 
			
		||||
| 
						 | 
				
			
			@ -204,52 +163,11 @@
 | 
			
		|||
                </br>
 | 
			
		||||
 | 
			
		||||
                {% if 'other_captures' in details %}
 | 
			
		||||
                {% set total_captures = details['other_captures']['different_url']|length + details['other_captures']['same_url']|length %}
 | 
			
		||||
 | 
			
		||||
                {% if total_captures > 0  %}
 | 
			
		||||
                <p>
 | 
			
		||||
                The same file was seen in <b>{{ total_captures }}</b> other captures.
 | 
			
		||||
                  <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#embeddedlist_{{ hash }}" aria-expanded="false" aria-controls="collapseExample">
 | 
			
		||||
                    Toggle list.
 | 
			
		||||
                  </button>
 | 
			
		||||
                </p>
 | 
			
		||||
                <div class="collapse" id="embeddedlist_{{ hash }}">
 | 
			
		||||
                  <div class="card card-body">
 | 
			
		||||
                  {% if details['other_captures']['different_url']|length > 0 %}
 | 
			
		||||
                  <div>
 | 
			
		||||
                    <p>The following captures get the same file from a <b>different URL</b></p>
 | 
			
		||||
                    <ul>
 | 
			
		||||
                    {% for capture_uuid, urlnode_uuid, title, hostname in details['other_captures']['different_url'] %}
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a href="{{ url_for('tree', tree_uuid=capture_uuid, urlnode_uuid=urlnode_uuid) }}">{{ title }}</a> - {{ hostname }}
 | 
			
		||||
                    </li>
 | 
			
		||||
                    {% endfor %}
 | 
			
		||||
                    </ul>
 | 
			
		||||
                  </div>
 | 
			
		||||
                  {% endif %}
 | 
			
		||||
 | 
			
		||||
                  {% if details['other_captures']['same_url']|length > 0 %}
 | 
			
		||||
                  </br>
 | 
			
		||||
                  <div>
 | 
			
		||||
                  <p>The following captures get the same file from the <b>same URL</b></p>
 | 
			
		||||
                    <ul>
 | 
			
		||||
                    {% for capture_uuid, urlnode_uuid, title, hostname in details['other_captures']['same_url'] %}
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a href="{{ url_for('tree', tree_uuid=capture_uuid, urlnode_uuid=urlnode_uuid) }}">{{ title }}</a> - {{ hostname }}
 | 
			
		||||
                    </li>
 | 
			
		||||
                    {% endfor %}
 | 
			
		||||
                    </ul>
 | 
			
		||||
                  </div>
 | 
			
		||||
                  {% endif %}
 | 
			
		||||
                  </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                {% else %}
 | 
			
		||||
                <p>This file is loaded multiple times in this capture.</p>
 | 
			
		||||
                  {{ indexed_hash(details['other_captures'], hash) }}
 | 
			
		||||
                {% endif %}
 | 
			
		||||
                <p><a href="{{ url_for('body_hash_details', body_hash=url['url_object'].body_hash) }}">
 | 
			
		||||
                  Show more information about this embedded content.
 | 
			
		||||
                </a></p>
 | 
			
		||||
                {% endif %}
 | 
			
		||||
              <div>
 | 
			
		||||
              {% endfor %}
 | 
			
		||||
            </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,60 @@
 | 
			
		|||
{% macro sanejs_details(details) %}
 | 
			
		||||
<div>
 | 
			
		||||
{% if details is string %}
 | 
			
		||||
  <b>{{ details }} </b>
 | 
			
		||||
{% else %}
 | 
			
		||||
  This file is known as part of <b>{{ details[0] }}</b>
 | 
			
		||||
  version <b>{{ details[1] }}</b>: <b>{{ details[2] }}</b>.
 | 
			
		||||
  {% if details[3] > 1%}
 | 
			
		||||
    It is also present in <b>{{ details[3] -1 }}</b> other libraries.
 | 
			
		||||
  {%endif%}
 | 
			
		||||
{%endif%}
 | 
			
		||||
</div>
 | 
			
		||||
{% endmacro %}
 | 
			
		||||
 | 
			
		||||
{% macro indexed_hash(details, identifier_for_toggle) %}
 | 
			
		||||
{% set total_captures = details['different_url']|length + details['same_url']|length %}
 | 
			
		||||
{# Only show details if the hits are in an other capture #}
 | 
			
		||||
{% if total_captures > 0  %}
 | 
			
		||||
<p>
 | 
			
		||||
The same file was seen in <b>{{ total_captures }}</b> other captures.
 | 
			
		||||
  <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#captureslist_{{ identifier_for_toggle }}" aria-expanded="false" aria-controls="collapseExample">
 | 
			
		||||
    Toggle list.
 | 
			
		||||
  </button>
 | 
			
		||||
</p>
 | 
			
		||||
{# Lists of other captures loading the same content... #}
 | 
			
		||||
<div class="collapse" id="captureslist_{{ identifier_for_toggle }}">
 | 
			
		||||
  <div class="card card-body">
 | 
			
		||||
    {% if details['different_url']|length > 0 %}
 | 
			
		||||
    {# ... on other URLs #}
 | 
			
		||||
    <div>
 | 
			
		||||
      <p>The following captures get the same file from a <b>different URL</b></p>
 | 
			
		||||
      <ul>
 | 
			
		||||
      {% for capture_uuid, urlnode_uuid, title, hostname in details['different_url'] %}
 | 
			
		||||
      <li>
 | 
			
		||||
        <a href="{{ url_for('tree', tree_uuid=capture_uuid, urlnode_uuid=urlnode_uuid) }}">{{ title }}</a> - {{ hostname }}
 | 
			
		||||
      </li>
 | 
			
		||||
      {% endfor %}
 | 
			
		||||
      </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
    </br>
 | 
			
		||||
    {% if details['same_url']|length > 0 %}
 | 
			
		||||
    {# ... on the same URL #}
 | 
			
		||||
    <div>
 | 
			
		||||
      <p>The following captures get the same file from the <b>same URL</b></p>
 | 
			
		||||
      <ul>
 | 
			
		||||
      {% for capture_uuid, urlnode_uuid, title, hostname in details['same_url'] %}
 | 
			
		||||
      <li>
 | 
			
		||||
        <a href="{{ url_for('tree', tree_uuid=capture_uuid, urlnode_uuid=urlnode_uuid) }}">{{ title }}</a> - {{ hostname }}
 | 
			
		||||
      </li>
 | 
			
		||||
      {% endfor %}
 | 
			
		||||
      </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  {% endif %}
 | 
			
		||||
</div>
 | 
			
		||||
{% else %}
 | 
			
		||||
<p>This file is loaded multiple times in this capture.</p>
 | 
			
		||||
{% endif %}
 | 
			
		||||
{% endmacro %}
 | 
			
		||||
		Loading…
	
		Reference in New Issue