feat: 1.4.1 pagination, network probes, survival by blocker, report polish
Release / Publish tags (push) Successful in 18s
Release / Plan (reuse the published image?) (push) Successful in 5s
Release / ci (push) Successful in 1m47s
Release / Build image (amd64) (push) Successful in 21s
Release / Build image (arm64) (push) Successful in 28s
CI / Format and vet (push) Successful in 23s
CI / Tests (Linux, race detector) (push) Successful in 1m24s
CI / Dependency audit (push) Successful in 24s
CI / Docker image (build and smoke test) (push) Skipped
Release / Gitea release (push) Successful in 5s
Release / Publish tags (push) Successful in 18s
Release / Plan (reuse the published image?) (push) Successful in 5s
Release / ci (push) Successful in 1m47s
Release / Build image (amd64) (push) Successful in 21s
Release / Build image (arm64) (push) Successful in 28s
CI / Format and vet (push) Successful in 23s
CI / Tests (Linux, race detector) (push) Successful in 1m24s
CI / Dependency audit (push) Successful in 24s
CI / Docker image (build and smoke test) (push) Skipped
Release / Gitea release (push) Successful in 5s
Backend pagination with one pager for sessions, IPs, campaigns and events; network probe source (port-scan, T1046, second firewall reason port-scan); host kit logs inbound probes; urutau call on the report cover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f27d8441a9
commit
432f521ed1
40 files changed
+927
-136
No files matched your search
@@ -2,9 +2,13 @@ package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"slices"
|
||||
"sort"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.lucasrguerra.dev.br/ciberfauna/urutau/internal/intel"
|
||||
"git.lucasrguerra.dev.br/ciberfauna/urutau/internal/store"
|
||||
)
|
||||
|
||||
@@ -30,7 +34,58 @@ func init() {
|
||||
counts = &c
|
||||
}
|
||||
}
|
||||
writeJSON(w, 200, store.FunnelOf(p, counts))
|
||||
writeJSON(w, 200, pagedFunnel(store.FunnelOf(p, counts), r.URL.Query()))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// funnelPage is the funnel with its session list cut to one page; hosts and
|
||||
// fams list every value of the (unfiltered) study for the filter menus.
|
||||
type funnelPage struct {
|
||||
store.FunnelOut
|
||||
Hosts []string `json:"hosts"`
|
||||
Fams []string `json:"fams"`
|
||||
pageTotal
|
||||
}
|
||||
|
||||
// pagedFunnel filters (stage, host, fam) and paginates the session list after
|
||||
// the peers were merged; the funnel counts always cover the whole study.
|
||||
func pagedFunnel(f store.FunnelOut, q url.Values) funnelPage {
|
||||
hosts, fams := map[string]bool{}, map[string]bool{}
|
||||
for _, x := range f.Sessions {
|
||||
for _, h := range x.Hosts {
|
||||
hosts[h] = true
|
||||
}
|
||||
for k := range x.Fams {
|
||||
fams[k] = true
|
||||
}
|
||||
}
|
||||
stage, host, fam := q.Get("stage"), q.Get("host_f"), q.Get("fam")
|
||||
list := make([]intel.Session, 0, len(f.Sessions))
|
||||
for _, x := range f.Sessions {
|
||||
st := x.Stage
|
||||
if st == "" {
|
||||
st = "recon"
|
||||
}
|
||||
if (stage != "" && st != stage) || (fam != "" && x.Fams[fam] == 0) {
|
||||
continue
|
||||
}
|
||||
if host != "" && !slices.Contains(x.Hosts, host) {
|
||||
continue
|
||||
}
|
||||
list = append(list, x)
|
||||
}
|
||||
page, per := pageParams(q)
|
||||
from, to := window(len(list), page, per)
|
||||
f.Sessions = list[from:to]
|
||||
return funnelPage{f, sortedKeys(hosts), sortedKeys(fams), pageTotal{metaOf(len(list), page, per), len(list)}}
|
||||
}
|
||||
|
||||
func sortedKeys(m map[string]bool) []string {
|
||||
out := make([]string, 0, len(m))
|
||||
for k := range m {
|
||||
out = append(out, k)
|
||||
}
|
||||
sort.Strings(out)
|
||||
return out
|
||||
}
|
||||
Reference in new issue
Block a user