Skip to content

Commit

Permalink
chg: Improve tables on tree and in popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Feb 27, 2024
1 parent c42b140 commit bbb3a39
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 39 deletions.
1 change: 1 addition & 0 deletions lookyloo/lookyloo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,7 @@ def get_favicon_investigator(self, favicon_sha512: str,
else:
mimetype = ''
b64_favicon = ''
mmh3_shodan = ''

# For now, there is only one probabilistic hash algo for favicons, keeping it simple
probabilistic_hash_algos = ['mmh3-shodan']
Expand Down
14 changes: 11 additions & 3 deletions website/web/templates/favicon_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

<script type="text/javascript">
new DataTable('#faviconDetailsTable_{{favicon_sha512}}', {
columnDefs: [{ width: '30%', targets: 0 },
order: [[ 0, "desc" ]],
columnDefs: [{ width: '30%',
targets: 0,
render: (data) => {
const date = new Date(data);
return date.getFullYear() + '-' + (date.getMonth() + 1).toString().padStart(2, "0") + '-' + date.getDate().toString().padStart(2, "0") + ' ' + date.toTimeString();
}
},
{ width: '30%', targets: 1 },
{ width: '50%', targets: 2 }],

});
</script>

Expand Down Expand Up @@ -32,8 +40,8 @@ <h5>Shodan MMH3 Hash: <a href="https://www.shodan.io/search?query=http.favicon.h
</a>
</td>
<td>
<span class="d-inline-block text-truncate" style="max-width: 400px;">
{{ shorten_string(landing_page, 300) }}
<span class="d-inline-block text-break" style="max-width: 400px;">
{{ landing_page }}
</span>
</td>
</tr>
Expand Down
29 changes: 22 additions & 7 deletions website/web/templates/historical_lookups.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
{%else%}
{% if circl_pdns %}
<script type="text/javascript">
new DataTable('#CIRCL_pdns_table');
new DataTable('#CIRCL_pdns_table', {
order: [[ 1, "desc" ]],
autoWidth: false,
columnDefs: [{ width: '15%', targets: 0 },
{ width: '15%', targets: 1 },
{ width: '5%', targets: 2 },
{ width: '25%', targets: 3 },
{ width: '40%', targets: 4 }]
});
</script>

<center>
Expand All @@ -26,16 +34,16 @@ <h3>{{query}}</h3>
<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-2" 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>
<td class="text-break">{{response.rdata}}</td>
<td class="text-break">{{response.rrname}}</td>
</tr>
{% endfor %}
</table>
Expand All @@ -46,7 +54,14 @@ <h3>{{query}}</h3>
{% if riskiq %}
<hr>
<script type="text/javascript">
new DataTable('#RiskIQ_pdns_table');
new DataTable('#RiskIQ_pdns_table', {
order: [[ 1, "desc" ]],
autoWidth: false,
columnDefs: [{ width: '15%', targets: 0 },
{ width: '15%', targets: 1 },
{ width: '5%', targets: 2 },
{ width: '65%', targets: 3 }]
});
</script>
<center>
<h1 class="display-4">RiskIQ</h1>
Expand All @@ -59,15 +74,15 @@ <h4>{{riskiq['firstSeen']}} - {{ riskiq['lastSeen']}}</h4>
<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>
<th class="col-sm-2" 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>
<td class="text-break">{{entry['resolve']}}</td>
</tr>
{% endfor %}
</table>
Expand Down
25 changes: 2 additions & 23 deletions website/web/templates/hostname_popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,6 @@

{% block scripts %}
{{ super() }}
<script type="text/javascript">
$(document).ready(() => {
$('table.table').DataTable( {
"order": [[ 1, "desc" ]],
"paging": false,
"info": false,
"columns": [
{ "orderable": false},
{ "orderable": false},
{ "orderable": false}
],
"columnDefs": [{
"targets": 1,
"render": (data) => {
const date = new Date(data);
return date.getFullYear() + '-' + (date.getMonth() + 1).toString().padStart(2, "0") + '-' + date.getDate().toString().padStart(2, "0") + ' ' + date.toTimeString();
}
}]
} );
});
</script>
<script>
let whereAmI = (hostnode_uuid) => window.opener.LocateNode(hostnode_uuid);
let openTreeInNewTab = (capture_uuid, hostnode_uuid=Null) => {
Expand All @@ -46,7 +25,7 @@
}
</script>
<script>
$(document).ready(() => {
document.addEventListener("DOMContentLoaded", () => {
// Grab any text in the attribute 'data-copy' and pass it to the copy function
$('.js-copy').tooltip();
$('.js-copy').click(function() {
Expand All @@ -57,7 +36,7 @@
});
</script>
<script>
$(document).ready(() => {
document.addEventListener("DOMContentLoaded", () => {
$(function () {
$('[data-bs-toggle="tooltip"]').tooltip()
})
Expand Down
35 changes: 29 additions & 6 deletions website/web/templates/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@
<p>
The same file was seen in <b>{{ total_captures }}</b> other captures.
</br>
<button class="btn btn-primary collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#captureslist_{{ identifier_for_toggle }}" aria-expanded="false" aria-controls="collapseExample">
<button class="btn btn-primary collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#captureslist_{{ identifier_for_toggle }}"
aria-expanded="false" aria-controls="collapseExample">
<span class="if-collapsed">Show other captures</span>
<span class="if-not-collapsed">Hide other captures</span>
</button>
Expand All @@ -190,25 +192,46 @@
{# ... on other URLs #}
<div>
<p>The following captures get the same file from a <b>different URL</b></p>
{{ other_captures_table(other_captures['different_url'], 20) }}
{{ other_captures_table(other_captures['different_url'], 20, identifier_for_toggle + '_same') }}
</div>
{% endif %}
</br>
{% if other_captures['same_url']|length > 0 %}
{# ... on the same URL #}
<div>
<p>The following captures get the same file from the <b>same URL</b></p>
{{ other_captures_table(other_captures['same_url'], 20) }}
{{ other_captures_table(other_captures['same_url'], 20, identifier_for_toggle + '_different') }}
</div>
{% endif %}
</div>
</div>
{% endif %}
{% endmacro %}

{% macro other_captures_table(entries, max_entries) %}
<div class="table-responsive">
<table id="table_other_captures" class="table">
{% macro other_captures_table(entries, max_entries, identifier) %}
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", () => {
new DataTable('#table_other_captures{{identifier}}', {
"order": [[ 1, "desc" ]],
"paging": false,
"info": false,
"columns": [
{ "orderable": false},
{ "orderable": false},
{ "orderable": false}
],
"columnDefs": [{
"targets": 1,
"render": (data) => {
const date = new Date(data);
return date.getFullYear() + '-' + (date.getMonth() + 1).toString().padStart(2, "0") + '-' + date.getDate().toString().padStart(2, "0") + ' ' + date.toTimeString();
}
}]
} );
});
</script>
<div>
<table id="table_other_captures{{identifier}}" class="table table-striped" style="width:100%">
<thead>
<tr>
<th>Title</th>
Expand Down
1 change: 1 addition & 0 deletions website/web/templates/tree_body_hashes.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script type="text/javascript">
new DataTable('#bodyHashesTable', {
order: [[ 0, "desc" ]],
columnDefs: [{ width: '10%', targets: 0 },
{ width: '10%', targets: 1 },
{ width: '60%', targets: 2 },
Expand Down

0 comments on commit bbb3a39

Please sign in to comment.