feat: add service filter to attacker profiles

API now accepts ?service=https to filter attackers by targeted service.
Service badges are clickable in both the attacker list and detail views,
navigating to a filtered view. Active filter shows as a dismissable tag.
This commit is contained in:
2026-04-14 01:35:12 -04:00
parent 7756747787
commit 24e0d98425
6 changed files with 78 additions and 15 deletions

View File

@@ -22,6 +22,7 @@ async def get_attackers(
offset: int = Query(0, ge=0, le=2147483647),
search: Optional[str] = None,
sort_by: str = Query("recent", pattern="^(recent|active|traversals)$"),
service: Optional[str] = None,
current_user: str = Depends(get_current_user),
) -> dict[str, Any]:
"""Retrieve paginated attacker profiles."""
@@ -31,6 +32,7 @@ async def get_attackers(
return v
s = _norm(search)
_data = await repo.get_attackers(limit=limit, offset=offset, search=s, sort_by=sort_by)
_total = await repo.get_total_attackers(search=s)
svc = _norm(service)
_data = await repo.get_attackers(limit=limit, offset=offset, search=s, sort_by=sort_by, service=svc)
_total = await repo.get_total_attackers(search=s, service=svc)
return {"total": _total, "limit": limit, "offset": offset, "data": _data}