import React from 'react'; import { useNavigate } from 'react-router-dom'; import { X, Lock, Copy, Check } from '../icons'; import { useToast } from './Toasts/useToast'; export interface CredentialReuseRow { id: string; secret_sha256: string; secret_kind: string; principal: string | null; principal_key: string; attacker_uuids: string[]; attacker_ips: string[]; deckies: string[]; services: string[]; target_count: number; attempt_count: number; confidence: number; first_seen: string; last_seen: string; updated_at: string; secret_printable: string | null; secret_b64: string | null; } interface Props { row: CredentialReuseRow; onClose: () => void; } const CredentialReuseInspector: React.FC = ({ row, onClose }) => { const { push } = useToast(); const navigate = useNavigate(); const isPlain = row.secret_kind === 'plaintext'; const copy = async (text: string, label: string) => { try { await navigator.clipboard.writeText(text); push({ text: `${label} COPIED`, tone: 'matrix', icon: 'copy' }); } catch { push({ text: 'CLIPBOARD BLOCKED', tone: 'alert', icon: 'alert-triangle' }); } }; return (
{ if (e.target === e.currentTarget) onClose(); }} >

REUSE #{row.id.slice(0, 8)}

SECRET KIND
{row.secret_kind.toUpperCase()}
PRINCIPAL
{row.principal ?? }
TARGETS
{row.target_count}
ATTEMPTS
{row.attempt_count}
CONFIDENCE
{row.confidence.toFixed(2)}
FIRST SEEN
{new Date(row.first_seen).toLocaleString()}
LAST SEEN
{new Date(row.last_seen).toLocaleString()}
DECKIES × SERVICES
{row.services.map(svc => ( ))} {row.deckies.map(decky => ( {row.services.map(svc => ( ))} ))}
{svc.toUpperCase()}
{decky}
ATTACKERS
{row.attacker_uuids.length === 0 ? (
PROFILING PENDING — credential captures precede attacker profiling; this row will populate once the profiler runs.
) : (
{row.attacker_uuids.map((uuid, i) => (
navigate(`/attackers/${uuid}`)} style={{ display: 'flex', gap: 8, alignItems: 'baseline', cursor: 'pointer', textDecoration: 'underline dotted', }} > {uuid.slice(0, 8)} {row.attacker_ips[i] ?? ''}
))}
)}
{isPlain ? 'PLAINTEXT SECRET' : 'OBSERVED RESPONSE'}
              printable:{' '}
              {row.secret_printable ?? '—'}{'\n'}
              b64:{' '}
              {row.secret_b64 ?? '—'}
            
SECRET SHA-256
{row.secret_sha256}
); }; export default CredentialReuseInspector;