document.addEventListener('DOMContentLoaded', () => { // Production-Grade OSINT Data Stream const osintStream = document.getElementById('osint-stream'); let osintDataCache = []; // Real-time timestamp formatter function formatTime(date) { const now = new Date(); const diff = Math.floor((now - date) / 1000); if (diff < 60) return 'Just now'; if (diff < 3600) return `${Math.floor(diff / 60)}m ago`; if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`; return date.toLocaleDateString(); } // Fetch NIST NVD CVE Data (Production Vulnerability Feed) async function fetchNVDCVEs() { try { const response = await fetch('https://services.nvd.nist.gov/rest/json/cves/2.0?resultsPerPage=8&cvssV3Severity=CRITICAL,HIGH'); const data = await response.json(); return data.vulnerabilities.map(vuln => { const cve = vuln.cve; const metrics = cve.metrics?.cvssMetricV31?.[0]?.cvssData || {}; const severity = metrics.baseScore || 0; const vector = metrics.attackVector || 'N/A'; const description = cve.descriptions?.[0]?.value || 'No description available'; const publishedDate = new Date(cve.published); return { type: 'VULNERABILITY', platform: 'NIST NVD', msg: `${cve.id}: ${description.substring(0, 70)}... [AV:${vector}]`, time: formatTime(publishedDate), severity: severity, source: 'NVD', cveId: cve.id }; }); } catch (error) { console.error('NVD API Error:', error); return []; } } // Fetch CISA Known Exploited Vulnerabilities async function fetchCISAVulns() { try { const response = await fetch('https://www.cisa.gov/known-exploited-vulnerabilities-catalog.json'); const data = await response.json(); const today = new Date(); return data.vulnerabilities.slice(0, 5).map(vuln => { const dueDate = new Date(vuln.dueDate); const isUrgent = dueDate < today; return { type: 'ACTIVE_EXPLOIT', platform: 'CISA KEV', msg: `${vuln.cveID} - ${vuln.vendorProject}: ${vuln.vulnerabilityName.substring(0, 50)}...`, time: isUrgent ? `DUE: ${vuln.dueDate}` : `Due: ${vuln.dueDate}`, severity: 'CRITICAL', source: 'CISA', isUrgent: isUrgent }; }); } catch (error) { console.error('CISA API Error:', error); return []; } } // Fetch Hacker News Security Stories async function fetchHackerNews() { try { const response = await fetch('https://hacker-news.firebaseio.com/v0/newstories.json?print=pretty'); const storyIds = await response.json(); const stories = await Promise.all( storyIds.slice(0, 10).map(async id => { const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`); return storyResponse.json(); }) ); const securityKeywords = ['security', 'vulnerability', 'hack', 'cyber', 'exploit', 'malware', 'breach', 'attack', 'zero-day', '0day', 'ransomware', 'phishing']; return stories .filter(story => story.title && securityKeywords.some(keyword => story.title.toLowerCase().includes(keyword))) .slice(0, 4) .map(story => ({ type: 'INTELLIGENCE', platform: 'Hacker News', msg: story.title, time: formatTime(new Date(story.time * 1000)), url: story.url || `https://news.ycombinator.com/item?id=${story.id}`, source: 'HN' })); } catch (error) { console.error('Hacker News API Error:', error); return []; } } // Fetch GitHub Trending Security Repositories async function fetchGitHubSecurity() { try { const query = 'topic:security topic:cybersecurity stars:>500 pushed:>2024-01-01'; const response = await fetch(`https://api.github.com/search/repositories?q=${encodeURIComponent(query)}&sort=updated&order=desc&per_page=4`); const data = await response.json(); return data.items.map(repo => { const lastPush = new Date(repo.pushed_at); return { type: 'TOOL_DISCOVERY', platform: 'GitHub', msg: `${repo.name}: ${repo.description?.substring(0, 55) || 'No description'}`, time: `${repo.stargazers_count.toLocaleString()} ★ • Updated ${formatTime(lastPush)}`, source: 'GH', url: repo.html_url }; }); } catch (error) { console.error('GitHub API Error:', error); return []; } } // Get Real Browser/System Information function getSystemInfo() { const connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection; const connectionType = connection ? `${connection.effectiveType.toUpperCase()} • ${connection.downlink}Mbps` : 'Unknown'; const cores = navigator.hardwareConcurrency || 'Unknown'; const memory = navigator.deviceMemory ? `${navigator.deviceMemory}GB` : 'Unknown'; const doNotTrack = navigator.doNotTrack === '1' ? 'Enabled' : 'Disabled'; return { type: 'SYSTEM', platform: 'Browser Fingerprint', msg: `Cores: ${cores} | RAM: ${memory} | DNT: ${doNotTrack} | Network: ${connectionType}`, time: 'Live', source: 'LOCAL' }; } // Fetch IP Geolocation and Threat Data async function fetchIPInfo() { try { const response = await fetch('https://ipapi.co/json/'); const data = await response.json(); // Check for VPN/Proxy indicators const indicators = []; if (data.privacy?.vpn) indicators.push('VPN'); if (data.privacy?.proxy) indicators.push('Proxy'); if (data.privacy?.tor) indicators.push('TOR'); if (data.privacy?.hosting) indicators.push('Hosting'); const threatLevel = indicators.length > 0 ? 'ELEVATED' : 'NORMAL'; const indicatorText = indicators.length > 0 ? ` [${indicators.join(' + ')}]` : ''; return { type: 'NETWORK', platform: 'IP Intelligence', msg: `IP: ${data.ip} • ${data.city}, ${data.country_name} • ASN: ${data.asn} • ISP: ${data.org}${indicatorText}`, time: 'Live', source: 'IPAPI', threatLevel: threatLevel }; } catch (error) { console.error('IP API Error:', error); return { type: 'NETWORK', platform: 'IP Intelligence', msg: 'Unable to retrieve IP information - Check network connectivity', time: 'Error', source: 'IPAPI' }; } } // Fetch URLhaus Malware URLs (Public API) async function fetchURLhaus() { try { const response = await fetch('https://urlhaus-api.abuse.ch/api/v1/urls/recent/limit/3/'); const data = await response.json(); if (data.query_status !== 'ok') return []; return data.urls.map(urlData => ({ type: 'MALWARE', platform: 'URLhaus', msg: `Malware URL detected - Threat: ${urlData.threat} • ${urlData.url.substring(0, 50)}...`, time: new Date(urlData.date_added * 1000).toLocaleDateString(), source: 'URLHAUS', url: urlData.url })); } catch (error) { console.error('URLhaus API Error:', error); return []; } } // Fetch MalwareBazaar Samples async function fetchMalwareBazaar() { try { const formData = new FormData(); formData.append('query', 'get_recent'); formData.append('limit', '3'); const response = await fetch('https://mb-api.abuse.ch/api/v1/', { method: 'POST', body: formData }); const data = await response.json(); if (data.query_status !== 'ok') return []; return data.data.map(sample => ({ type: 'MALWARE_SAMPLE', platform: 'MalwareBazaar', msg: `${sample.malware_family || 'Unknown'} • ${sample.sha256_hash.substring(0, 20)}... • ${sample.file_name || 'Unnamed'}`, time: new Date(sample.first_seen).toLocaleDateString(), source: 'MALWAREBAZAAR' })); } catch (error) { console.error('MalwareBazaar API Error:', error); return []; } } // Fetch Crypto Market Data (CoinGecko - Free Public API) async function fetchCryptoData() { try { const response = await fetch('https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=3&page=1&sparkline=false'); const data = await response.json(); return data.map(coin => ({ type: 'FINANCIAL', platform: 'CoinGecko', msg: `${coin.name} (${coin.symbol.toUpperCase()}) • ${coin.current_price.toLocaleString()} • ${coin.price_change_percentage_24h >= 0 ? '+' : ''}${coin.price_change_percentage_24h.toFixed(2)}% (24h)`, time: `MCap: ${(coin.market_cap / 1000000000).toFixed(1)}B`, source: 'COINGECKO', url: `https://www.coingecko.com/en/coins/${coin.id}` })); } catch (error) { console.error('CoinGecko API Error:', error); return []; } } // Fetch Earthquake Data (USGS - Real-time monitoring) async function fetchEarthquakeData() { try { const response = await fetch('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.geojson'); const data = await response.json(); return data.features.slice(0, 3).map(quake => ({ type: 'GEOPHYSICAL', platform: 'USGS', msg: `M${quake.properties.mag.toFixed(1)} earthquake • ${quake.properties.place} • Depth: ${quake.geometry.coordinates[2]}km`, time: new Date(quake.properties.time).toLocaleString(), source: 'USGS', url: quake.properties.url })); } catch (error) { console.error('USGS API Error:', error); return []; } } // Fetch Space Weather (NOAA) async function fetchSpaceWeather() { try { const response = await fetch('https://services.swpc.noaa.gov/json/goes/primary/xrays-6-hour.json'); const data = await response.json(); if (!data || data.length === 0) return []; const latest = data[data.length - 1]; const flux = latest.flux; const classification = flux < 1.0e-8 ? 'A' : flux < 1.0e-7 ? 'B' : flux < 1.0e-6 ? 'C' : flux < 1.0e-5 ? 'M' : 'X'; return [{ type: 'SPACE_WEATHER', platform: 'NOAA SWPC', msg: `Solar X-Ray Flux: ${flux.toExponential(2)} W/m² • Class: ${classification}`, time: new Date(latest.time).toLocaleString(), source: 'NOAA' }]; } catch (error) { console.error('NOAA API Error:', error); return []; } } function createOSINTItem(data) { const div = document.createElement('div'); let colorClass = 'border-gray-700'; let icon = 'info'; let textColor = 'text-gray-300'; // Enhanced color coding based on data type switch(data.type) { case 'ACTIVE_EXPLOIT': colorClass = 'border-red-500/70 bg-red-900/20'; icon = 'alert-octagon'; textColor = 'text-red-400'; break; case 'MALWARE': case 'MALWARE_SAMPLE': colorClass = 'border-red-600/50 bg-red-900/15'; icon = 'virus'; textColor = 'text-red-300'; break; case 'VULNERABILITY': colorClass = 'border-secondary/50 bg-secondary/5'; icon = 'alert-triangle'; textColor = data.severity >= 9.0 ? 'text-red-400' : data.severity >= 7.0 ? 'text-orange-400' : 'text-secondary'; break; case 'SYSTEM': colorClass = 'border-primary/50 bg-primary/5'; icon = 'server'; textColor = 'text-primary'; break; case 'NETWORK': colorClass = data.threatLevel === 'ELEVATED' ? 'border-yellow-500/50 bg-yellow-900/20' : 'border-cyan-500/50 bg-cyan-900/20'; icon = data.threatLevel === 'ELEVATED' ? 'shield-alert' : 'globe'; textColor = data.threatLevel === 'ELEVATED' ? 'text-yellow-400' : 'text-cyan-400'; break; case 'INTELLIGENCE': colorClass = 'border-blue-500/50 bg-blue-500/5'; icon = 'target'; textColor = 'text-blue-400'; break; case 'TOOL_DISCOVERY': colorClass = 'border-purple-500/50 bg-purple-900/20'; icon = 'package'; textColor = 'text-purple-400'; break; case 'FINANCIAL': colorClass = 'border-green-500/50 bg-green-900/20'; icon = 'dollar-sign'; textColor = 'text-green-400'; break; case 'GEOPHYSICAL': colorClass = 'border-amber-500/50 bg-amber-900/20'; icon = 'activity'; textColor = 'text-amber-400'; break; case 'SPACE_WEATHER': colorClass = 'border-indigo-500/50 bg-indigo-900/20'; icon = 'sun'; textColor = 'text-indigo-400'; break; default: colorClass = 'border-gray-700 bg-gray-800/50'; icon = 'info'; textColor = 'text-gray-400'; } div.className = `p-3 rounded border ${colorClass} text-sm animate-fade-in flex items-start gap-3 hover:bg-opacity-10 transition-all cursor-pointer`; const linkAttr = data.url ? `href="${data.url}" target="_blank" rel="noopener noreferrer"` : ''; const linkWrapper = data.url ? 'a' : 'div'; const sourceBadgeClass = { 'CISA': 'bg-red-900/60 text-red-300 border border-red-700/50', 'URLHAUS': 'bg-red-900/40 text-red-300 border border-red-800/50', 'MALWAREBAZAAR': 'bg-red-950/60 text-red-400 border border-red-900/50', 'NVD': 'bg-orange-900/40 text-orange-300 border border-orange-800/50', 'HN': 'bg-orange-600/20 text-orange-300 border border-orange-700/50', 'GH': 'bg-purple-900/40 text-purple-300 border border-purple-800/50', 'IPAPI': 'bg-cyan-900/40 text-cyan-300 border border-cyan-800/50', 'COINGECKO': 'bg-green-900/40 text-green-300 border border-green-800/50', 'USGS': 'bg-amber-900/40 text-amber-300 border border-amber-800/50', 'NOAA': 'bg-indigo-900/40 text-indigo-300 border border-indigo-800/50', 'LOCAL': 'bg-gray-700/50 text-gray-400 border border-gray-600/50' }[data.source] || 'bg-gray-700/50 text-gray-400 border border-gray-600/50'; div.innerHTML = ` <${linkWrapper} ${linkAttr} class="flex-1 flex items-start gap-3 text-decoration-none">
[${data.platform}] ${data.msg}
${repo.description?.substring(0, 45) || 'No description'}...
Unable to load Android security data
Rate limit may apply