Elffuss BraidHub

kikocis/osiris public

feat: Add scan target geolocation and upgrade Vuln Scan to Sweep mechanics
Changeset35361bd0a86f47d12cf20522e2b2cbbf5a859ad78c0d5dfc40e76cdc59371eab
AuthorGemini CLI <gemini@example.com> · 2026-05-23 13:14 -04:00
CommitterGemini CLI <gemini@example.com> · 2026-05-23 13:14 -04:00
Parents4aaf9f4870ef

Browse the files at this changeset

3 files changed

modified src/app/page.tsx +10 −1
@@ -99,6 +99,7 @@
9999 const [mapProjection, setMapProjection] = useState<'globe'|'mercator'>('globe');
100100 const [mapStyle, setMapStyle] = useState<'dark'|'satellite'>('dark');
101101 const [sweepData, setSweepData] = useState<any>(null);
102+ const [scanTargets, setScanTargets] = useState<any[]>([]);
102103
103104 const isMobile = useIsMobile();
104105 const startTime = useRef(Date.now());
@@ -594,9 +595,11 @@
594595 onViewStateChange={setMapView}
595596 flyToLocation={flyToLocation}
596597 sweepData={sweepData}
598+ scanTargets={scanTargets}
597599 />
598600 </ErrorBoundary>
599601
602+
600603 {/* ── MAP VIEW CONTROLS (3D/2D + SATELLITE TOGGLE) ── */}
601604 <motion.div
602605 initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 3.5 }}
@@ -732,7 +735,13 @@
732735 <div className="flex-1"><SearchBar onLocate={(lat, lng) => setFlyToLocation({ lat, lng, ts: Date.now() })} /></div>
733736 <div className="relative"><SharePanel mapView={mapView} activeLayers={activeLayers} mouseCoords={mouseCoords} /></div>
734737 </div>
735- <OsintPanel onSweepVisualize={setSweepData} />
738+ <OsintPanel onSweepVisualize={setSweepData} onScanGeolocate={(target, data) => {
739+ setScanTargets(prev => {
740+ const existing = prev.filter(t => t.id !== target);
741+ return [{ id: target, timestamp: Date.now(), ...data }, ...existing].slice(0, 10);
742+ });
743+ setFlyToLocation({ lat: data.lat, lng: data.lng, ts: Date.now() });
744+ }} />
736745 <LiveAlerts data={data} onLocate={(lat, lng) => setFlyToLocation({ lat, lng, ts: Date.now() })} onWatchFeed={(url, name) => { setLiveFeedUrl(url); setLiveFeedName(name); }} />
737746 </div>
738747
modified src/components/OsintPanel.tsx +22 −9
@@ -12,7 +12,7 @@
1212
1313 const TABS = [
1414 { id: 'scanner', label: 'PORT SCAN', icon: Radar, placeholder: 'IP or hostname', color: '#00E5FF' },
15- { id: 'vuln', label: 'VULN SCAN', icon: Bug, placeholder: 'IP or hostname', color: '#FF3D3D' },
15+ { id: 'vuln', label: 'VULN SWEEP', icon: Bug, placeholder: 'IP or hostname', color: '#FF3D3D' },
1616
1717 { id: 'dns', label: 'DNS', icon: Server, placeholder: 'Domain name', color: '#448AFF' },
1818 { id: 'whois', label: 'WHOIS', icon: FileText, placeholder: 'Domain name', color: '#FFD700' },
@@ -25,9 +25,9 @@
2525 { id: 'sweep', label: 'IP SWEEP', icon: Crosshair, placeholder: 'Enter IP address (e.g. 8.8.8.8)', color: '#FF3D3D' },
2626 ];
2727
28-interface OsintPanelProps { isOpen?: boolean; onClose?: () => void; isMobile?: boolean; onSweepVisualize?: (data: any) => void; }
28+interface OsintPanelProps { isOpen?: boolean; onClose?: () => void; isMobile?: boolean; onSweepVisualize?: (data: any) => void; onScanGeolocate?: (target: string, data: any) => void; }
2929
30-function OsintPanelInner({ isMobile, onSweepVisualize }: OsintPanelProps) {
30+function OsintPanelInner({ isMobile, onSweepVisualize, onScanGeolocate }: OsintPanelProps) {
3131 const [activeTab, setActiveTab] = useState('scanner');
3232 const [isFullScreen, setIsFullScreen] = useState(false);
3333 const [query, setQuery] = useState('');
@@ -72,17 +72,18 @@
7272 if (!query.trim() || loading) return;
7373 setLoading(true); setError(''); setResults(null);
7474
75- // IP Sweep — separate flow
76- if (activeTab === 'sweep') {
75+ // IP Sweep / Vuln Scan — separate flow
76+ if (activeTab === 'sweep' || activeTab === 'vuln') {
7777 setSweepResult(null);
7878 setSweepProgress({ current: 0, total: Math.pow(2, 32 - sweepCidr) });
7979 try {
80- const res = await fetch(`/api/osint/sweep?ip=${encodeURIComponent(query)}&cidr=${sweepCidr}`);
80+ const cidr = sweepCidr;
81+ const res = await fetch(`/api/osint/sweep?ip=${encodeURIComponent(query)}&cidr=${cidr}`);
8182 if (!res.ok) { const e = await res.json().catch(() => ({})); throw new Error(e.error || `Sweep failed (${res.status})`); }
8283 const data = await res.json();
8384 setSweepResult(data);
8485 setSweepProgress(null);
85- setHistory(prev => [{ tab: 'sweep', query, time: new Date().toLocaleTimeString() }, ...prev.slice(0, 9)]);
86+ setHistory(prev => [{ tab: activeTab, query, time: new Date().toLocaleTimeString() }, ...prev.slice(0, 9)]);
8687 } catch (err: any) {
8788 setError(err.message);
8889 setSweepProgress(null);
@@ -101,7 +102,6 @@
101102 case 'whois': url = `/api/osint/whois?domain=${encodeURIComponent(query)}`; break;
102103 case 'threats': url = `/api/osint/threats?query=${encodeURIComponent(query)}`; break;
103104 case 'scanner': url = `/api/scanner?target=${encodeURIComponent(query)}&type=${scanType}`; break;
104- case 'vuln': url = `/api/scanner?target=${encodeURIComponent(query)}&type=vuln`; break;
105105 case 'headers': url = `/api/scanner?target=${encodeURIComponent(query)}&type=headers`; break;
106106 case 'ssl': url = `/api/scanner?target=${encodeURIComponent(query)}&type=ssl`; break;
107107 case 'subdomains': url = `/api/scanner?target=${encodeURIComponent(query)}&type=subdomains`; break;
@@ -112,6 +112,19 @@
112112 if (res.ok) {
113113 setResults(data);
114114 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+ }
115128 } else {
116129 setError(data.error || 'Lookup failed');
117130 }
@@ -418,7 +431,7 @@
418431 <option value="quick">QUICK SCAN</option><option value="deep">DEEP SCAN</option><option value="ports">TOP 1000 PORTS</option>
419432 </select>
420433 )}
421- {activeTab === 'sweep' && (
434+ {(activeTab === 'sweep' || activeTab === 'vuln') && (
422435 <div className="flex items-center justify-between bg-[var(--bg-primary)]/60 border border-[var(--border-primary)] rounded-lg p-1">
423436 <span className="text-[9px] font-mono text-[var(--text-muted)] pl-2">SUBNET MASK:</span>
424437 <div className="flex items-center gap-0.5">
modified src/components/OsirisMap.tsx +49 −3
@@ -15,6 +15,7 @@
1515 projection?: 'mercator' | 'globe';
1616 mapStyle?: string;
1717 sweepData?: any;
18+ scanTargets?: any[];
1819 }
1920
2021 function computeSolarTerminator(): [number, number][] {
@@ -39,7 +40,7 @@
3940
4041 const EMPTY_FC = { type: 'FeatureCollection' as const, features: [] };
4142
42-function OsirisMap({ data, activeLayers, onEntityClick, onMouseCoords, onRightClick, onViewStateChange, flyToLocation, projection = 'globe', mapStyle = 'dark', sweepData }: OsirisMapProps) {
43+function OsirisMap({ data, activeLayers, onEntityClick, onMouseCoords, onRightClick, onViewStateChange, flyToLocation, projection = 'globe', mapStyle = 'dark', sweepData, scanTargets = [] }: OsirisMapProps) {
4344 const containerRef = useRef<HTMLDivElement>(null);
4445 const mapRef = useRef<maplibregl.Map | null>(null);
4546 const popupRef = useRef<maplibregl.Popup | null>(null);
@@ -108,7 +109,7 @@
108109 createDot(map, 'dot-cctv', '#39FF14', 10);
109110
110111 // Sources
111- const sources = ['flights','military','jets','private-fl','satellites','earthquakes','gdelt','gps-jamming','day-night','cctv','fires','weather','infrastructure','maritime','maritime-choke','maritime-ships','live-news','sigint-news','conflict-zones', 'war-alerts-targets', 'war-alerts-lines', 'balloons', 'radiation', 'ip-sweep-devices', 'ip-sweep-pulse', 'ip-sweep-connections'];
112+ const sources = ['flights','military','jets','private-fl','satellites','earthquakes','gdelt','gps-jamming','day-night','cctv','fires','weather','infrastructure','maritime','maritime-choke','maritime-ships','live-news','sigint-news','conflict-zones', 'war-alerts-targets', 'war-alerts-lines', 'balloons', 'radiation', 'ip-sweep-devices', 'ip-sweep-pulse', 'ip-sweep-connections', 'scan-targets'];
112113 sources.forEach(s => map.addSource(s, { type: 'geojson', data: EMPTY_FC }));
113114
114115 // ── CONFLICT ZONES — small warning markers (not polygons) ──
@@ -354,6 +355,21 @@
354355 'text-color': ['get', 'color'], 'text-halo-color': '#000', 'text-halo-width': 1.5, 'text-opacity': 0.9,
355356 }});
356357
358+ // ══ SCAN TARGETS — Geolocated individual scans ══
359+ map.addLayer({ id: 'scan-targets-glow', type: 'circle', source: 'scan-targets', paint: {
360+ 'circle-radius': ['interpolate',['linear'],['zoom'], 1,12, 5,25, 10,40],
361+ 'circle-color': '#FF3D3D', 'circle-opacity': 0.2, 'circle-blur': 1,
362+ }});
363+ map.addLayer({ id: 'scan-targets-dots', type: 'circle', source: 'scan-targets', paint: {
364+ 'circle-radius': ['interpolate',['linear'],['zoom'], 1,5, 5,8, 10,12],
365+ 'circle-color': '#FF3D3D', 'circle-opacity': 0.95,
366+ 'circle-stroke-width': 2, 'circle-stroke-color': '#FFFFFF', 'circle-stroke-opacity': 0.8,
367+ }});
368+ map.addLayer({ id: 'scan-targets-label', type: 'symbol', source: 'scan-targets', layout: {
369+ 'text-field': ['get', 'id'], 'text-size': 11, 'text-font': ['Open Sans Bold'],
370+ 'text-offset': [0, 2], 'text-max-width': 14, 'text-allow-overlap': false,
371+ }, paint: { 'text-color': '#FF3D3D', 'text-halo-color': '#000', 'text-halo-width': 1.5, 'text-opacity': 0.9 }});
372+
357373 // Flight layers (WebGL symbol — GPU rendered, handles 50K+ smooth)
358374 const flightLayers = [
359375 { id: 'fl-commercial', src: 'flights', icon: 'plane-cyan' },
@@ -566,11 +582,26 @@
566582
567583
568584 // ── Generic hover for clickables ──
569- ['conflict-icons','cctv-dots','eq-circles','sat-dots','fires-heat','gdelt-dots','weather-dots','infra-dots','maritime-dots','choke-dots','news-dots','sigint-news-dots','balloon-dots','rad-dots','ship-dots','sweep-device-dots'].forEach(layer => {
585+ ['conflict-icons','cctv-dots','eq-circles','sat-dots','fires-heat','gdelt-dots','weather-dots','infra-dots','maritime-dots','choke-dots','news-dots','sigint-news-dots','balloon-dots','rad-dots','ship-dots','sweep-device-dots','scan-targets-dots'].forEach(layer => {
570586 map.on('mouseenter', layer, () => { map.getCanvas().style.cursor = 'pointer'; });
571587 map.on('mouseleave', layer, () => { map.getCanvas().style.cursor = ''; });
572588 });
573589
590+ // ── Scan Targets click ──
591+ map.on('click', 'scan-targets-dots', (e: any) => {
592+ const p = e.features?.[0]?.properties;
593+ if (!p) return;
594+ const coords = e.features[0].geometry.coordinates.slice();
595+ popup(coords, `<div style="${pStyle}border:1px solid rgba(255,61,61,0.5);">
596+ <div style="color:#FF3D3D;font-size:12px;font-weight:700;margin-bottom:6px;">🎯 TARGET: ${p.id}</div>
597+ <div style="font-size:9px;color:#E8E6E0;margin-bottom:8px;">${p.city || 'Unknown'}, ${p.country || 'Unknown'} — ${p.isp || 'Unknown ISP'}</div>
598+ <div style="display:grid;grid-template-columns:1fr 1fr;gap:4px;font-size:9px;">
599+ <div><span style="color:#5C5A54;">TYPE</span><br/><span style="color:#00E5FF;">${(p.type || 'UNKNOWN').toUpperCase()}</span></div>
600+ <div><span style="color:#5C5A54;">COORDS</span><br/><span style="color:#E8E6E0;">${coords[1].toFixed(3)}°, ${coords[0].toFixed(3)}°</span></div>
601+ </div>
602+ </div>`);
603+ });
604+
574605 // ── IP Sweep device click ──
575606 map.on('click', 'sweep-device-dots', (e: any) => {
576607 const p = e.features?.[0]?.properties;
@@ -977,6 +1008,21 @@
9771008 return () => clearTimeout(timer);
9781009 }, [mapReady, sweepData, setGeo]);
9791010
1011+ // Scan Targets visualization
1012+ useEffect(() => {
1013+ if (!mapReady || !mapRef.current || !scanTargets) return;
1014+ const map = mapRef.current;
1015+
1016+ const features = scanTargets.map(t => ({
1017+ type: 'Feature' as const,
1018+ geometry: { type: 'Point' as const, coordinates: [t.lng, t.lat] },
1019+ properties: { ...t }
1020+ }));
1021+
1022+ const src = map.getSource('scan-targets') as maplibregl.GeoJSONSource;
1023+ if (src) src.setData({ type: 'FeatureCollection', features });
1024+ }, [scanTargets, mapReady]);
1025+
9801026 // Fly-to
9811027 useEffect(() => {
9821028 if (!mapReady || !mapRef.current || !flyToLocation) return;