E-commerce Hacking Threat Analyzer

E-commerce Hacking Threat Analyzer

Simulate a security scan of your e-commerce setup to identify potential vulnerabilities.

E-commerce Setup Details

Analysis Report Will Appear Here

Enter your site details and click "Analyze for Threats" to simulate a security scan.

${key} - ${item.sev}

${item.issue}

`; } html += '

Specific Plugins

'; for (const key in vulnerabilityDB.plugins) { const item = vulnerabilityDB.plugins[key]; html += `

${key} - ${item.sev}

${item.issue}

`; } html += '

Keyword Triggers

'; for (const key in vulnerabilityDB.keywords) { const item = vulnerabilityDB.keywords[key]; html += `

"${key}" - ${item.sev}

${item.issue}

`; } html += '
'; dbDisplay.innerHTML = html; } function handleAnalysis() { const platform = platformSelect.value; const plugins = pluginsListInput.value.trim().split('\n').filter(p => p); let threats = []; let riskScore = 0; const riskMap = {'Low': 1, 'Medium': 3, 'High': 5, 'Critical': 10}; // 1. Check platform if (vulnerabilityDB.platforms[platform]) { const p_vuln = vulnerabilityDB.platforms[platform]; threats.push({ source: platform, ...p_vuln }); riskScore += riskMap[p_vuln.sev]; } // 2. Check plugins plugins.forEach(plugin => { // Check for exact plugin match if (vulnerabilityDB.plugins[plugin]) { const pl_vuln = vulnerabilityDB.plugins[plugin]; threats.push({ source: plugin, ...pl_vuln }); riskScore += riskMap[pl_vuln.sev]; } // Check for keyword matches for (const key in vulnerabilityDB.keywords) { if (plugin.toLowerCase().includes(key)) { const kw_vuln = vulnerabilityDB.keywords[key]; threats.push({ source: `Plugin: "${plugin}"`, ...kw_vuln }); riskScore += riskMap[kw_vuln.sev]; } } }); let overallRisk = 'Low'; if (riskScore >= 10) overallRisk = 'Critical'; else if (riskScore >= 5) overallRisk = 'High'; else if (riskScore >= 2) overallRisk = 'Medium'; lastResults = { overallRisk, threats }; renderResults(lastResults); } function renderResults(results) { let threatRows = results.threats.length > 0 ? results.threats.map(t => ` ${t.source} ${t.sev} ${t.issue} ${t.rec} `).join('') : `No specific threats found based on the mock database.`; analysisResults.innerHTML = `

Analysis Report

Overall Risk Level: ${results.overallRisk}
${threatRows}
Source Severity Issue Recommendation
`; document.getElementById('download-pdf-btn').addEventListener('click', handlePdfDownload); lucide.createIcons(); } async function handlePdfDownload() { if (!lastResults) return; const { jsPDF } = window.jspdf; // Populate PDF container document.getElementById('pdf-url').textContent = siteUrlInput.value; document.getElementById('pdf-scan-date').textContent = new Date().toLocaleDateString(); const riskSummaryEl = document.getElementById('pdf-risk-summary'); riskSummaryEl.className = `p-4 rounded-lg text-xl font-bold risk-${lastResults.overallRisk.toLowerCase()}`; riskSummaryEl.textContent = lastResults.overallRisk; let tableHtml = ` ${lastResults.threats.map(t => ` `).join('') || ``}
Source Severity Issue Recommendation
${t.source} ${t.sev} ${t.issue} ${t.rec}
No threats found.
`; document.getElementById('pdf-threats-table').innerHTML = tableHtml; try { const canvas = await html2canvas(document.getElementById('pdf-content'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgProps = pdf.getImageProperties(imgData); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('E-commerce_Threat_Analysis.pdf'); } catch (e) { console.error("PDF generation failed:", e); alert("An error occurred generating the PDF."); } } // --- Event Listeners --- tabs.forEach((tab, index) => tab.btn.addEventListener('click', () => switchTab(index))); prevBtn.addEventListener('click', () => switchTab(currentTab - 1)); nextBtn.addEventListener('click', () => switchTab(currentTab + 1)); analyzeBtn.addEventListener('click', handleAnalysis); // --- Initialization --- pluginsListInput.value = samplePlugins; platformSelect.value = 'WooCommerce'; switchTab(0); updateNavButtons(); displayDB(); lucide.createIcons(); });
Scroll to Top