import React, { useEffect, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; import { Archive, Search, ChevronLeft, ChevronRight, Filter } from 'lucide-react'; import api from '../utils/api'; import './Dashboard.css'; interface BountyEntry { id: number; timestamp: string; decky: string; service: string; attacker_ip: string; bounty_type: string; payload: any; } const Bounty: React.FC = () => { 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 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.ceil(total / limit); return (
{/* Page Header */}

BOUNTY VAULT

setSearchInput(e.target.value)} style={{ background: 'transparent', border: 'none', padding: '4px', fontSize: '0.8rem', width: '200px' }} />
{total} ARTIFACTS CAPTURED
Page {page} of {totalPages || 1}
{bounties.length > 0 ? bounties.map((b) => ( )) : ( )}
TIMESTAMP DECKY SERVICE ATTACKER TYPE DATA
{new Date(b.timestamp).toLocaleString()} {b.decky} {b.service} {b.attacker_ip} {b.bounty_type.toUpperCase()}
{b.bounty_type === 'credential' ? (
user:{b.payload.username} pass:{b.payload.password}
) : ( {JSON.stringify(b.payload)} )}
{loading ? 'RETRIEVING ARTIFACTS...' : 'THE VAULT IS EMPTY'}
); }; export default Bounty;