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>
52 lines
1.6 KiB
Go
52 lines
1.6 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/netip"
|
|
"os"
|
|
"path/filepath"
|
|
"time"
|
|
)
|
|
|
|
// writeGeo grava dbip-city-lite-*.mmdb e dbip-asn-lite-*.mmdb em dir, no
|
|
// layout DB-IP/GeoIP2 que internal/geo lê.
|
|
func writeGeo(dir string) error {
|
|
if err := os.MkdirAll(dir, 0o755); err != nil {
|
|
return err
|
|
}
|
|
var city, asn []mmEntry
|
|
for _, s := range sites {
|
|
rec := map[string]any{
|
|
"country": map[string]any{
|
|
"iso_code": s.cc,
|
|
"names": map[string]any{"en": s.country, "pt-BR": s.countryPT},
|
|
},
|
|
"continent": map[string]any{"code": s.cont},
|
|
"subdivisions": []any{map[string]any{"names": map[string]any{"en": s.region}}},
|
|
"city": map[string]any{"names": map[string]any{"en": s.city}},
|
|
"location": map[string]any{"latitude": s.lat, "longitude": s.lon},
|
|
}
|
|
arec := map[string]any{
|
|
"autonomous_system_number": u32(s.asn),
|
|
"autonomous_system_organization": s.org,
|
|
}
|
|
for _, p := range append(append([]string{}, s.v4...), s.v6...) {
|
|
pf, err := netip.ParsePrefix(p)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !reserved(pf.Addr()) {
|
|
return fmt.Errorf("prefixo fora das faixas reservadas: %s", p)
|
|
}
|
|
city = append(city, mmEntry{pf, rec})
|
|
asn = append(asn, mmEntry{pf, arec})
|
|
}
|
|
}
|
|
epoch := uint64(time.Now().Unix())
|
|
ym := time.Now().UTC().Format("2006-01")
|
|
if err := os.WriteFile(filepath.Join(dir, "dbip-city-lite-"+ym+".mmdb"), buildMMDB(6, 24, city, true, epoch, "DBIP-City-Lite"), 0o644); err != nil {
|
|
return err
|
|
}
|
|
return os.WriteFile(filepath.Join(dir, "dbip-asn-lite-"+ym+".mmdb"), buildMMDB(6, 24, asn, true, epoch, "DBIP-ASN-Lite"), 0o644)
|
|
}
|