Files
Vyntral 3a4c230aa7 feat: v2.0 full rewrite — event-driven pipeline, AI + Nuclei + proxy
Complete architectural overhaul. Replaces the v0.1 monolithic scanner
with an event-driven pipeline of auto-registered modules.

Foundation (internal/):
- eventbus: typed pub/sub, 20 event types, race-safe, drop counter
- module: registry with phase-based selection
- store: thread-safe host store with per-host locks + deep-copy reads
- pipeline: coordinator with phase barriers + panic recovery
- config: 5 scan profiles + 3 AI tiers + YAML loader + auto-discovery

Modules (26 auto-registered across 6 phases):
- Discovery: passive (26 sources), bruteforce, recursive, AXFR, GitHub
  dorks, CT streaming, permutation, reverse DNS, vhost, ASN, supply
  chain (npm + PyPI)
- Enrichment: HTTP probe + tech fingerprint + TLS appliance ID, ports
- Analysis: security checks, takeover (110+ sigs), cloud, JavaScript,
  GraphQL, JWT, headers (OWASP), HTTP smuggling, AI cascade, Nuclei
- Reporting: TXT/JSON/CSV writer + AI scan brief

AI layer (internal/ai/ + internal/modules/ai/):
- Three profiles: lean (16 GB), balanced (32 GB MoE), heavy (64 GB)
- Six event-driven handlers: CVE, JS file, HTTP response, secret
  filter, multi-agent vuln enrichment, anomaly + executive report
- Content-hash cache dedups Ollama calls across hosts
- Auto-pull of missing models via /api/pull with streaming progress
- End-of-scan AI SCAN BRIEF in terminal with top chains + next actions

Nuclei compat layer (internal/nucleitpl/):
- Executes ~13k community templates (HTTP subset)
- Auto-download of nuclei-templates ZIP to ~/.god-eye/nuclei-templates
- Scope filter rejects off-host templates (eliminates OSINT FPs)

Operations:
- Interactive wizard (internal/wizard/) — zero-flag launch
- LivePrinter (internal/tui/) — colorized event stream
- Diff engine + scheduler (internal/diff, internal/scheduler) for
  continuous ASM monitoring with webhook alerts
- Proxy support (internal/proxyconf/): http / https / socks5 / socks5h
  + basic auth

Fixes #1 — native SOCKS5 / Tor compatibility via --proxy flag.

185 unit tests across 15 packages, all race-detector clean.
2026-04-18 16:48:41 +02:00

64 lines
1.6 KiB
Go

package scheduler
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"time"
"god-eye/internal/diff"
)
// WebhookAlerter POSTs the diff report JSON to an arbitrary URL. Works
// with generic webhook consumers; Slack/Discord get dedicated adapters
// later in F5.3 when bespoke formatting matters.
type WebhookAlerter struct {
URL string
Timeout time.Duration
}
// NewWebhookAlerter returns a WebhookAlerter with sane defaults.
func NewWebhookAlerter(url string) *WebhookAlerter {
return &WebhookAlerter{URL: url, Timeout: 10 * time.Second}
}
func (a *WebhookAlerter) Name() string { return "webhook" }
func (a *WebhookAlerter) Notify(ctx context.Context, r *diff.Report) error {
body, err := json.Marshal(r)
if err != nil {
return err
}
client := &http.Client{Timeout: a.Timeout}
req, err := http.NewRequestWithContext(ctx, "POST", a.URL, bytes.NewReader(body))
if err != nil {
return err
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("User-Agent", "god-eye-v2")
resp, err := client.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode >= 400 {
return fmt.Errorf("webhook returned %d", resp.StatusCode)
}
return nil
}
// StdoutAlerter prints meaningful changes to stdout. Useful for smoke
// testing and for users who pipe god-eye output into grep/jq.
type StdoutAlerter struct{}
func (StdoutAlerter) Name() string { return "stdout" }
func (StdoutAlerter) Notify(_ context.Context, r *diff.Report) error {
for _, c := range r.Changes {
fmt.Printf("[DIFF %s] %s %s → %s (%s)\n", r.Target, c.Kind, c.Before, c.After, c.Host)
}
return nil
}