Skip to content

feat: refine Top Attackers & Banned IPs - #8

Merged
Jamkris merged 1 commit into
mainfrom
feat/attacker-banned-refinements
Jul 10, 2026
Merged

feat: refine Top Attackers & Banned IPs#8
Jamkris merged 1 commit into
mainfrom
feat/attacker-banned-refinements

Conversation

@Jamkris

@Jamkris Jamkris commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Two small UX refinements requested for the fail2ban panels:

  • Top Attackers no longer lists IPs that are already banned — the table now
    focuses on active threats still worth acting on.
  • Banned IPs gains an Attempts column showing each IP's failed-login
    count from the auth log.

Changes

  • services/attackers.py: split out pure attempt_counts(); parse_attackers()
    takes an exclude set so banned IPs are dropped before top-N ranking.
  • services/dashboard.py: top_attackers() excludes currently-banned IPs;
    banned_ips() attaches attempt counts. Both lookups are best-effort — a missing
    auth log or fail2ban never breaks the panel.
  • models.py: BannedIP gains a count field (default 0).
  • views/banned.html: new sortable Attempts column ( when unknown).

Test plan

  • attempt_counts returns the full mapping; exclude drops IPs pre-ranking.
  • Banned view renders the Attempts column and value.
  • Full suite: 172 passed.

Summary by cubic

Top Attackers now hides already-banned IPs, and Banned IPs shows an Attempts count from the auth log. This focuses the dashboard on active threats and adds useful context.

  • New Features
    • Top Attackers excludes IPs currently banned across all jails; ranking happens after exclusion.
    • Banned IPs adds a sortable Attempts column; counts are best-effort and show "—" when unknown.

Written for commit df32965. Summary will update on new commits.

Review in cubic

…anned IPs

- attackers: extract attempt_counts() + parse_attackers(exclude=...) to drop
  already-banned IPs before ranking
- dashboard: top_attackers() excludes currently-banned IPs; banned_ips()
  attaches per-IP failed-attempt counts (best-effort, never fatal)
- models: BannedIP gains a count field
- banned view: new sortable Attempts column

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Re-trigger cubic

@Jamkris
Jamkris merged commit 91f0130 into main Jul 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant