feat: 1.2.0 attack intelligence, replay, 30-day history and new interface
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 27s
CI / Dependency audit (push) Successful in 18s
CI / Tests (Linux, race detector) (push) Successful in 58s
Release / Plan (reuse the published image?) (push) Successful in 4s
Release / ci (push) Skipped
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Successful in 13s
Release / Gitea release (push) Successful in 5s

Intelligence: attack families mapped to MITRE ATT&CK, network type from
ASN/rDNS without external APIs, request cadence, sessions with
recon/probe/exploit/access/banned stages, campaigns across IPs, verdict
with reasons, recommended actions, exposure detection (2xx with a body
on sensitive paths), STIX 2.1 export, FCrDNS for search engine bots,
optional Tor exit list.

Data: 30-day retention, twelve ranges plus custom from/to, an on-disk
event log (daily files, hourly gzip members, size cap, corruption and
disk-full tolerant), /events, /period, /metrics with stable per-hour
metrics, an extended /ip/{ip}, and peer /period merged on the hub.

Interface: layout system with fixed card sizes, range picker in the
URL, IP analysis page, Replay page, Geography down to state and city
(Natural Earth admin-1), Live page redesigned with stable metrics and a
reusable attack map. Demo data and documentation screenshots.

Security: bounded and deadline-limited period computations, linear
campaign clustering, singleflight caches, sanitized peer studies, event
query budgets, gzip bomb guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-14 21:45:59 -03:00
1 parent 8f1ac462d1
commit b7462c14fa
325 files changed
+19117 -1307

No files matched your search

+14 -9
View File
@@ -1,6 +1,7 @@
package server
import (
"context"
"net/http"
"regexp"
"sort"
@@ -108,7 +109,11 @@ func attackerEvents(x store.IPSummary) (uint64, map[string]int) {
// geoAPI serves GET /api/v1/geo (see the package documentation of the routes).
func (s *Server) geoAPI(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
rg := store.ParseRange(q.Get("range")).Name
rng, ok := s.rangeOf(w, r)
if !ok {
return
}
rg := rng.Key()
host := q.Get("host")
if host == "" {
host = "all"
@@ -138,9 +143,9 @@ func (s *Server) geoAPI(w http.ResponseWriter, r *http.Request) {
}
var out any
if cc == "" {
out = s.geoWorld(rg, host)
out = s.geoWorld(r.Context(), rng, host)
} else {
out = s.geoCountry(rg, host, cc, region)
out = s.geoCountry(r.Context(), rng, host, cc, region)
}
s.geo.v[key], s.geo.at[key] = out, time.Now()
writeJSON(w, 200, out)
@@ -156,9 +161,9 @@ func (s *Server) geoOf(x store.IPSummary) core.GeoInfo {
return g
}
func (s *Server) geoWorld(rg, host string) map[string]any {
func (s *Server) geoWorld(ctx context.Context, rg store.Range, host string) map[string]any {
by := map[string]*agg{}
for _, x := range s.allIPs(rg, host) {
for _, x := range s.allIPs(ctx, rg, host) {
ev, cats := attackerEvents(x)
if ev == 0 {
continue
@@ -187,16 +192,16 @@ func (s *Server) geoWorld(rg, host string) map[string]any {
if len(list) > geoCountries {
list = list[:geoCountries]
}
return map[string]any{"range": rg, "host": host, "countries": list}
return map[string]any{"range": rg.Name, "window": rg.Info(s.opt.Now().Unix()), "host": host, "countries": list}
}
func (s *Server) geoCountry(rg, host, cc, region string) map[string]any {
func (s *Server) geoCountry(ctx context.Context, rg store.Range, host, cc, region string) map[string]any {
total := &agg{}
regs := map[string]*agg{}
type ck struct{ name, region string }
cities := map[ck]*cityOut{}
var rows []geoIPOut
for _, x := range s.allIPs(rg, host) {
for _, x := range s.allIPs(ctx, rg, host) {
ev, cats := attackerEvents(x)
if ev == 0 {
continue
@@ -268,7 +273,7 @@ func (s *Server) geoCountry(rg, host, cc, region string) map[string]any {
if len(rows) > geoIPs {
rows = rows[:geoIPs]
}
out := map[string]any{"range": rg, "host": host, "cc": cc, "events": total.events, "ips": total.ips,
out := map[string]any{"range": rg.Name, "window": rg.Info(s.opt.Now().Unix()), "host": host, "cc": cc, "events": total.events, "ips": total.ips,
"hostile": total.hostile, "suspicious": total.suspic, "cats": total.cats,
"regions": rl, "cities": cl, "top_ips": rows}
if region != "" {