scenario

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthStrategy

type AuthStrategy struct {
	// MinFailures is the minimum number of unique credentials that must fail
	// before any credential can succeed.
	MinFailures int `json:"min_failures"`

	// SuccessProbability is the probability (0.0-1.0) that a new unique credential
	// succeeds after MinFailures is reached. A value of 0.3 means ~30% chance.
	SuccessProbability float64 `json:"success_probability"`

	// FailureStatusCode is the HTTP status code for failed attempts (e.g., 401, 403).
	FailureStatusCode int `json:"failure_status_code"`

	// FailureBody is the response body for failed attempts.
	FailureBody string `json:"failure_body"`

	// FailureHeaders are additional headers for failed responses.
	FailureHeaders map[string]string `json:"failure_headers,omitempty"`

	// CredentialFields specifies which request body fields are considered credentials.
	// Only these fields are used to determine unique login attempts.
	// If empty, the entire request body is used as a fallback.
	CredentialFields []string `json:"credential_fields,omitempty"`
}

AuthStrategy defines how a login endpoint handles authentication attempts. When attached to a route, the server tracks unique credential submissions per source IP. The first MinFailures unique credentials always fail. After that, each new unique credential succeeds with SuccessProbability chance (determined once and cached).

type Meta

type Meta struct {
	Name            string            `json:"name"`
	Description     string            `json:"description"`
	ServerSignature string            `json:"server_signature"`
	Headers         map[string]string `json:"headers"`
	Theme           string            `json:"theme"`
}

Meta holds scenario metadata including server signature and headers.

type Page

type Page struct {
	Path        string `json:"path"`
	HTMLFile    string `json:"html_file"`
	ContentType string `json:"content_type"`
}

Page represents an HTML page served by the honeypot.

func (*Page) Validate

func (p *Page) Validate() error

Validate checks the page for required fields.

type Route

type Route struct {
	Path       string            `json:"path"`
	Method     string            `json:"method"`
	StatusCode int               `json:"status_code"`
	Headers    map[string]string `json:"headers"`
	Body       string            `json:"body"`
	BodyFile   string            `json:"body_file,omitempty"`
	Auth       *AuthStrategy     `json:"auth,omitempty"`

	// Hang makes the route wait indefinitely without sending a response.
	// The connection stays open until the client gives up (timeout).
	Hang bool `json:"hang,omitempty"`
}

Route defines an API endpoint served by the honeypot.

func (*Route) Validate

func (r *Route) Validate() error

Validate checks the route for required fields.

type Scenario

type Scenario struct {
	Meta   Meta    `json:"meta"`
	Pages  []Page  `json:"pages"`
	Routes []Route `json:"routes"`
}

Scenario is the top-level container for a honeypot scenario.

func (*Scenario) Validate

func (s *Scenario) Validate() error

Validate checks the scenario for required fields and consistency. All validation errors are collected and returned together.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL