import React, { useEffect, useRef, useState } from 'react'; import { useSearchParams, useNavigate } from 'react-router-dom'; import { Archive, Search, ChevronLeft, ChevronRight, Filter, Key, Package, ChevronRight as ChevR, Target, } from 'lucide-react'; import api from '../utils/api'; import BountyInspector from './BountyInspector'; import EmptyState from './EmptyState/EmptyState'; import { useFocusSearch } from '../hooks/useFocusSearch'; import './Dashboard.css'; import './Bounty.css'; interface BountyEntry { id: number; timestamp: string; decky: string; service: string; attacker_ip: string; bounty_type: string; payload: any; } const FINGERPRINT_LABELS: Record = { fingerprint_type: 'TYPE', ja3: 'JA3', ja3s: 'JA3S', ja4: 'JA4', ja4s: 'JA4S', ja4l: 'JA4L', sni: 'SNI', alpn: 'ALPN', dst_port: 'PORT', mechanisms: 'MECHANISM', raw_ciphers: 'CIPHERS', hash: 'HASH', target_ip: 'TARGET', target_port: 'PORT', ssh_banner: 'BANNER', kex_algorithms: 'KEX', encryption_s2c: 'ENC (S→C)', mac_s2c: 'MAC (S→C)', compression_s2c: 'COMP (S→C)', raw: 'RAW', ttl: 'TTL', window_size: 'WINDOW', df_bit: 'DF', mss: 'MSS', window_scale: 'WSCALE', sack_ok: 'SACK', timestamp: 'TS', options_order: 'OPTS ORDER', }; const FingerprintPreview: React.FC<{ payload: any }> = ({ payload }) => { if (!payload || typeof payload !== 'object') { return {JSON.stringify(payload)}; } const keys = Object.keys(payload); const priority = ['fingerprint_type', 'ja3', 'ja4', 'hash', 'sni', 'target_ip', 'ssh_banner']; const show = priority.filter(k => payload[k] !== undefined && payload[k] !== null).slice(0, 2); if (!show.length) { return {keys.slice(0, 3).join(', ')}; } return ( {show.map(k => `${FINGERPRINT_LABELS[k] || k.toUpperCase()}: ${payload[k]}`).join(' · ')} ); }; const Bounty: React.FC = () => { const navigate = useNavigate(); const [searchParams, setSearchParams] = useSearchParams(); const query = searchParams.get('q') || ''; const typeFilter = searchParams.get('type') || ''; const page = parseInt(searchParams.get('page') || '1'); const [bounties, setBounties] = useState([]); const [total, setTotal] = useState(0); const [loading, setLoading] = useState(true); const [searchInput, setSearchInput] = useState(query); const searchRef = useRef(null); useFocusSearch(searchRef); const [selected, setSelected] = useState(null); const limit = 50; const fetchBounties = async () => { setLoading(true); try { const offset = (page - 1) * limit; let url = `/bounty?limit=${limit}&offset=${offset}`; if (query) url += `&search=${encodeURIComponent(query)}`; if (typeFilter) url += `&bounty_type=${typeFilter}`; const res = await api.get(url); setBounties(res.data.data); setTotal(res.data.total); } catch (err) { console.error('Failed to fetch bounties', err); } finally { setLoading(false); } }; useEffect(() => { fetchBounties(); }, [query, typeFilter, page]); const handleSearch = (e: React.FormEvent) => { e.preventDefault(); setSearchParams({ q: searchInput, type: typeFilter, page: '1' }); }; const setPage = (p: number) => setSearchParams({ q: query, type: typeFilter, page: p.toString() }); const setType = (t: string) => setSearchParams({ q: query, type: t, page: '1' }); const totalPages = Math.max(1, Math.ceil(total / limit)); const credCount = bounties.filter(b => b.bounty_type === 'credential').length; const payCount = bounties.filter(b => b.bounty_type === 'payload').length; const fpCount = bounties.filter(b => b.bounty_type === 'fingerprint').length; const SEGMENTS: [string, string][] = [ ['', 'ALL'], ['credential', 'CREDENTIALS'], ['payload', 'PAYLOADS'], ['fingerprint', 'FINGERPRINTS'], ]; return (

BOUNTY VAULT

{total.toLocaleString()} ARTIFACTS · {credCount} CREDENTIALS · {payCount} PAYLOADS · {fpCount} FINGERPRINTS
setSearchInput(e.target.value)} />
{SEGMENTS.map(([v, l]) => ( ))}
{total.toLocaleString()} ARTIFACTS CAPTURED
Page {page} of {totalPages}
{bounties.length > 0 ? bounties.map(b => { const isCred = b.bounty_type === 'credential'; const isFp = b.bounty_type === 'fingerprint'; const Icon = isCred ? Key : Package; return ( setSelected(b)}> ); }) : ( )}
TIME DECKY SVC ATTACKER TYPE DATA
{new Date(b.timestamp).toLocaleTimeString()} {b.decky} {b.service} { e.stopPropagation(); navigate(`/attackers?q=${encodeURIComponent(b.attacker_ip)}`); }} > {b.attacker_ip} {b.bounty_type.toUpperCase()} {isCred ? (
user:{b.payload?.username ?? '—'} pass: {b.payload?.password ?? '—'}
) : isFp ? ( ) : ( {b.payload?.query || b.payload?.body || b.payload?.command || JSON.stringify(b.payload)} )}
{selected && ( setSelected(null)} onSelectAttacker={(ip) => { setSelected(null); navigate(`/attackers?q=${encodeURIComponent(ip)}`); }} /> )}
); }; export default Bounty;