diff --git a/bin/background_build_captures.py b/bin/background_build_captures.py index 9152c6f4..3915e9fa 100755 --- a/bin/background_build_captures.py +++ b/bin/background_build_captures.py @@ -120,10 +120,13 @@ class BackgroundBuildCaptures(AbstractManager): try: self.lookyloo.trigger_modules(uuid, auto_trigger=True, force=False, as_admin=False) except Exception as e: - self.logger.exception(f'Unable to trigger modules for {uuid}: {e}') + self.logger.warning(f'Unable to trigger modules for {uuid}: {e}') # Trigger whois request on all nodes for node in ct.root_hartree.hostname_tree.traverse(): - self.lookyloo.uwhois.query_whois_hostnode(node) + try: + self.lookyloo.uwhois.query_whois_hostnode(node) + except Exception as e: + self.logger.info(f'Unable to query whois for {node.name}: {e}') self.logger.info(f'Pickle for {uuid} built.') got_new_captures = True max_captures -= 1 diff --git a/website/web/sri.txt b/website/web/sri.txt index a682c9d3..e806730c 100644 --- a/website/web/sri.txt +++ b/website/web/sri.txt @@ -20,7 +20,7 @@ "favicon.ico": "KOmrfwRbOQqhhwSeBkNpMRAxSVMmmLg+2kRMg9iSv7OWjE9spJc7x4MKB4AE/hi0knaV7UBVctAU6XZ7AC72ZA==", "font.png": "RwoQkj9dT9SLUL2F7cAA16Nat9t2hDb58eQlHF9ThUar829p0INUXG+5XuDaFOC8SsmCZK5vw2f+YAQ6mLC1Qw==", "generic.css": "Sh/BcxFMLYYaLdCluVt9efGvJ9CF5d+YJ7lkL2M24PRGu8VZHI9lJiUlFObIocjQgwss3Ve2U5cUAE5WiAdpQQ==", - "generic.js": "xeXEopg1wyufE1owZH6don+1vtvsJnbM/BYC+oLOWHTtgpsGKfNhzyLuZsb3DSKtU7knIK+vwPwPJepncWM8KA==", + "generic.js": "pGtPn+FrS0QgPQq793fcOQ1gFQvt2nhXR34HgbjHAp+BsLYxFhCaOnrBWgsH8VRaR58hvQvyMn2ahI5s6C+s9w==", "hostname_popup.js": "froqRK2HEphJSU++PkPfEvaztrzH05QwZ4q2wEBAL6JDinpOCZqW9GMMV6oBhpTmyu5zfsz6ZpqrfaB0C0iIwg==", "html.png": "T7pZrb8MMDsA/JV/51hu+TOglTqlxySuEVY0rpDjTuAEyhzk2v+W4kYrj7vX+Tp3n2d2lvVD08PwhCG62Yfbzg==", "ifr.png": "rI5YJypmz1QcULRf9UaOYSqV4tPUSxUdLAycoYzCwywt4Pw4eWzBg9SUr769VyIimoiIyJR+aNuoIA4p5WO2fQ==", @@ -33,7 +33,7 @@ "loader.gif": "ZZKD5vLSKBWKeUpa2KI9qheUJ49iTI/UULmVU/AX28fBfH00K3lLc2v5pVJZ4qXG1BbB13LTXzRKKU35H2XfNg==", "lookyloo.jpeg": "i6wBj8CsIM5YAQLEMQfhs3CNOSKkErF8AMqqM6ZygSwCyQgv9CU8xt94veMZhM/ufBWoz7kAXmR+yywmxsTxug==", "redirect.png": "PAjzlPV97rEFvH55mG1ZC9wRl98be3yMeX/nENuFkJcds6/AXgSR2ig/QyPULgobSnNgiYieLVWY/oqsgeywrQ==", - "render_tables.js": "SzrpJYC5mvecw2s/hm8Sh+mDnDR7Ygqzw2f2m3ysSd0crwfDf71jvXvynDbbL7ECVDK4TsAd7kdzz+lUNQLYqA==", + "render_tables.js": "2J/KmrgCb6RG760S9ykgD1VzftrSXcQVE1HlPJ6wCDU35KEg3qPEu847VT3w7MSkGZ/1xO0n6OaTskpagRwAcA==", "secure.svg": "H8ni7t0d60nCJDVGuZpuxC+RBy/ipAjWT627D12HlZGg6LUmjSwPTQTUekm3UJupEP7TUkhXyq6WHc5gy7QBjg==", "stats.css": "/kY943FwWBTne4IIyf7iBROSfbGd82TeBicEXqKkRwawMVRIvM/Pk5MRa7okUyGIxaDjFQGmV/U1vy+PhN6Jbw==", "stats_graph.js": "S/sMNQK1UMMLD0xQeEa7sq3ce8o6oPxwxGlyKVtaHOODjair86dbBDm7cu6pa/elMRDJT1j09jEFjWp+5GbhTw==", diff --git a/website/web/static/generic.js b/website/web/static/generic.js index 29090f63..1bda2690 100644 --- a/website/web/static/generic.js +++ b/website/web/static/generic.js @@ -39,6 +39,19 @@ function downloadBase64File(contentType, base64Data, fileName) { downloadLink.click(); } +function render_datetime_with_tz(data) { + const date = new Date(data); + return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, "0")}-${date.getDate().toString().padStart(2, "0")} ${date.toTimeString()}`; +}; + +DataTable.render.datetime_with_tz = function () { + return function ( data, type, row ) { + if ( type === 'display' ) { + return render_datetime_with_tz(data); + } + return data; + }; +} function newTabClickListener() { document.querySelectorAll('.openNewTab').forEach(el => el.addEventListener('click', event => { diff --git a/website/web/static/render_tables.js b/website/web/static/render_tables.js index 4c4cc94d..580dfef5 100644 --- a/website/web/static/render_tables.js +++ b/website/web/static/render_tables.js @@ -11,19 +11,10 @@ type: 'POST' }, columns : [ - { data: 'capture_time' }, - { data: 'capture_title' }, - { data: 'url' } + { data: 'capture_time', width: '20%', render: DataTable.render.datetime_with_tz() }, + { data: 'capture_title', width: '40%' }, + { data: 'url', width: '40%' } ], - order: [[ 0, "desc" ]], - columnDefs: [{ width: '20%', 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: '40%', targets: 1 }, - { width: '40%', targets: 2 }], }) } if (document.getElementById('bodyHashDetailsTable')) { @@ -38,19 +29,10 @@ type: 'POST' }, columns : [ - { data: 'capture_time' }, - { data: 'capture_title' }, - { data: 'url' } + { data: 'capture_time', width: '20%', render: DataTable.render.datetime_with_tz() }, + { data: 'capture_title', width: '40%' }, + { data: 'url', width: '40%' } ], - order: [[ 0, "desc" ]], - columnDefs: [{ width: '20%', 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: '40%', targets: 1 }, - { width: '40%', targets: 2 }], }) } if (document.getElementById('hashTypeDetailsTable')) { @@ -65,21 +47,10 @@ type: 'POST' }, columns : [ - { data: 'capture_time' }, - { data: 'capture_title' }, - { data: 'landing_page' } + { data: 'capture_time', width: '20%', render: DataTable.render.datetime_with_tz() }, + { data: 'capture_title', width: '40%' }, + { data: 'landing_page', width: '40%' } ], - 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 }], - }); } @@ -95,22 +66,10 @@ type: 'POST' }, columns : [ - { data: 'capture_time' }, - { data: 'capture_title' }, - { data: 'landing_page' } + { data: 'capture_time', width: '20%', render: DataTable.render.datetime_with_tz() }, + { data: 'capture_title', width: '40%' }, + { data: 'landing_page', width: '40%' } ], - retrieve: true, - 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 }], - }); } if (document.getElementById('bodyHashesTable')) { @@ -198,47 +157,29 @@ type: 'POST' }, columns : [ - { data: 'capture_time' }, - { data: 'capture_title' }, - { data: 'landing_page' } + { data: 'capture_time', width: '20%', render: DataTable.render.datetime_with_tz() }, + { data: 'capture_title', width: '40%' }, + { data: 'landing_page', width: '40%' } ], - order: [[ 0, "desc" ]], - columnDefs: [{ width: '20%', 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: '40%', targets: 1 }, - { width: '40%', targets: 2 }] }); } if (document.getElementById('hostnameTable')) { hostname = document.getElementById('hostnameTable').dataset.hostname; new DataTable('#hostnameTable', { - processing: true, - serverSide: true, - retrieve: true, - drawCallback: function (settings) { newTabClickListener() }, - ajax: { - url: `/tables/hostnameTable/${hostname}`, - type: 'POST' - }, - columns : [ - { data: 'capture_time' }, - { data: 'capture_title' }, - { data: 'landing_page' } - ], - order: [[ 0, "desc" ]], - columnDefs: [{ width: '20%', 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: '40%', targets: 1 }, - { width: '40%', targets: 2 }], + processing: true, + serverSide: true, + retrieve: true, + drawCallback: function (settings) { newTabClickListener() }, + ajax: { + url: `/tables/hostnameTable/${hostname}`, + type: 'POST' + }, + columns : [ + { data: 'capture_time', width: '20%', render: DataTable.render.datetime_with_tz() }, + { data: 'capture_title', width: '40%' }, + { data: 'landing_page', width: '40%' } + ], }); } @@ -254,19 +195,10 @@ type: 'POST' }, columns : [ - { data: 'capture_time' }, - { data: 'capture_title' }, - { data: 'landing_page' } + { data: 'capture_time', width: '20%', render: DataTable.render.datetime_with_tz() }, + { data: 'capture_title', width: '40%' }, + { data: 'landing_page', width: '40%' } ], - order: [[ 0, "desc" ]], - columnDefs: [{ width: '20%', 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: '40%', targets: 1 }, - { width: '40%', targets: 2 }], }); } @@ -282,21 +214,10 @@ type: 'POST' }, columns : [ - { data: 'capture_time' }, - { data: 'capture_title' }, - { data: 'landing_page' } + { data: 'capture_time', width: '20%', render: DataTable.render.datetime_with_tz() }, + { data: 'capture_title', width: '40%' }, + { data: 'landing_page', width: '40%' } ], - 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 }], - }); } diff --git a/website/web/templates/index.html b/website/web/templates/index.html index af7fac42..78f22cb3 100644 --- a/website/web/templates/index.html +++ b/website/web/templates/index.html @@ -32,16 +32,9 @@ $(document).ready(function () { "pageLength": 50, "columns": [ { "orderable": false, "width": 400 }, - { "orderable": false, "width": 150 }, + { "orderable": false, "width": 150, "render": DataTable.render.datetime_with_tz()}, { "orderable": false, "width": 400 } ], - "columnDefs": [{ - "targets": 1, - "render": function ( data, type, row, meta ) { - let date = new Date(data); - return date.getFullYear() + '-' + (date.getMonth() + 1).toString().padStart(2, "0") + '-' + date.getDate().toString().padStart(2, "0") + ' ' + date.toTimeString(); - } - }] } ); });