import React from 'react'; import { useNavigate } from 'react-router-dom'; import { Crosshair, Download } from '../../../icons'; import { Tag } from '../ui'; import api from '../../../utils/api'; import type { AttackerData } from '../types'; interface Props { attacker: AttackerData; } /** Page header: crosshair + IP + country / traversal / identity badges. * The identity badge is click-through to the resolved-actor page. */ export const AttackerHeader: React.FC = ({ attacker }) => { const navigate = useNavigate(); const handleStixDownload = async () => { try { const res = await api.get(`/attackers/${attacker.uuid}/export/stix`, { responseType: 'blob' }); const href = URL.createObjectURL(res.data); const a = document.createElement('a'); a.href = href; a.download = `decnet-attacker-${attacker.uuid.slice(0, 8)}.stix.json`; a.click(); URL.revokeObjectURL(href); } catch { // best-effort } }; return (

{attacker.ip}

{attacker.country_code && ( {attacker.country_code} )} {attacker.is_traversal && ( TRAVERSAL )} {attacker.identity_id && ( navigate(`/identities/${attacker.identity_id}`)} > IDENTITY · {attacker.identity_id.slice(0, 8)} )}
); };