Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 82 additions & 29 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,10 @@ <h5 class="fw-bold">Drag & Drop Evidence Files Here</h5>
<tr class="table-header">
<th width="5%" class="ps-4"><input type="checkbox" id="selectAll" onclick="toggleAll(this)"></th>
<th width="5%">#</th>
<th width="30%">Filename</th>
<th width="20%">MD5 Hash</th>
<th width="40%">SHA-256 (Section 63 BSA Compliant)</th>
<th width="25%">Filename</th>
<th width="15%">MD5 Hash</th>
<th width="20%">SHA-3 (Keccak-512)</th>
<th width="30%">SHA-256 (Section 63 BSA Compliant)</th>
</tr>
</thead>
<tbody id="hashTableBody" style="background: white;"></tbody>
Expand Down Expand Up @@ -492,10 +493,11 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
<td class="ps-4"><input type="checkbox" name="fileSelect" checked></td>
<td>${rowCount}</td>
<td class="fw-bold text-dark">
${file.name}
${file.name}
${isEml ? '<span class="badge bg-danger text-white ms-2">EMAIL</span>' : ''}
</td>
<td class="hash-font md5">Calculating...</td>
<td class="hash-font sha3">Calculating...</td>
<td class="hash-font sha256">Calculating...</td>
</tr>
`);
Expand All @@ -518,6 +520,9 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
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();
Expand Down Expand Up @@ -634,6 +639,8 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>

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,
Expand All @@ -646,6 +653,7 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
['Message-ID', emailData.messageId],
['Originating IP', emailData.serverIP],
['DKIM Status', emailData.dkim],
['SHA-3 (Keccak-512)', sha3Hash],
['SHA-256 Hash', sha256]
],
theme: 'grid',
Expand Down Expand Up @@ -715,7 +723,8 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
rows.push([
cells[1].innerText,
cells[2].innerText,
cells[4].innerText
cells[4].innerText,
cells[5].innerText
]);
}
});
Expand All @@ -727,22 +736,23 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>

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' }
}
});

Expand All @@ -763,21 +773,28 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
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
})],
Expand All @@ -793,8 +810,11 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
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 })]
})] })
]
}));
Expand Down Expand Up @@ -837,31 +857,56 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>

// ===== 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 =====
Expand All @@ -883,6 +928,14 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
});
}

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();
Expand Down