document.addEventListener('DOMContentLoaded', function() { const domainInput = document.getElementById('domainInput'); const scanBtn = document.getElementById('scanBtn'); const resultsSection = document.getElementById('resultsSection'); const scanResults = document.getElementById('scanResults'); // Mock API function - in a real implementation, this would call actual threat intelligence APIs async function scanDomain(domain) { return new Promise((resolve) => { setTimeout(() => { // Simulate API response const isSuspicious = Math.random() > 0.7; // 30% chance to be flagged const response = { domain, isSuspicious, lastScanned: new Date().toISOString(), reputationScore: Math.floor(Math.random() * 100), categories: isSuspicious ? ['Adult Content', 'Potential CSAM', 'High Risk'] : ['General Content', 'Low Risk'], hostingInfo: { ip: `192.168.${Math.floor(Math.random() * 255)}.${Math.floor(Math.random() * 255)}`, country: isSuspicious ? 'Offshore Location' : 'United States', registrar: isSuspicious ? 'Anonymous Registrar Inc' : 'GoDaddy LLC' }, threatIndicators: isSuspicious ? ['Known bad IP neighborhood', 'Recently registered domain', 'Hidden WHOIS'] : ['Clean record'], historicalData: { firstSeen: new Date(Date.now() - Math.floor(Math.random() * 31536000000)).toISOString().split('T')[0], changes: Math.floor(Math.random() * 10) } }; resolve(response); }, 1500); // Simulate network delay }); } function displayResults(data) { scanResults.innerHTML = ''; const resultCard = document.createElement('div'); resultCard.className = 'bg-gray-700 rounded-lg p-6'; const statusColor = data.isSuspicious ? 'text-red-500' : 'text-green-500'; const statusText = data.isSuspicious ? 'SUSPICIOUS' : 'CLEAN'; resultCard.innerHTML = `
Scanned: ${new Date(data.lastScanned).toLocaleString()}
${data.reputationScore}/100
IP: ${data.hostingInfo.ip}
Country: ${data.hostingInfo.country}
Registrar: ${data.hostingInfo.registrar}
This domain has been flagged for potentially harmful content. Consider reporting to appropriate authorities.