Skip to content

Commit

Permalink
new: use multiple modals instead of changing page in favicons and res…
Browse files Browse the repository at this point in the history
…sources views
  • Loading branch information
Rafiot committed Feb 20, 2024
1 parent 15e4093 commit dcbec2e
Show file tree
Hide file tree
Showing 7 changed files with 218 additions and 193 deletions.
4 changes: 2 additions & 2 deletions lookyloo/lookyloo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,10 +1046,10 @@ def get_cookie_name_investigator(self, cookie_name: str, /) -> tuple[list[tuple[
for domain, freq in self.indexing.get_cookie_domains(cookie_name)]
return captures, domains

def get_favicon_investigator(self, favicon_sha512: str, /) -> tuple[list[tuple[str, str, str]], bytes | None]:
def get_favicon_investigator(self, favicon_sha512: str, /) -> tuple[list[tuple[str, str, str, datetime]], bytes | None]:
'''Returns all the captures related to a cookie name entry, used in the web interface.'''
cached_captures = self.sorted_capture_cache([uuid for uuid in self.indexing.get_captures_favicon(favicon_sha512)])
captures = [(cache.uuid, cache.title, cache.redirects[-1]) for cache in cached_captures]
captures = [(cache.uuid, cache.title, cache.redirects[-1], cache.timestamp) for cache in cached_captures]
favicon = self.indexing.get_favicon(favicon_sha512)
return captures, favicon

Expand Down
87 changes: 47 additions & 40 deletions website/web/templates/body_hash.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% if from_popup %}
{% extends "main.html" %}

{% from 'bootstrap5/utils.html' import render_messages %}
Expand All @@ -13,53 +14,59 @@
});
</script>

{% if from_popup %}
<script type="text/javascript">
function openTreeInNewTab(treeUUID) {
window.opener.openTreeInNewTab(treeUUID);
};
</script>
{% endif %}

{% endblock %}
{%endif%}

{% block content %}
<center>
<h4>{{ body_hash }}</h4>
{% if from_popup %}
<button onclick="window.history.back();" class="btn btn-primary" type="button">Go Back</button>
{% endif %}
</center>
<div class="table-responsive">
<table id="table" class="table" style="width:96%">
<thead>
<tr>
<th>Hostname</th>
<th>Frequency</th>
</tr>
</thead>
<tbody>
{% for domain, freq in domains %}
<tr>
<td>
{{ domain }}
</td>
<td>{{ freq }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<p>The same file was seen in these captures:</p>
<ul>
{% for capture_uuid, title in captures %}
<li>
{% if from_popup %}
<a href="#/" onclick="openTreeInNewTab('{{ capture_uuid }}')">{{ title }}</a>
{% else %}
<a href="{{ url_for('tree', tree_uuid=capture_uuid) }}")">{{ title }}</a>
{% endif %}
</li>
{% endfor %}
</ul>

{% if from_popup %}
<button onclick="window.history.back();" class="btn btn-primary" type="button">Go Back</button>
{%endif%}

