`;
}
html += '`;
}
html += '`;
}
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 => `
Specific Plugins
'; for (const key in vulnerabilityDB.plugins) { const item = vulnerabilityDB.plugins[key]; html += `${key} - ${item.sev}
${item.issue}
Keyword Triggers
'; for (const key in vulnerabilityDB.keywords) { const item = vulnerabilityDB.keywords[key]; html += `"${key}" - ${item.sev}
${item.issue}
Analysis Report
Overall Risk Level:
${results.overallRisk}
| Source | Severity | Issue | Recommendation |
|---|
| Source | Severity | Issue | Recommendation |
|---|---|---|---|
| ${t.source} | ${t.sev} | ${t.issue} | ${t.rec} |
| No threats found. | |||
