Elffuss BraidHub

kikocis/osiris public

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