Release / Plan (reuse the published image?) (push) Successful in 3s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 28s
CI / Dependency audit (push) Successful in 20s
CI / Tests (Linux, race detector) (push) Successful in 1m10s
Release / ci (push) Successful in 1m10s
Release / Build image (arm64) (push) Successful in 55s
Release / Build image (amd64) (push) Successful in 1m16s
Release / Publish tags (push) Successful in 14s
Release / Gitea release (push) Skipped
New pages grouped in the rail (Monitor, Investigate, Analyze, Operate, Reports): Services (SLO, Apdex, latency app vs proxy), Sessions (stage funnel), Campaigns, Event search, MITRE ATT&CK matrix, Evolution, Concentration (Pareto, Gini), Survival (Kaplan-Meier per attack episode, recidivists), Where errors come from (application vs failed attack vs proxy vs client), Protocols and TLS, Defense (fail2ban, SSH, blocklist), Integrity, and a printable executive report. Chart library (donut, radar, stacked area, bars, heatmap, gauge), glossary with accessible "?" tooltips, self-explanatory category names (nonexistent page 404), page loader through pages.json. Unique visitors fixed: real browsers opening a page, one per IP per day, deduplicated across domains, with non-human clients counted apart. Anonymous legitimate visits on the Live page (?visits=1, no IP). Traefik origin, service, protocol and TLS fields parsed. Paths and Referer paths drop e-mail and token segments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
953 B
Go
38 lines
953 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"git.lucasrguerra.dev.br/ciberfauna/urutau/internal/store"
|
|
)
|
|
|
|
func init() {
|
|
registerUserRoute("GET /api/v1/techniques", func(s *Server) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
pq, ok := s.windowQuery(w, r)
|
|
if !ok {
|
|
return
|
|
}
|
|
defer func() { <-s.user }()
|
|
writeJSON(w, 200, s.opt.Store.Techniques(pq))
|
|
}
|
|
})
|
|
}
|
|
|
|
// windowQuery parses range|from&to&host like /period and takes a user slot;
|
|
// on success the caller releases it with <-s.user.
|
|
func (s *Server) windowQuery(w http.ResponseWriter, r *http.Request) (store.PeriodQuery, bool) {
|
|
eq, ok := s.eventFilter(w, r, 24*time.Hour)
|
|
if !ok {
|
|
return store.PeriodQuery{}, false
|
|
}
|
|
if eq.Host != "" && !s.knownHost(w, eq.Host) {
|
|
return store.PeriodQuery{}, false
|
|
}
|
|
if !s.userSlot(w) {
|
|
return store.PeriodQuery{}, false
|
|
}
|
|
return store.PeriodQuery{From: eq.From, To: eq.To, Host: eq.Host}, true
|
|
}
|