<script type="text/javascript">
new DataTable('#bodyHashDetailsTable', {
columnDefs: [{ width: '20%', targets: 0 },
{ width: '80%', targets: 1 }],
});
</script>
<center>
<h4>{{ body_hash }}</h4>
</center>
<table id="bodyHashDetailsTable" class="table table-striped" style="width:100%">
<thead>
<tr>
<th>Hostname</th>
<th>Frequency</th>
</tr>
</thead>
<tbody>
{% for domain, freq in domains %}
<tr>
<td>
{{ domain }}
</td>
<td>{{ freq }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<p>The same file was seen in these captures:</p>
<ul>
{% for capture_uuid, title in captures %}
<li>
{% if from_popup %}
<a href="#/" onclick="openTreeInNewTab('{{ capture_uuid }}')">{{ title }}</a>
{% else %}
<a href="{{ url_for('tree', tree_uuid=capture_uuid) }}">{{ title }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endblock %}
74 changes: 36 additions & 38 deletions website/web/templates/favicon_details.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
{% extends "main.html" %}
<script type="text/javascript">
new DataTable('#faviconDetailsTable', {
columnDefs: [{ width: '40%', targets: 0 },
{ width: '40%', targets: 1 },
{ width: '20%', targets: 2 }],
});
</script>

{% from 'bootstrap5/utils.html' import render_messages %}

{% block title %}Favicon: {{ favicon_sha512 }}{% endblock %}

{% block content %}
<center>
<h2>{{ favicon_sha512 }}</h2>
<img src="data:image/ico;base64,{{ b64_favicon }}" style="width:32px;height:32px;"/>
</center>
<p>The same favicon was seen in these captures:</p>
<ul>
<div class="table-responsive">
<table id="table" class="table">
<thead>
<tr>
<th>Capture Title</th>
<th>Landing page</th>
</tr>
</thead>
<tbody>
{% for capture_uuid, title, landing_page in captures %}
<tr>
<td>
<a href="{{ url_for('tree', tree_uuid=capture_uuid) }}">
{{ title }}
</a>
</td>
<td>
{{landing_page}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</ul>
{% endblock %}
<center>
<img src="data:image/ico;base64,{{ b64_favicon }}" style="width:64px;height:64px;"/>
</center>
<table id="faviconDetailsTable" class="table table-striped" style="width:100%">
<thead>
<tr>
<th>Capture Title</th>
<th>Landing page</th>
<th>Capture Time</th>
</tr>
</thead>
<tbody>
{% for capture_uuid, title, landing_page, capture_time in captures %}
<tr>
<td>
<a href="{{ url_for('tree', tree_uuid=capture_uuid) }}">
{{ title }}
</a>
</td>
<td>
{{landing_page}}
</td>
<td>
{{capture_time}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
113 changes: 60 additions & 53 deletions website/web/templates/historical_lookups.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,75 @@
{% if not circl_pdns and not riskiq %}
No historical data available
{%else%}
{% if circl_pdns %}
<center>
<h1 class="display-4">CIRCL Passive DNS
<div class="help-tip" title="Click for more details"
onclick="location.href='https://www.circl.lu/services/passive-dns/';"
style="cursor: pointer;">
</div>
</h1>
{% for query, responses in circl_pdns.items() if responses %}
<div>
<h3>{{query}}</h3>
<table class="table">
{% if circl_pdns %}
<script type="text/javascript">
new DataTable('#CIRCL_pdns_table');
</script>

<center>
<h1 class="display-4">CIRCL Passive DNS
<div class="help-tip" title="Click for more details"
onclick="location.href='https://www.circl.lu/services/passive-dns/';"
style="cursor: pointer;">
</div>
</h1>
{% for query, responses in circl_pdns.items() if responses %}
<div>
<h3>{{query}}</h3>
<table id= "CIRCL_pdns_table" class="table table-striped" style="width:100%">
<thead>
<tr>
<th class="col-sm-2" scope="col">First seen</th>
<th class="col-sm-2" scope="col">Last seen</th>
<th class="col-sm-1" scope="col">RR Type</th>
<th class="col-sm-2" scope="col">R Data</th>
<th scope="col">RR Name</th>
</thead>
<tbody>
{%for response in responses %}
<tr>
<td>{{response.time_first_datetime}}</td>
<td>{{response.time_last_datetime}}</td>
<td>{{response.rrtype}}</td>
<td>{{response.rdata}}</td>
<td>{{response.rrname}}</td>
</tr>
{% endfor %}
</table>
</div>
{%endfor%}
</center>
{% endif%}
{% if riskiq %}
<hr>
<script type="text/javascript">
new DataTable('#RiskIQ_pdns_table');
</script>
<center>
<h1 class="display-4">RiskIQ</h1>
<div>
<h3>{{riskiq['queryValue']}}</h3>
<h4>{{riskiq['firstSeen']}} - {{ riskiq['lastSeen']}}</h4>
<table id="RiskIQ_pdns_table" class="table table-striped" style="width:100%">
<thead>
<tr>
<th class="col-sm-2" scope="col">First seen</th>
<th class="col-sm-2" scope="col">Last seen</th>
<th class="col-sm-1" scope="col">RR Type</th>
<th class="col-sm-2" scope="col">R Data</th>
<th scope="col">RR Name</th>
<th class="col-sm-1" scope="col">Type</th>
<th scope="col">Resolve</th>
</thead>
<tbody>
{%for response in responses %}
{% for entry in riskiq['results'] %}
<tr>
<td>{{response.time_first_datetime}}</td>
<td>{{response.time_last_datetime}}</td>
<td>{{response.rrtype}}</td>
<td>{{response.rdata}}</td>
<td>{{response.rrname}}</td>
<td>{{entry['firstSeen']}}</td>
<td>{{entry['lastSeen']}}</td>
<td>{{entry['recordType']}}</td>
<td>{{entry['resolve']}}</td>
</tr>
{% endfor %}
</table>
</div>
{%endfor%}
</center>
{% endif%}
{% if riskiq %}
<hr>
<center>
<h1 class="display-4">RiskIQ</h1>
<div>
<h3>{{riskiq['queryValue']}}</h3>
<h4>{{riskiq['firstSeen']}} - {{ riskiq['lastSeen']}}</h4>
<table class="table">
<thead>
<tr>
<th class="col-sm-2" scope="col">First seen</th>
<th class="col-sm-2" scope="col">Last seen</th>
<th class="col-sm-1" scope="col">Type</th>
<th scope="col">Resolve</th>
</thead>
<tbody>
{% for entry in riskiq['results'] %}
<tr>
<td>{{entry['firstSeen']}}</td>
<td>{{entry['lastSeen']}}</td>
<td>{{entry['recordType']}}</td>
<td>{{entry['resolve']}}</td>
</tr>
{% endfor %}
</table>
</div>
</center>
{% endif%}
</div>
</center>
{% endif%}
{% endif%}
</div>
Loading

0 comments on commit dcbec2e

Please sign in to comment.