diff --git a/index.html b/index.html index d276a17..dcdb2f3 100644 --- a/index.html +++ b/index.html @@ -287,9 +287,10 @@
Drag & Drop Evidence Files Here
# - Filename - MD5 Hash - SHA-256 (Section 63 BSA Compliant) + Filename + MD5 Hash + SHA-3 (Keccak-512) + SHA-256 (Section 63 BSA Compliant) @@ -492,10 +493,11 @@
Yahoo/Outlook:
${rowCount} - ${file.name} + ${file.name} ${isEml ? 'EMAIL' : ''} Calculating... + Calculating... Calculating... `); @@ -518,6 +520,9 @@
Yahoo/Outlook:
setTimeout(() => { if (row) { row.querySelector('.md5').innerText = CryptoJS.MD5(wordArray).toString(); + const sha3Hash = CryptoJS.SHA3(wordArray, { outputLength: 512 }).toString(); + row.querySelector('.sha3').innerText = sha3Hash; + console.log(`[SHA-3] ${file.name}: ${sha3Hash}`); row.querySelector('.sha256').innerText = CryptoJS.SHA256(wordArray).toString(); } processQueue(); @@ -634,6 +639,8 @@
Yahoo/Outlook:
const tableStartY = Math.max(35, 10 + fileNameLines.length * 4 + 10); + const sha3Hash = CryptoJS.SHA3(CryptoJS.lib.WordArray.create(await readFileAsArrayBuffer(files[i])), { outputLength: 512 }).toString(); + doc.setTextColor(0, 0, 0); doc.autoTable({ startY: tableStartY, @@ -646,6 +653,7 @@
Yahoo/Outlook:
['Message-ID', emailData.messageId], ['Originating IP', emailData.serverIP], ['DKIM Status', emailData.dkim], + ['SHA-3 (Keccak-512)', sha3Hash], ['SHA-256 Hash', sha256] ], theme: 'grid', @@ -715,7 +723,8 @@
Yahoo/Outlook:
rows.push([ cells[1].innerText, cells[2].innerText, - cells[4].innerText + cells[4].innerText, + cells[5].innerText ]); } }); @@ -727,22 +736,23 @@
Yahoo/Outlook:
doc.autoTable({ startY: 70, - head: [['#', 'Filename', 'SHA-256']], + head: [['#', 'Filename', 'SHA-3 (Keccak-512)', 'SHA-256']], body: rows, theme: 'grid', - headStyles: { + headStyles: { fillColor: [0, 51, 102], fontSize: 11, fontStyle: 'bold' }, - bodyStyles: { - fontSize: 9, + bodyStyles: { + fontSize: 7, font: 'courier' }, columnStyles: { - 0: { cellWidth: 40 }, - 1: { cellWidth: 300 }, - 2: { cellWidth: 450, font: 'courier' } + 0: { cellWidth: 30 }, + 1: { cellWidth: 200 }, + 2: { cellWidth: 300, font: 'courier' }, + 3: { cellWidth: 260, font: 'courier' } } }); @@ -763,21 +773,28 @@
Yahoo/Outlook:
rows.push(new TableRow({ children: [ new TableCell({ - children: [new Paragraph({ + children: [new Paragraph({ children: [new TextRun({ text: "#", bold: true, color: "FFFFFF" })], alignment: AlignmentType.CENTER })], shading: { fill: "003366" } }), new TableCell({ - children: [new Paragraph({ + children: [new Paragraph({ children: [new TextRun({ text: "Filename", bold: true, color: "FFFFFF" })], alignment: AlignmentType.CENTER })], shading: { fill: "003366" } }), new TableCell({ - children: [new Paragraph({ + children: [new Paragraph({ + children: [new TextRun({ text: "SHA-3 (Keccak-512)", bold: true, color: "FFFFFF" })], + alignment: AlignmentType.CENTER + })], + shading: { fill: "003366" } + }), + new TableCell({ + children: [new Paragraph({ children: [new TextRun({ text: "SHA-256", bold: true, color: "FFFFFF" })], alignment: AlignmentType.CENTER })], @@ -793,8 +810,11 @@
Yahoo/Outlook:
children: [ new TableCell({ children: [new Paragraph(cells[1].innerText)] }), new TableCell({ children: [new Paragraph(cells[2].innerText)] }), - new TableCell({ children: [new Paragraph({ + new TableCell({ children: [new Paragraph({ children: [new TextRun({ text: cells[4].innerText, font: "Courier New", size: 18 })] + })] }), + new TableCell({ children: [new Paragraph({ + children: [new TextRun({ text: cells[5].innerText, font: "Courier New", size: 18 })] })] }) ] })); @@ -837,31 +857,56 @@
Yahoo/Outlook:
// ===== DOWNLOAD CSV ===== function downloadSelectedCSV() { - let csv = "#,Subject,From,To,Date,Originating IP,DKIM,SHA-256\n"; - - let counter = 1; - const promises = []; - + const selectedRows = []; + const emlRows = []; + document.querySelectorAll("#hashTableBody tr").forEach(tr => { - if (tr.querySelector('input').checked && tr.fileData && tr.fileData.name.toLowerCase().endsWith('.eml')) { + if (tr.querySelector('input').checked) { + const cells = tr.querySelectorAll('td'); + selectedRows.push(tr); + if (tr.fileData && tr.fileData.name.toLowerCase().endsWith('.eml')) { + emlRows.push(tr); + } + } + }); + + if (emlRows.length > 0) { + let csv = "#,Subject,From,To,Date,Originating IP,DKIM,SHA-3 (Keccak-512),SHA-256\n"; + let counter = 1; + const promises = []; + + emlRows.forEach(tr => { const cells = tr.querySelectorAll('td'); promises.push( readFile(tr.fileData).then(text => { const eml = parseEml(text); - return `${counter++},"${eml.subject}","${eml.from}","${eml.to}","${eml.date}","${eml.serverIP}","${eml.dkim}","${cells[4].innerText}"\n`; + return `${counter++},"${eml.subject}","${eml.from}","${eml.to}","${eml.date}","${eml.serverIP}","${eml.dkim}","${cells[4].innerText}","${cells[5].innerText}"\n`; }) ); - } - }); + }); - Promise.all(promises).then(rows => { - csv += rows.join(''); + Promise.all(promises).then(rows => { + csv += rows.join(''); + const blob = new Blob([csv], { type: 'text/csv' }); + const a = document.createElement('a'); + a.href = URL.createObjectURL(blob); + a.download = "Email_Report.csv"; + a.click(); + }); + } else if (selectedRows.length > 0) { + let csv = "#,Filename,MD5,SHA-3 (Keccak-512),SHA-256\n"; + selectedRows.forEach((tr, i) => { + const cells = tr.querySelectorAll('td'); + csv += `${i + 1},"${cells[2].innerText.trim()}","${cells[3].innerText}","${cells[4].innerText}","${cells[5].innerText}"\n`; + }); const blob = new Blob([csv], { type: 'text/csv' }); const a = document.createElement('a'); a.href = URL.createObjectURL(blob); - a.download = "Email_Report.csv"; + a.download = "Hash_Report.csv"; a.click(); - }); + } else { + alert("Please select files to include in report."); + } } // ===== UTILITY FUNCTIONS ===== @@ -883,6 +928,14 @@
Yahoo/Outlook:
}); } + function readFileAsArrayBuffer(file) { + return new Promise(resolve => { + const reader = new FileReader(); + reader.onload = e => resolve(e.target.result); + reader.readAsArrayBuffer(file); + }); + } + async function calculateSHA256(file) { return new Promise(resolve => { const reader = new FileReader();