2025-01-08 15:04:52 +01:00
< script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" > < / script >
< script src = "static/javascript.js" > < / script >
2025-03-26 19:58:04 +01:00
<!-- took this from https://stackoverflow.com/questions/71301182/creating - a - html - table - with - expandable - collapsible - sections, need to place the Javascript elsewhere -->
2025-01-08 15:04:52 +01:00
< div class = "table-container" >
2025-03-26 19:58:04 +01:00
< div class = "results-table" >
< table id = "myTable" class = "table table-striped" >
< tr class = "header" >
2025-01-08 15:04:52 +01:00
< th > IP address< / th >
< th > VirusTotal< / th >
< th > AbuseIPDB< / th >
< th > Domain< / th >
< th > Registration country< / th >
< th > Registration date< / th >
< th > Email security< / th >
2025-03-26 19:58:04 +01:00
< / tr >
2025-01-08 15:04:52 +01:00
< tbody >
{% for host in hosts %}
< tr >
< td > {{host.host}}< / td >
2025-03-26 19:58:04 +01:00
< td > Score: {{host.vt['vendors_malicious']}} / {{host.vt['vendors_total']}}< br >
2025-01-08 15:04:52 +01:00
Last updated: {{host.vt['last_update']}}< / td >
< td > Score: {{host.abuseipdb['data']['abuseConfidenceScore']}}
Last reported: {{host.abuseipdb['data']['lastReportedAt']}}< / td >
< td > {{host.domain}}< / td >
< td > {{host.metadata['registrar_country']}}< / td >
< td > {{host.metadata['creation_date']}}< / td >
< td > SPF: {{host.emailsec[0]}}, DMARC: {{host.emailsec[1]}}< / td >
< / tr >
< tr >
< td colspan = "7" id = "info" >
< p >
Vendor marked this host as malicious or suspicious:
2025-03-26 19:58:04 +01:00
{% for key, value in host.vt['all_vendors'].items() if value['category'] in ['malicious', 'suspicious'] %}
{{key}}
2025-01-08 15:04:52 +01:00
{% endfor %}
< / p >
2025-03-26 19:58:04 +01:00
2025-01-08 15:04:52 +01:00
< / td >
< / tr >
{% endfor %}
< / tbody >
< / table >
< / div >
< / div >
2025-03-26 19:58:04 +01:00
{# {% include "test-table.html" %} #}
<!-- important to know: uncommenting the line above makes the red/green JavaScript not work anymore, BUT makes the collapsible table row table work! Go figure it out XD -->
2025-01-08 15:04:52 +01:00
{% block scripts %}
2025-03-26 19:58:04 +01:00
{#{% for host in hosts %}#}
{#whoopsie = JSON.parse({{ host.vt_json.text | tojson }}) {% endfor %}#}
{#{{whoopsie}}#}
2025-01-08 15:04:52 +01:00
< script >
2025-03-26 19:58:04 +01:00
2025-01-08 15:04:52 +01:00
$(document).ready(function () {
2025-03-26 19:58:04 +01:00
$('myTable').DataTable({
paging: false,
searching: false,
info: false,
2025-01-08 15:04:52 +01:00
columnDefs: [{
targets: '_all',
createdCell: function (td, cellData, rowData, row, col) {
if (cellData == 'outlook.com' & & col == 0) {
$(td).css({'background-color': 'red', 'color': 'white'});
}
2025-03-26 19:58:04 +01:00
if (cellData.startsWith('Score: 0' & & col == 1)) {
$(td).css({'background-color': 'orange', 'color': 'white'});
}
if (cellData > 0 & & col == 2) {
$(td).css({'background-color': 'grey', 'color': 'white'});
}
if (cellData > 0 & & col == 3) {
2025-01-08 15:04:52 +01:00
$(td).css({'background-color': 'green', 'color': 'white'});
}
2025-03-26 19:58:04 +01:00
},
}
]
})
2025-01-08 15:04:52 +01:00
});
2025-03-26 19:58:04 +01:00
2025-01-08 15:04:52 +01:00
< / script >
{% endblock %}