| 1 | 'use client'; |
| 2 | |
| 3 | import { useState, useCallback, useEffect, memo } from 'react'; |
| 4 | import { motion, AnimatePresence } from 'framer-motion'; |
| 5 | import { |
| 6 | Search, Radar, Globe, Shield, FileText, Radio, |
| 7 | ChevronDown, ChevronUp, Loader2, AlertTriangle, Server, |
| 8 | Wifi, Lock, MapPin, Bug, Code, Layers, Network, Fingerprint, |
| 9 | CheckCircle, XCircle, Clock, ExternalLink, Crosshair, |
| 10 | Maximize2, Minimize2 |
| 11 | } from 'lucide-react'; |
| 12 | |
| 13 | const TABS = [ |
| 14 | { id: 'scanner', label: 'PORT SCAN', icon: Radar, placeholder: 'IP or hostname', color: '#00E5FF' }, |
| 15 | { id: 'vuln', label: 'VULN SWEEP', icon: Bug, placeholder: 'IP or hostname', color: '#FF3D3D' }, |
| 16 | |
| 17 | { id: 'dns', label: 'DNS', icon: Server, placeholder: 'Domain name', color: '#448AFF' }, |
| 18 | { id: 'whois', label: 'WHOIS', icon: FileText, placeholder: 'Domain name', color: '#FFD700' }, |
| 19 | { id: 'certs', label: 'CERTS', icon: Lock, placeholder: 'Domain name', color: '#E040FB' }, |
| 20 | { id: 'threats', label: 'THREATS', icon: AlertTriangle, placeholder: 'IP, domain, or hash', color: '#FF9500' }, |
| 21 | { id: 'headers', label: 'HEADERS', icon: Code, placeholder: 'URL to inspect', color: '#87CEEB' }, |
| 22 | { id: 'ssl', label: 'SSL/TLS', icon: Shield, placeholder: 'Domain name', color: '#76FF03' }, |
| 23 | { id: 'subdomains', label: 'SUBDOMAINS', icon: Layers, placeholder: 'Domain to enumerate', color: '#00BCD4' }, |
| 24 | { id: 'tech', label: 'TECH DETECT', icon: Fingerprint, placeholder: 'URL to fingerprint', color: '#9C27B0' }, |
| 25 | { id: 'sweep', label: 'IP SWEEP', icon: Crosshair, placeholder: 'Enter IP address (e.g. 8.8.8.8)', color: '#FF3D3D' }, |
| 26 | ]; |
| 27 | |
| 28 | interface OsintPanelProps { isOpen?: boolean; onClose?: () => void; isMobile?: boolean; onSweepVisualize?: (data: any) => void; onScanGeolocate?: (target: string, data: any) => void; } |
| 29 | |
| 30 | function OsintPanelInner({ isMobile, onSweepVisualize, onScanGeolocate }: OsintPanelProps) { |
| 31 | const [activeTab, setActiveTab] = useState('scanner'); |
| 32 | const [isFullScreen, setIsFullScreen] = useState(false); |
| 33 | const [query, setQuery] = useState(''); |
| 34 | const [results, setResults] = useState<any>(null); |
| 35 | const [loading, setLoading] = useState(false); |
| 36 | const [error, setError] = useState(''); |
| 37 | const [scanType, setScanType] = useState('quick'); |
| 38 | const [expanded, setExpanded] = useState(true); |
| 39 | const [history, setHistory] = useState<{tab:string;query:string;time:string}[]>([]); |
| 40 | const [sweepResult, setSweepResult] = useState<any>(null); |
| 41 | const [sweepProgress, setSweepProgress] = useState<{ current: number; total: number } | null>(null); |
| 42 | const [sweepCidr, setSweepCidr] = useState(24); |
| 43 | const [cveCache, setCveCache] = useState<Record<string, any>>({}); |
| 44 | const [expandedDevice, setExpandedDevice] = useState<string | null>(null); |
| 45 | |
| 46 | // Fetch CVE details when a device is expanded in full-screen mode |
| 47 | const fetchCveDetails = useCallback(async (cveIds: string[]) => { |
| 48 | const missing = cveIds.filter(id => !cveCache[id]); |
| 49 | if (missing.length === 0) return; |
| 50 | // Mark as loading |
| 51 | setCveCache(prev => { |
| 52 | const next = { ...prev }; |
| 53 | for (const id of missing) next[id] = { loading: true }; |
| 54 | return next; |
| 55 | }); |
| 56 | // Fetch in parallel |
| 57 | const results = await Promise.allSettled( |
| 58 | missing.map(id => fetch(`/api/osint/cve?cve=${encodeURIComponent(id)}`).then(r => r.json()).then(data => ({ id, data }))) |
| 59 | ); |
| 60 | setCveCache(prev => { |
| 61 | const next = { ...prev }; |
| 62 | for (const r of results) { |
| 63 | if (r.status === 'fulfilled') { |
| 64 | next[r.value.id] = r.value.data; |
| 65 | } |
| 66 | } |
| 67 | return next; |
| 68 | }); |
| 69 | }, [cveCache]); |
| 70 | |
| 71 | const runLookup = useCallback(async () => { |
| 72 | if (!query.trim() || loading) return; |
| 73 | setLoading(true); setError(''); setResults(null); |
| 74 | |
| 75 | // IP Sweep / Vuln Scan — separate flow |
| 76 | if (activeTab === 'sweep' || activeTab === 'vuln') { |
| 77 | setSweepResult(null); |
| 78 | setSweepProgress({ current: 0, total: Math.pow(2, 32 - sweepCidr) }); |
| 79 | try { |
| 80 | const cidr = sweepCidr; |
| 81 | const res = await fetch(`/api/osint/sweep?ip=${encodeURIComponent(query)}&cidr=${cidr}`); |
| 82 | if (!res.ok) { const e = await res.json().catch(() => ({})); throw new Error(e.error || `Sweep failed (${res.status})`); } |
| 83 | const data = await res.json(); |
| 84 | setSweepResult(data); |
| 85 | setSweepProgress(null); |
| 86 | setHistory(prev => [{ tab: activeTab, query, time: new Date().toLocaleTimeString() }, ...prev.slice(0, 9)]); |
| 87 | } catch (err: any) { |
| 88 | setError(err.message); |
| 89 | setSweepProgress(null); |
| 90 | } finally { |
| 91 | setLoading(false); |
| 92 | } |
| 93 | return; |
| 94 | } |
| 95 | |
| 96 | try { |
| 97 | let url = ''; |
| 98 | switch (activeTab) { |
| 99 | |
| 100 | case 'dns': url = `/api/osint/dns?domain=${encodeURIComponent(query)}`; break; |
| 101 | case 'certs': url = `/api/osint/certs?domain=${encodeURIComponent(query)}`; break; |
| 102 | case 'whois': url = `/api/osint/whois?domain=${encodeURIComponent(query)}`; break; |
| 103 | case 'threats': url = `/api/osint/threats?query=${encodeURIComponent(query)}`; break; |
| 104 | case 'scanner': url = `/api/scanner?target=${encodeURIComponent(query)}&type=${scanType}`; break; |
| 105 | case 'headers': url = `/api/scanner?target=${encodeURIComponent(query)}&type=headers`; break; |
| 106 | case 'ssl': url = `/api/scanner?target=${encodeURIComponent(query)}&type=ssl`; break; |
| 107 | case 'subdomains': url = `/api/scanner?target=${encodeURIComponent(query)}&type=subdomains`; break; |
| 108 | case 'tech': url = `/api/scanner?target=${encodeURIComponent(query)}&type=tech`; break; |
| 109 | } |
| 110 | const res = await fetch(url); |
| 111 | const data = await res.json(); |
| 112 | if (res.ok) { |
| 113 | setResults(data); |
| 114 | setHistory(prev => [{ tab: activeTab, query, time: new Date().toLocaleTimeString() }, ...prev.slice(0, 9)]); |
| 115 | |
| 116 | // Geolocate the target in the background |
| 117 | if (activeTab !== 'sweep' && activeTab !== 'vuln') { |
| 118 | fetch(`/api/osint/ip?ip=${encodeURIComponent(query)}`) |
| 119 | .then(r => r.json()) |
| 120 | .then(locData => { |
| 121 | if (locData && locData.geo && locData.geo.lat && locData.geo.lon && onScanGeolocate) { |
| 122 | // ip-api returns lat/lon, we pass it up |
| 123 | onScanGeolocate(query, { lat: locData.geo.lat, lng: locData.geo.lon, ...locData, type: activeTab }); |
| 124 | } |
| 125 | }) |
| 126 | .catch(() => {}); |
| 127 | } |
| 128 | } else { |
| 129 | setError(data.error || 'Lookup failed'); |
| 130 | } |
| 131 | } catch { setError('Network error'); } |
| 132 | finally { setLoading(false); } |
| 133 | }, [query, activeTab, scanType, loading, sweepCidr]); |
| 134 | |
| 135 | const currentTab = TABS.find(t => t.id === activeTab); |
| 136 | |
| 137 | // ── Shodan-style structured result renderers ── |
| 138 | |
| 139 | const ResultRow = ({ label, value, color, mono = true }: { label: string; value: any; color?: string; mono?: boolean }) => { |
| 140 | if (value === undefined || value === null || value === '') return null; |
| 141 | return ( |
| 142 | <div className="flex items-start gap-3 py-1.5 border-b border-[var(--border-secondary)]/20 last:border-0"> |
| 143 | <span className="text-[9px] font-mono text-[var(--text-muted)] uppercase tracking-wider w-[90px] flex-shrink-0 pt-0.5">{label}</span> |
| 144 | <span className={`text-[10px] ${mono ? 'font-mono' : ''} break-all flex-1`} style={{ color: color || 'var(--text-primary)' }}> |
| 145 | {String(value)} |
| 146 | </span> |
| 147 | </div> |
| 148 | ); |
| 149 | }; |
| 150 | |
| 151 | const StatusBadge = ({ ok, label }: { ok: boolean; label: string }) => ( |
| 152 | <span className={`inline-flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-mono font-bold ${ok ? 'bg-green-500/15 text-green-400 border border-green-500/30' : 'bg-red-500/15 text-red-400 border border-red-500/30'}`}> |
| 153 | {ok ? <CheckCircle className="w-2.5 h-2.5" /> : <XCircle className="w-2.5 h-2.5" />} |
| 154 | {label} |
| 155 | </span> |
| 156 | ); |
| 157 | |
| 158 | const SectionHeader = ({ title, icon: Icon, color }: { title: string; icon: any; color: string }) => ( |
| 159 | <div className="flex items-center gap-2 mt-3 mb-1.5 first:mt-0"> |
| 160 | <Icon className="w-3.5 h-3.5" style={{ color }} /> |
| 161 | <span className="text-[10px] font-mono font-bold tracking-widest" style={{ color }}>{title}</span> |
| 162 | <div className="flex-1 h-px" style={{ background: `${color}30` }} /> |
| 163 | </div> |
| 164 | ); |
| 165 | |
| 166 | const PortRow = ({ port, state, service, version }: { port: number; state: string; service?: string; version?: string }) => ( |
| 167 | <div className="flex items-center gap-2 py-1 px-2 rounded hover:bg-[var(--hover-accent)] transition-colors"> |
| 168 | <span className="text-[11px] font-mono font-bold text-[var(--cyan-primary)] w-[60px]">{port}</span> |
| 169 | <StatusBadge ok={state === 'open'} label={state.toUpperCase()} /> |
| 170 | <span className="text-[10px] font-mono text-[var(--text-secondary)] flex-1">{service || 'unknown'}</span> |
| 171 | {version && <span className="text-[9px] font-mono text-[var(--text-muted)]">{version}</span>} |
| 172 | </div> |
| 173 | ); |
| 174 | |
| 175 | const renderStructuredResults = () => { |
| 176 | if (!results) return null; |
| 177 | const r = results; |
| 178 | |
| 179 | // ── PORT SCAN ── |
| 180 | if (activeTab === 'scanner') { |
| 181 | const ports = r.ports || r.open_ports || r.results || []; |
| 182 | const host = r.host || r.target || query; |
| 183 | return ( |
| 184 | <div> |
| 185 | <SectionHeader title="HOST INFO" icon={Server} color="#00E5FF" /> |
| 186 | <ResultRow label="Target" value={host} color="#00E5FF" /> |
| 187 | <ResultRow label="Scan Type" value={r.scan_type || scanType} /> |
| 188 | <ResultRow label="Duration" value={r.duration || r.scan_time} /> |
| 189 | {Array.isArray(ports) && ports.length > 0 && ( |
| 190 | <> |
| 191 | <SectionHeader title={`OPEN PORTS (${ports.length})`} icon={Wifi} color="#00E676" /> |
| 192 | <div className="space-y-0.5"> |
| 193 | {ports.map((p: any, i: number) => ( |
| 194 | <PortRow key={i} port={p.port || p} state={p.state || 'open'} service={p.service || p.name} version={p.version} /> |
| 195 | ))} |
| 196 | </div> |
| 197 | </> |
| 198 | )} |
| 199 | {(!Array.isArray(ports) || ports.length === 0) && renderFallback()} |
| 200 | </div> |
| 201 | ); |
| 202 | } |
| 203 | |
| 204 | // ── VULN SCAN ── |
| 205 | if (activeTab === 'vuln') { |
| 206 | const vulns = r.vulnerabilities || r.vulns || r.cves || []; |
| 207 | const exploits = vulns.filter((v: any) => v.is_exploit); |
| 208 | const regularVulns = vulns.filter((v: any) => !v.is_exploit); |
| 209 | |
| 210 | return ( |
| 211 | <div> |
| 212 | <SectionHeader title="VULNERABILITY ASSESSMENT" icon={Bug} color="#FF3D3D" /> |
| 213 | <ResultRow label="Target" value={r.target || query} color="#FF3D3D" /> |
| 214 | <ResultRow label="Total CVEs" value={Array.isArray(vulns) ? vulns.length : 0} color={Array.isArray(vulns) && vulns.length > 0 ? '#FF3D3D' : '#00E676'} /> |
| 215 | <ResultRow label="Risk Level" value={r.risk_level || r.severity} /> |
| 216 | {Array.isArray(regularVulns) && regularVulns.length > 0 && ( |
| 217 | <div className="mt-2 space-y-1"> |
| 218 | {regularVulns.slice(0, 20).map((v: any, i: number) => ( |
| 219 | <div key={i} className="p-2 rounded-lg border border-red-500/20 bg-red-500/5 flex flex-col"> |
| 220 | <div className="flex items-center justify-between"> |
| 221 | <span className="text-[10px] font-mono font-bold text-red-400">{v.id || v.cve || v.name}</span> |
| 222 | {v.severity && <span className={`text-[8px] font-mono font-bold px-1.5 py-0.5 rounded ${v.severity === 'CRITICAL' ? 'bg-red-500/20 text-red-400' : v.severity === 'HIGH' ? 'bg-orange-500/20 text-orange-400' : 'bg-yellow-500/20 text-yellow-400'}`}>{v.severity}</span>} |
| 223 | </div> |
| 224 | {v.cvss && <div className="text-[9px] font-mono text-[var(--text-muted)] mt-1">CVSS: {v.cvss} ({v.type || 'cve'})</div>} |
| 225 | {v.description && <p className="text-[9px] font-mono text-[var(--text-muted)] mt-1 line-clamp-2">{v.description}</p>} |
| 226 | </div> |
| 227 | ))} |
| 228 | </div> |
| 229 | )} |
| 230 | |
| 231 | {exploits.length > 0 && ( |
| 232 | <div className="mt-4"> |
| 233 | <SectionHeader title={`POSSIBLE EXPLOITS (${exploits.length})`} icon={AlertTriangle} color="#FF9500" /> |
| 234 | <div className="mt-2 space-y-1"> |
| 235 | {exploits.slice(0, 10).map((e: any, i: number) => ( |
| 236 | <div key={i} className="p-2 rounded-lg border border-orange-500/30 bg-orange-500/10 flex flex-col"> |
| 237 | <div className="flex items-center justify-between"> |
| 238 | <span className="text-[10px] font-mono font-bold text-orange-400">{e.id}</span> |
| 239 | <span className="text-[8px] font-mono font-bold px-1.5 py-0.5 rounded bg-orange-500/20 text-orange-400">EXPLOIT</span> |
| 240 | </div> |
| 241 | <div className="text-[9px] font-mono text-[var(--text-muted)] mt-1 flex justify-between"> |
| 242 | <span>Source: {e.type?.toUpperCase() || 'UNKNOWN'}</span> |
| 243 | {e.cvss && <span>CVSS: {e.cvss}</span>} |
| 244 | </div> |
| 245 | </div> |
| 246 | ))} |
| 247 | </div> |
| 248 | </div> |
| 249 | )} |
| 250 | |
| 251 | {(!Array.isArray(vulns) || vulns.length === 0) && renderFallback()} |
| 252 | </div> |
| 253 | ); |
| 254 | } |
| 255 | |
| 256 | |
| 257 | |
| 258 | // ── DNS ── |
| 259 | if (activeTab === 'dns') { |
| 260 | return ( |
| 261 | <div> |
| 262 | <SectionHeader title="DNS RECORDS" icon={Server} color="#448AFF" /> |
| 263 | <ResultRow label="Domain" value={r.domain || query} color="#448AFF" /> |
| 264 | {r.A && <ResultRow label="A Records" value={Array.isArray(r.A) ? r.A.join(', ') : r.A} />} |
| 265 | {r.AAAA && <ResultRow label="AAAA" value={Array.isArray(r.AAAA) ? r.AAAA.join(', ') : r.AAAA} />} |
| 266 | {r.MX && <ResultRow label="MX" value={Array.isArray(r.MX) ? r.MX.map((m:any) => m.exchange || m).join(', ') : r.MX} />} |
| 267 | {r.NS && <ResultRow label="NS" value={Array.isArray(r.NS) ? r.NS.join(', ') : r.NS} />} |
| 268 | {r.TXT && <ResultRow label="TXT" value={Array.isArray(r.TXT) ? r.TXT.join(' | ') : r.TXT} />} |
| 269 | {r.CNAME && <ResultRow label="CNAME" value={Array.isArray(r.CNAME) ? r.CNAME.join(', ') : r.CNAME} />} |
| 270 | {r.SOA && <ResultRow label="SOA" value={typeof r.SOA === 'object' ? `${r.SOA.nsname} (${r.SOA.hostmaster})` : r.SOA} />} |
| 271 | {renderFallbackExcluding(['domain','A','AAAA','MX','NS','TXT','CNAME','SOA','timestamp','cached'])} |
| 272 | </div> |
| 273 | ); |
| 274 | } |
| 275 | |
| 276 | // ── WHOIS ── |
| 277 | if (activeTab === 'whois') { |
| 278 | return ( |
| 279 | <div> |
| 280 | <SectionHeader title="WHOIS INTELLIGENCE" icon={FileText} color="#FFD700" /> |
| 281 | <ResultRow label="Domain" value={r.domain_name || r.domainName || query} color="#FFD700" /> |
| 282 | <ResultRow label="Registrar" value={r.registrar} /> |
| 283 | <ResultRow label="Created" value={r.creation_date || r.createdDate} /> |
| 284 | <ResultRow label="Expires" value={r.expiration_date || r.expiresDate} /> |
| 285 | <ResultRow label="Updated" value={r.updated_date || r.updatedDate} /> |
| 286 | <ResultRow label="Status" value={Array.isArray(r.status) ? r.status.join(', ') : r.status} /> |
| 287 | <ResultRow label="Nameservers" value={Array.isArray(r.name_servers || r.nameServers) ? (r.name_servers || r.nameServers).join(', ') : r.name_servers} /> |
| 288 | {renderFallbackExcluding(['domain_name','domainName','registrar','creation_date','createdDate','expiration_date','expiresDate','updated_date','updatedDate','status','name_servers','nameServers','timestamp','cached','raw'])} |
| 289 | </div> |
| 290 | ); |
| 291 | } |
| 292 | |
| 293 | // ── CERTS ── |
| 294 | if (activeTab === 'certs') { |
| 295 | const certs = r.certificates || r.certs || (Array.isArray(r) ? r : []); |
| 296 | return ( |
| 297 | <div> |
| 298 | <SectionHeader title="CERTIFICATE TRANSPARENCY" icon={Lock} color="#E040FB" /> |
| 299 | <ResultRow label="Domain" value={query} color="#E040FB" /> |
| 300 | <ResultRow label="Certificates" value={Array.isArray(certs) ? certs.length : 0} /> |
| 301 | {Array.isArray(certs) && certs.slice(0, 15).map((c: any, i: number) => ( |
| 302 | <div key={i} className="mt-1.5 p-2 rounded border border-[var(--border-secondary)]/30 bg-[var(--bg-tertiary)]/30"> |
| 303 | <ResultRow label="Issuer" value={c.issuer_name || c.issuer} /> |
| 304 | <ResultRow label="Common Name" value={c.common_name || c.name_value} /> |
| 305 | <ResultRow label="Not Before" value={c.not_before} /> |
| 306 | <ResultRow label="Not After" value={c.not_after} /> |
| 307 | </div> |
| 308 | ))} |
| 309 | {(!Array.isArray(certs) || certs.length === 0) && renderFallback()} |
| 310 | </div> |
| 311 | ); |
| 312 | } |
| 313 | |
| 314 | // ── THREATS ── |
| 315 | if (activeTab === 'threats') { |
| 316 | return ( |
| 317 | <div> |
| 318 | <SectionHeader title="THREAT INTELLIGENCE" icon={AlertTriangle} color="#FF9500" /> |
| 319 | <ResultRow label="Query" value={query} color="#FF9500" /> |
| 320 | <ResultRow label="Risk Score" value={r.risk_score || r.score} color={ |
| 321 | (r.risk_score || r.score || 0) > 70 ? '#FF3D3D' : (r.risk_score || r.score || 0) > 40 ? '#FF9500' : '#00E676' |
| 322 | } /> |
| 323 | <ResultRow label="Malicious" value={r.malicious !== undefined ? (r.malicious ? 'YES' : 'NO') : undefined} color={r.malicious ? '#FF3D3D' : '#00E676'} /> |
| 324 | <ResultRow label="Category" value={r.category || r.type} /> |
| 325 | <ResultRow label="Reports" value={r.total_reports || r.reports} /> |
| 326 | <ResultRow label="Last Seen" value={r.last_seen || r.last_analysis} /> |
| 327 | {r.tags && <ResultRow label="Tags" value={Array.isArray(r.tags) ? r.tags.join(', ') : r.tags} />} |
| 328 | {renderFallbackExcluding(['risk_score','score','malicious','category','type','total_reports','reports','last_seen','last_analysis','tags','timestamp','cached','query'])} |
| 329 | </div> |
| 330 | ); |
| 331 | } |
| 332 | |
| 333 | // ── SSL ── |
| 334 | if (activeTab === 'ssl') { |
| 335 | return ( |
| 336 | <div> |
| 337 | <SectionHeader title="SSL/TLS ANALYSIS" icon={Shield} color="#76FF03" /> |
| 338 | <ResultRow label="Target" value={query} color="#76FF03" /> |
| 339 | <ResultRow label="Protocol" value={r.protocol || r.tls_version} /> |
| 340 | <ResultRow label="Cipher" value={r.cipher || r.cipher_suite} /> |
| 341 | <ResultRow label="Valid" value={r.valid !== undefined ? (r.valid ? 'YES' : 'NO') : undefined} color={r.valid ? '#00E676' : '#FF3D3D'} /> |
| 342 | <ResultRow label="Issuer" value={r.issuer} /> |
| 343 | <ResultRow label="Subject" value={r.subject} /> |
| 344 | <ResultRow label="Expires" value={r.expires || r.not_after} /> |
| 345 | <ResultRow label="SANs" value={Array.isArray(r.sans) ? r.sans.join(', ') : r.sans} /> |
| 346 | {renderFallback()} |
| 347 | </div> |
| 348 | ); |
| 349 | } |
| 350 | |
| 351 | // Fallback for other tools |
| 352 | return renderFallback(); |
| 353 | }; |
| 354 | |
| 355 | const renderFallback = () => { |
| 356 | if (!results) return null; |
| 357 | return ( |
| 358 | <div className="space-y-1"> |
| 359 | {Object.entries(results).filter(([k]) => !['timestamp','cached'].includes(k)).map(([key, value]) => ( |
| 360 | <ResultRow key={key} label={key.replace(/_/g, ' ')} value={typeof value === 'object' ? JSON.stringify(value, null, 1) : String(value)} /> |
| 361 | ))} |
| 362 | </div> |
| 363 | ); |
| 364 | }; |
| 365 | |
| 366 | const renderFallbackExcluding = (exclude: string[]) => { |
| 367 | if (!results) return null; |
| 368 | const extra = Object.entries(results).filter(([k]) => !exclude.includes(k)); |
| 369 | if (extra.length === 0) return null; |
| 370 | return ( |
| 371 | <div className="mt-2 space-y-1"> |
| 372 | {extra.map(([key, value]) => ( |
| 373 | <ResultRow key={key} label={key.replace(/_/g, ' ')} value={typeof value === 'object' ? JSON.stringify(value, null, 1) : String(value)} /> |
| 374 | ))} |
| 375 | </div> |
| 376 | ); |
| 377 | }; |
| 378 | |
| 379 | const renderContent = () => ( |
| 380 | <div className="flex flex-col gap-2.5"> |
| 381 | {/* Tool Grid */} |
| 382 | <div className="flex flex-col gap-1"> |
| 383 | {/* Sweep - Main Action */} |
| 384 | {TABS.filter(t => t.id === 'sweep').map(tab => ( |
| 385 | <button key={tab.id} onClick={() => { setActiveTab(tab.id); setQuery(''); setResults(null); setError(''); }} |
| 386 | className={`flex items-center justify-center gap-2 px-3 py-3 rounded-lg text-[12px] font-mono tracking-widest font-bold transition-all border ${activeTab === tab.id ? 'border-opacity-60 bg-opacity-20' : 'border-[var(--border-secondary)] hover:bg-[var(--hover-accent)]'}`} |
| 387 | style={{ |
| 388 | borderColor: activeTab === tab.id ? tab.color : 'rgba(255,61,61,0.3)', |
| 389 | backgroundColor: activeTab === tab.id ? `${tab.color}20` : 'rgba(255,61,61,0.05)', |
| 390 | color: activeTab === tab.id ? tab.color : tab.color, |
| 391 | boxShadow: activeTab === tab.id ? `0 0 15px ${tab.color}30` : 'none' |
| 392 | }}> |
| 393 | <tab.icon className="w-5 h-5" /> |
| 394 | <span>GLOBAL {tab.label}</span> |
| 395 | </button> |
| 396 | ))} |
| 397 | {/* Other Tools */} |
| 398 | <div className="grid grid-cols-5 gap-1 mt-1"> |
| 399 | {TABS.filter(t => t.id !== 'sweep').map(tab => ( |
| 400 | <button key={tab.id} onClick={() => { setActiveTab(tab.id); setQuery(''); setResults(null); setError(''); }} |
| 401 | className={`flex flex-col items-center gap-1 px-1 py-2 rounded-lg text-[8px] font-mono tracking-wider transition-all border ${activeTab === tab.id ? 'border-opacity-40 bg-opacity-15' : 'border-transparent hover:bg-[var(--hover-accent)]'}`} |
| 402 | style={{ borderColor: activeTab === tab.id ? tab.color : 'transparent', backgroundColor: activeTab === tab.id ? `${tab.color}15` : undefined, color: activeTab === tab.id ? tab.color : 'var(--text-muted)' }}> |
| 403 | <tab.icon className="w-3.5 h-3.5" /> |
| 404 | <span className="leading-none text-center truncate w-full">{tab.label}</span> |
| 405 | </button> |
| 406 | ))} |
| 407 | </div> |
| 408 | </div> |
| 409 | |
| 410 | {/* Input Area */} |
| 411 | <div className="flex flex-col gap-1.5"> |
| 412 | <div className="flex gap-1.5"> |
| 413 | <div className="flex-1 relative"> |
| 414 | <Search className="absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-[var(--text-muted)]" /> |
| 415 | <input type="text" value={query} onChange={e => setQuery(e.target.value)} onKeyDown={e => e.key === 'Enter' && runLookup()} |
| 416 | placeholder={currentTab?.placeholder} |
| 417 | className="w-full bg-[var(--bg-primary)]/60 border border-[var(--border-primary)] rounded-lg pl-8 pr-3 py-2.5 text-[11px] font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)]/40 focus:outline-none transition-colors" |
| 418 | style={{ borderColor: query ? `${currentTab?.color}40` : undefined }} /> |
| 419 | </div> |
| 420 | <button onClick={runLookup} disabled={loading || !query.trim()} |
| 421 | className="px-4 py-2 rounded-lg text-[10px] font-mono font-bold tracking-wider disabled:opacity-30 transition-all flex items-center justify-center min-w-[70px]" |
| 422 | style={{ backgroundColor: `${currentTab?.color}20`, border: `1px solid ${currentTab?.color}40`, color: currentTab?.color }}> |
| 423 | {loading ? <Loader2 className="w-3.5 h-3.5 animate-spin" /> : 'SCAN'} |
| 424 | </button> |
| 425 | </div> |
| 426 | |
| 427 | {/* Secondary Controls */} |
| 428 | {activeTab === 'scanner' && ( |
| 429 | <select value={scanType} onChange={e => setScanType(e.target.value)} |
| 430 | className="bg-[var(--bg-primary)]/60 border border-[var(--border-primary)] rounded-lg px-2 py-1.5 text-[10px] font-mono text-[var(--text-muted)] outline-none w-full"> |
| 431 | <option value="quick">QUICK SCAN</option><option value="deep">DEEP SCAN</option><option value="ports">TOP 1000 PORTS</option> |
| 432 | </select> |
| 433 | )} |
| 434 | {(activeTab === 'sweep' || activeTab === 'vuln') && ( |
| 435 | <div className="flex items-center justify-between bg-[var(--bg-primary)]/60 border border-[var(--border-primary)] rounded-lg p-1"> |
| 436 | <span className="text-[9px] font-mono text-[var(--text-muted)] pl-2">SUBNET MASK:</span> |
| 437 | <div className="flex items-center gap-0.5"> |
| 438 | {[24, 25, 26, 27, 28].map(c => ( |
| 439 | <button key={c} onClick={() => setSweepCidr(c)} |
| 440 | className={`px-2 py-1 text-[10px] font-mono rounded transition-all ${ |
| 441 | sweepCidr === c ? 'bg-[#FF3D3D]/20 text-[#FF3D3D]' : 'text-[var(--text-muted)] hover:bg-[var(--bg-tertiary)]' |
| 442 | }`} |
| 443 | >/{c}</button> |
| 444 | ))} |
| 445 | </div> |
| 446 | </div> |
| 447 | )} |
| 448 | </div> |
| 449 | |
| 450 | {error && ( |
| 451 | <div className="p-2.5 rounded-lg border border-red-500/30 bg-red-500/10 text-[11px] font-mono text-red-400 flex items-center gap-2"> |
| 452 | <AlertTriangle className="w-3.5 h-3.5 flex-shrink-0" />{error} |
| 453 | </div> |
| 454 | )} |
| 455 | |
| 456 | {/* Sweep Progress */} |
| 457 | {sweepProgress && loading && ( |
| 458 | <div className="p-3 rounded-lg border border-[#FF3D3D]/30 bg-[#FF3D3D]/5"> |
| 459 | <div className="flex items-center justify-between mb-2"> |
| 460 | <span className="text-[10px] font-mono tracking-wider text-[#FF3D3D]">SWEEPING SUBNET...</span> |
| 461 | <span className="text-[10px] font-mono text-[#E8E6E0]">{sweepProgress.total} hosts</span> |
| 462 | </div> |
| 463 | <div className="w-full h-1.5 bg-[#1A1A18] rounded-full overflow-hidden"> |
| 464 | <div className="h-full rounded-full" style={{ width: '100%', background: 'linear-gradient(90deg, #FF3D3D, #FF6B00, #FFD700)', animation: 'sweep-pulse 1.5s ease-in-out infinite' }} /> |
| 465 | </div> |
| 466 | </div> |
| 467 | )} |
| 468 | |
| 469 | {/* Sweep Results */} |
| 470 | {sweepResult && !loading && ( |
| 471 | <div className="bg-[var(--bg-primary)]/40 border border-[var(--border-primary)] rounded-lg overflow-hidden max-h-[55vh] overflow-y-auto styled-scrollbar"> |
| 472 | {/* Summary */} |
| 473 | <div className="p-3 border-b border-[#2A2A28]"> |
| 474 | <div className="flex items-center justify-between mb-3"> |
| 475 | <div> |
| 476 | <div className="text-[11px] font-mono tracking-wider text-[#E8E6E0]">{sweepResult.subnet}</div> |
| 477 | <div className="text-[9px] font-mono text-[#5C5A54]">{sweepResult.center.city}, {sweepResult.center.country} · {sweepResult.center.isp}</div> |
| 478 | </div> |
| 479 | <div className="text-right"> |
| 480 | <div className="text-[18px] font-mono font-bold text-[#FF3D3D]">{sweepResult.summary.total_responsive}</div> |
| 481 | <div className="text-[8px] font-mono text-[#5C5A54] tracking-wider">DEVICES FOUND</div> |
| 482 | </div> |
| 483 | </div> |
| 484 | {/* Breakdown Bar */} |
| 485 | <div className="flex h-2 rounded-full overflow-hidden bg-[#1A1A18] mb-2"> |
| 486 | {Object.entries(sweepResult.summary.device_breakdown).map(([type, count]: [string, any]) => { |
| 487 | const device = sweepResult.devices.find((d: any) => d.device_type === type); |
| 488 | return <div key={type} style={{ width: `${(count / sweepResult.summary.total_responsive) * 100}%`, backgroundColor: device?.device_color || '#666' }} title={`${type}: ${count}`} />; |
| 489 | })} |
| 490 | </div> |
| 491 | <div className="flex flex-wrap gap-x-3 gap-y-1"> |
| 492 | {Object.entries(sweepResult.summary.device_breakdown).map(([type, count]: [string, any]) => { |
| 493 | const device = sweepResult.devices.find((d: any) => d.device_type === type); |
| 494 | return ( |
| 495 | <div key={type} className="flex items-center gap-1"> |
| 496 | <div className="w-2 h-2 rounded-full" style={{ backgroundColor: device?.device_color || '#666' }} /> |
| 497 | <span className="text-[9px] font-mono text-[#8A8880]">{type}</span> |
| 498 | <span className="text-[9px] font-mono text-[#E8E6E0] font-bold">{String(count)}</span> |
| 499 | </div> |
| 500 | ); |
| 501 | })} |
| 502 | </div> |
| 503 | </div> |
| 504 | {/* Visualize Button */} |
| 505 | <div className="p-3 border-b border-[#2A2A28]"> |
| 506 | <button onClick={() => onSweepVisualize?.(sweepResult)} |
| 507 | className="w-full py-2.5 rounded-lg font-mono text-[11px] tracking-wider font-bold transition-all hover:scale-[1.02] active:scale-[0.98] flex items-center justify-center gap-2" |
| 508 | style={{ background: 'linear-gradient(135deg, rgba(255,61,61,0.2), rgba(255,107,0,0.2))', border: '1px solid rgba(255,61,61,0.5)', color: '#FF3D3D', textShadow: '0 0 10px rgba(255,61,61,0.5)' }} |
| 509 | > |
| 510 | <Globe className="w-4 h-4" /> VISUALIZE ON GLOBE |
| 511 | </button> |
| 512 | </div> |
| 513 | {/* Device List */} |
| 514 | <div className={isFullScreen ? "flex flex-col gap-3 p-4" : "divide-y divide-[#2A2A28]"}> |
| 515 | {sweepResult.devices.map((device: any) => { |
| 516 | const isExpanded = expandedDevice === device.ip; |
| 517 | return ( |
| 518 | <div key={device.ip} className={isFullScreen |
| 519 | ? "bg-[#0D0D0C] border border-[#2A2A28] rounded-lg overflow-hidden hover:border-[#3A3A38] transition-colors" |
| 520 | : "px-3 py-2.5 hover:bg-[rgba(255,255,255,0.02)] transition-colors" |
| 521 | }> |
| 522 | {/* Device Header */} |
| 523 | <div |
| 524 | className={isFullScreen |
| 525 | ? "flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-[#151514] transition-colors" |
| 526 | : "flex items-center justify-between mb-1" |
| 527 | } |
| 528 | onClick={() => { |
| 529 | if (!isFullScreen) return; |
| 530 | const next = isExpanded ? null : device.ip; |
| 531 | setExpandedDevice(next); |
| 532 | if (next && device.vulns.length > 0) fetchCveDetails(device.vulns); |
| 533 | }} |
| 534 | > |
| 535 | <div className="flex items-center gap-3"> |
| 536 | <div className="w-2.5 h-2.5 rounded-full flex-shrink-0" style={{ backgroundColor: device.device_color }} /> |
| 537 | <span className={isFullScreen ? "text-[14px] font-mono font-bold text-[#E8E6E0]" : "text-[11px] font-mono text-[#E8E6E0]"}>{device.ip}</span> |
| 538 | {device.hostnames.length > 0 && ( |
| 539 | <span className={`${isFullScreen ? "text-[11px]" : "text-[9px]"} font-mono text-[#5C5A54]`}>{device.hostnames[0]}</span> |
| 540 | )} |
| 541 | </div> |
| 542 | <div className="flex items-center gap-2"> |
| 543 | {device.vulns.length > 0 && ( |
| 544 | <span className={`${isFullScreen ? "text-[10px]" : "text-[8px]"} font-mono px-1.5 py-0.5 rounded bg-red-500/15 text-red-400 border border-red-500/30`}> |
| 545 | {device.vulns.length} CVEs |
| 546 | </span> |
| 547 | )} |
| 548 | <span className={`${isFullScreen ? "text-[10px]" : "text-[8px]"} font-mono px-1.5 py-0.5 rounded`} style={{ backgroundColor: device.device_color + '20', color: device.device_color, border: `1px solid ${device.device_color}40` }}>{device.device_type}</span> |
| 549 | {isFullScreen && ( |
| 550 | <ChevronDown className={`w-4 h-4 text-[#5C5A54] transition-transform ${isExpanded ? 'rotate-180' : ''}`} /> |
| 551 | )} |
| 552 | </div> |
| 553 | </div> |
| 554 | |
| 555 | {/* Compact info (sidebar mode) */} |
| 556 | {!isFullScreen && ( |
| 557 | <> |
| 558 | <div className="flex items-center gap-2 text-[9px] font-mono text-[#5C5A54]"> |
| 559 | <span>Ports: {device.ports.slice(0, 8).join(', ')}{device.ports.length > 8 ? ` +${device.ports.length - 8}` : ''}</span> |
| 560 | {device.vulns.length > 0 && ( |
| 561 | <div className="group relative flex items-center gap-1 cursor-help"> |
| 562 | <span className="text-[#FF3D3D] flex items-center gap-1"> |
| 563 | <AlertTriangle className="w-2.5 h-2.5" /> {device.vulns.length} CVEs |
| 564 | </span> |
| 565 | <div className="absolute bottom-full left-0 mb-1 hidden group-hover:block z-50 p-2 bg-[#1A1A18] border border-[#FF3D3D50] rounded-md shadow-xl min-w-[140px] max-w-[220px] max-h-[150px] overflow-y-auto styled-scrollbar"> |
| 566 | <div className="text-[8px] font-mono text-[#FF3D3D] mb-1 tracking-wider uppercase border-b border-[#FF3D3D30] pb-1">Identified Vulnerabilities</div> |
| 567 | <div className="flex flex-col gap-0.5"> |
| 568 | {device.vulns.map((cve: string) => ( |
| 569 | <a key={cve} href={`https://nvd.nist.gov/vuln/detail/${cve}`} target="_blank" rel="noreferrer" className="text-[9px] font-mono text-[#E8E6E0] hover:text-[#FF3D3D] transition-colors truncate"> |
| 570 | {cve} |
| 571 | </a> |
| 572 | ))} |
| 573 | </div> |
| 574 | </div> |
| 575 | </div> |
| 576 | )} |
| 577 | </div> |
| 578 | {device.hostnames.length > 0 && <div className="text-[9px] font-mono text-[#8A8880] mt-0.5 truncate">{device.hostnames[0]}</div>} |
| 579 | </> |
| 580 | )} |
| 581 | |
| 582 | {/* Full-Screen Expanded Detail */} |
| 583 | {isFullScreen && isExpanded && ( |
| 584 | <div className="border-t border-[#2A2A28]"> |
| 585 | {/* Ports + Hostnames Row */} |
| 586 | <div className="grid grid-cols-1 md:grid-cols-2 gap-px bg-[#2A2A28]"> |
| 587 | <div className="bg-[#0D0D0C] p-4"> |
| 588 | <div className="text-[10px] font-mono text-[#5C5A54] tracking-widest uppercase mb-2">Open Ports</div> |
| 589 | <div className="flex flex-wrap gap-1.5"> |
| 590 | {device.ports.map((port: number) => ( |
| 591 | <span key={port} className="px-2 py-1 bg-[#1A1A18] border border-[#2A2A28] rounded text-[11px] font-mono text-[var(--cyan-primary)]">{port}</span> |
| 592 | ))} |
| 593 | </div> |
| 594 | </div> |
| 595 | <div className="bg-[#0D0D0C] p-4"> |
| 596 | <div className="text-[10px] font-mono text-[#5C5A54] tracking-widest uppercase mb-2">Hostnames</div> |
| 597 | {device.hostnames.length > 0 ? ( |
| 598 | <div className="flex flex-col gap-1"> |
| 599 | {device.hostnames.map((h: string) => ( |
| 600 | <span key={h} className="text-[11px] font-mono text-[#E8E6E0]">{h}</span> |
| 601 | ))} |
| 602 | </div> |
| 603 | ) : ( |
| 604 | <span className="text-[11px] font-mono text-[#3A3A38]">No reverse DNS</span> |
| 605 | )} |
| 606 | </div> |
| 607 | </div> |
| 608 | |
| 609 | {/* CVE Intelligence */} |
| 610 | {device.vulns.length > 0 && ( |
| 611 | <div className="p-4 border-t border-[#2A2A28]"> |
| 612 | <div className="text-[10px] font-mono text-[#5C5A54] tracking-widest uppercase mb-3">Vulnerabilities ({device.vulns.length})</div> |
| 613 | <div className="flex flex-col gap-2"> |
| 614 | {device.vulns.map((cveId: string) => { |
| 615 | const info = cveCache[cveId]; |
| 616 | const isLoading = !info || info.loading; |
| 617 | const severityColor = !info?.severity ? '#5C5A54' |
| 618 | : info.severity === 'CRITICAL' ? '#FF3D3D' |
| 619 | : info.severity === 'HIGH' ? '#FF6B00' |
| 620 | : info.severity === 'MEDIUM' ? '#FFD700' |
| 621 | : '#76FF03'; |
| 622 | return ( |
| 623 | <div key={cveId} className="bg-[#111] border border-[#2A2A28] rounded-lg p-3"> |
| 624 | <div className="flex items-center justify-between mb-2"> |
| 625 | <div className="flex items-center gap-2"> |
| 626 | <span className="text-[12px] font-mono font-bold text-[#E8E6E0]">{cveId}</span> |
| 627 | {info?.cvss != null && ( |
| 628 | <span className="text-[10px] font-mono px-1.5 py-0.5 rounded" style={{ backgroundColor: severityColor + '15', color: severityColor, border: `1px solid ${severityColor}40` }}>CVSS {info.cvss}</span> |
| 629 | )} |
| 630 | </div> |
| 631 | <div className="flex items-center gap-2"> |
| 632 | {info?.severity && ( |
| 633 | <span className="text-[9px] font-mono font-bold px-2 py-0.5 rounded" style={{ backgroundColor: severityColor + '15', color: severityColor, border: `1px solid ${severityColor}40` }}>{info.severity}</span> |
| 634 | )} |
| 635 | <a href={`https://nvd.nist.gov/vuln/detail/${cveId}`} target="_blank" rel="noreferrer" className="text-[#5C5A54] hover:text-[#E8E6E0] transition-colors"> |
| 636 | <ExternalLink className="w-3.5 h-3.5" /> |
| 637 | </a> |
| 638 | </div> |
| 639 | </div> |
| 640 | {isLoading ? ( |
| 641 | <div className="flex items-center gap-2 py-1"> |
| 642 | <Loader2 className="w-3 h-3 animate-spin text-[#5C5A54]" /> |
| 643 | <span className="text-[10px] font-mono text-[#5C5A54]">Fetching vulnerability intelligence...</span> |
| 644 | </div> |
| 645 | ) : ( |
| 646 | <> |
| 647 | <p className="text-[11px] font-mono text-[#8A8880] leading-relaxed">{info.description}</p> |
| 648 | {info.cwe && <div className="text-[10px] font-mono text-[#5C5A54] mt-2">Weakness: {info.cwe}</div>} |
| 649 | {info.affected && info.affected.length > 0 && ( |
| 650 | <div className="mt-2 flex flex-wrap gap-1.5"> |
| 651 | {info.affected.map((a: any, i: number) => ( |
| 652 | <span key={i} className="text-[9px] font-mono px-1.5 py-0.5 bg-[#1A1A18] border border-[#2A2A28] rounded text-[#8A8880]"> |
| 653 | {a.vendor}/{a.product} |
| 654 | </span> |
| 655 | ))} |
| 656 | </div> |
| 657 | )} |
| 658 | </> |
| 659 | )} |
| 660 | </div> |
| 661 | ); |
| 662 | })} |
| 663 | </div> |
| 664 | </div> |
| 665 | )} |
| 666 | </div> |
| 667 | )} |
| 668 | </div> |
| 669 | ); |
| 670 | })} |
| 671 | </div> |
| 672 | <div className="px-3 py-2 border-t border-[#2A2A28]"> |
| 673 | <div className="text-[8px] font-mono text-[#5C5A54] tracking-wider">SWEPT {sweepResult.summary.total_hosts} HOSTS IN {(sweepResult.sweep_time_ms / 1000).toFixed(1)}s · ASN {sweepResult.center.asn}</div> |
| 674 | </div> |
| 675 | </div> |
| 676 | )} |
| 677 | |
| 678 | {results && !(sweepResult && !loading) && ( |
| 679 | <div className="bg-[var(--bg-primary)]/40 border border-[var(--border-primary)] rounded-lg p-3 max-h-[50vh] overflow-y-auto styled-scrollbar"> |
| 680 | <div className="flex items-center justify-between mb-2"> |
| 681 | <span className="text-[9px] font-mono tracking-widest" style={{ color: currentTab?.color }}>{currentTab?.label} RESULTS</span> |
| 682 | <span className="text-[8px] font-mono text-[var(--text-muted)] flex items-center gap-1"><Clock className="w-2.5 h-2.5" />{new Date().toLocaleTimeString()}</span> |
| 683 | </div> |
| 684 | {renderStructuredResults()} |
| 685 | </div> |
| 686 | )} |
| 687 | |
| 688 | {history.length > 0 && !results && ( |
| 689 | <div className="space-y-1"> |
| 690 | <span className="text-[9px] font-mono tracking-widest text-[var(--text-muted)]">RECENT SCANS</span> |
| 691 | {history.slice(0, 5).map((h, i) => ( |
| 692 | <button key={i} onClick={() => { setActiveTab(h.tab); setQuery(h.query); }} |
| 693 | className="w-full flex items-center justify-between px-2.5 py-1.5 rounded-lg hover:bg-[var(--hover-accent)] transition-colors text-left"> |
| 694 | <div className="flex items-center gap-2"> |
| 695 | <span className="text-[9px] font-mono" style={{ color: TABS.find(t => t.id === h.tab)?.color }}>{TABS.find(t => t.id === h.tab)?.label}</span> |
| 696 | <span className="text-[10px] font-mono text-[var(--text-secondary)]">{h.query}</span> |
| 697 | </div> |
| 698 | <span className="text-[8px] font-mono text-[var(--text-muted)]">{h.time}</span> |
| 699 | </button> |
| 700 | ))} |
| 701 | </div> |
| 702 | )} |
| 703 | </div> |
| 704 | ); |
| 705 | |
| 706 | if (isMobile) return renderContent(); |
| 707 | |
| 708 | if (isFullScreen) { |
| 709 | return ( |
| 710 | <div className="fixed inset-4 z-[999] glass-panel bg-[#0a0a09]/95 backdrop-blur-2xl border border-[var(--cyan-primary)]/40 rounded-xl flex flex-col overflow-hidden shadow-2xl shadow-[var(--cyan-primary)]/20"> |
| 711 | <div className="flex items-center justify-between px-6 py-4 border-b border-[var(--border-secondary)] bg-[#111]"> |
| 712 | <div className="flex items-center gap-3"> |
| 713 | <Radar className="w-5 h-5 text-[var(--cyan-primary)]" /> |
| 714 | <span className="hud-text text-[16px] text-[var(--text-primary)]">OSIRIS RECON TOOLKIT</span> |
| 715 | <span className="gotham-tag gotham-tag--info" style={{ fontSize: '9px' }}>FULL SCREEN</span> |
| 716 | <span className="gotham-tag gotham-tag--classified" style={{ fontSize: '8px' }}>{TABS.length} MODULES</span> |
| 717 | </div> |
| 718 | <button onClick={() => setIsFullScreen(false)} className="p-2 hover:bg-white/5 rounded transition-colors text-[var(--text-muted)] hover:text-white"> |
| 719 | <Minimize2 className="w-5 h-5" /> |
| 720 | </button> |
| 721 | </div> |
| 722 | <div className="flex-1 overflow-y-auto p-6 styled-scrollbar"> |
| 723 | {/* We wrap renderContent in a container that forces wider layouts if we want to target it with CSS */} |
| 724 | <div className="max-w-[1400px] mx-auto w-full full-screen-mode-content"> |
| 725 | {renderContent()} |
| 726 | </div> |
| 727 | </div> |
| 728 | </div> |
| 729 | ); |
| 730 | } |
| 731 | |
| 732 | return ( |
| 733 | <motion.div initial={{ opacity: 0, x: 20 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: 0.3, duration: 0.6 }} className="glass-panel flex flex-col overflow-hidden pointer-events-auto"> |
| 734 | <div className="flex items-center justify-between px-4 py-3 border-b border-transparent hover:bg-[var(--hover-accent)] transition-colors"> |
| 735 | <button onClick={() => setExpanded(!expanded)} className="flex items-center gap-2 flex-1"> |
| 736 | <Radar className="w-3.5 h-3.5 text-[var(--cyan-primary)]" /> |
| 737 | <span className="hud-text text-[12px] text-[var(--text-primary)]">RECON TOOLKIT</span> |
| 738 | <span className="gotham-tag gotham-tag--info" style={{ fontSize: '7px', padding: '1px 5px' }}>{TABS.length} TOOLS</span> |
| 739 | </button> |
| 740 | <div className="flex items-center gap-3"> |
| 741 | <button onClick={() => setIsFullScreen(true)} className="text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors" title="Full Screen"> |
| 742 | <Maximize2 className="w-3.5 h-3.5" /> |
| 743 | </button> |
| 744 | <div className="w-1.5 h-1.5 rounded-full bg-[var(--cyan-primary)] animate-osiris-pulse" /> |
| 745 | <button onClick={() => setExpanded(!expanded)}> |
| 746 | {expanded ? <ChevronUp className="w-3.5 h-3.5 text-[var(--text-muted)]" /> : <ChevronDown className="w-3.5 h-3.5 text-[var(--text-muted)]" />} |
| 747 | </button> |
| 748 | </div> |
| 749 | </div> |
| 750 | <AnimatePresence> |
| 751 | {expanded && ( |
| 752 | <motion.div initial={{ height: 0, opacity: 0 }} animate={{ height: 'auto', opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={{ duration: 0.2 }} className="overflow-hidden px-3 pb-3"> |
| 753 | {renderContent()} |
| 754 | </motion.div> |
| 755 | )} |
| 756 | </AnimatePresence> |
| 757 | </motion.div> |
| 758 | ); |
| 759 | } |
| 760 | |
| 761 | const OsintPanel = memo(OsintPanelInner); |
| 762 | export default OsintPanel; |