output

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 34 Imported by: 27

Documentation

Index

Constants

View Source
const (
	DefaultResponseDir = "katana_response"
)

Variables

View Source
var (
	CustomFieldsMap = make(map[string]CustomFieldConfig)
)

CustomFieldsMap is the global custom field data instance it is used for parsing the header and body of request. Access it through the exported helpers so it stays safe under concurrent crawler/output initialization (see issue #1698).

View Source
var DefaultFieldConfigData = []CustomFieldConfig{
	{
		Name:  "email",
		Type:  "regex",
		Part:  Response.ToString(),
		Regex: []string{`([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)`},
	},
}
View Source
var FieldNames = []string{
	"url",
	"path",
	"fqdn",
	"rdn",
	"rurl",
	"qurl",
	"qpath",
	"file",
	"ufile",
	"key",
	"value",
	"kv",
	"dir",
	"udir",
}

FieldNames is a list of supported field names

Functions

This section is empty.

Types

type CustomFieldConfig added in v0.0.3

type CustomFieldConfig struct {
	Name         string           `yaml:"name,omitempty"`
	Type         string           `yaml:"type,omitempty"`
	Part         string           `yaml:"part,omitempty"`
	Group        int              `yaml:"group,omitempty"`
	Regex        []string         `yaml:"regex,omitempty"`
	CompileRegex []*regexp.Regexp `yaml:"-"`
}

CustomFieldConfig contains suggestions for field filling

func CustomFieldsSnapshot added in v1.7.0

func CustomFieldsSnapshot() []CustomFieldConfig

CustomFieldsSnapshot returns a copy of the registered custom fields, safe to range over while other goroutines register new fields.

func (*CustomFieldConfig) GetName added in v0.0.3

func (c *CustomFieldConfig) GetName() string

func (*CustomFieldConfig) SetCompiledRegexp added in v0.0.3

func (c *CustomFieldConfig) SetCompiledRegexp(r *regexp.Regexp)

type Error added in v0.0.3

type Error struct {
	Timestamp time.Time `json:"timestamp,omitempty"`
	Endpoint  string    `json:"endpoint,omitempty"`
	Source    string    `json:"source,omitempty"`
	Error     string    `json:"error,omitempty"`
}

type Options

type Options struct {
	Colors                bool
	JSON                  bool
	Verbose               bool
	StoreResponse         bool
	NoClobber             bool
	OmitRaw               bool
	OmitBody              bool
	OutputFile            string
	Fields                string
	StoreFields           string
	StoreResponseDir      string
	StoreFieldDir         string
	FieldConfig           string
	ErrorLogFile          string
	MatchRegex            []*regexp.Regexp
	FilterRegex           []*regexp.Regexp
	ExtensionValidator    *extensions.Validator
	OutputTemplate        string
	OutputMatchCondition  string
	OutputFilterCondition string
	ExcludeOutputFields   []string
	FilterPageType        []string
}

Options contains the configuration options for output writer

type Part added in v0.0.3

type Part string
const (
	// RequestPart is the part of request
	Header   Part = "header"
	Body     Part = "body"
	Response Part = "response"
)

func (Part) ToString added in v0.0.3

func (p Part) ToString() string

type Result

type Result struct {
	Timestamp time.Time            `json:"timestamp,omitempty"`
	Request   *navigation.Request  `json:"request,omitempty"`
	Response  *navigation.Response `json:"response,omitempty"`
	Error     string               `json:"error,omitempty"`
}

Result of the crawling

func (*Result) HasResponse added in v1.0.0

func (r *Result) HasResponse() bool

HasResponse checks if the result has a valid response

type StandardWriter

type StandardWriter struct {
	// contains filtered or unexported fields
}

StandardWriter is an standard output writer structure

func (*StandardWriter) Close

func (w *StandardWriter) Close() error

Close closes the output writer

func (*StandardWriter) GetResultCount added in v1.7.0

func (w *StandardWriter) GetResultCount() int64

GetResultCount returns the number of results written

func (*StandardWriter) Write

func (w *StandardWriter) Write(result *Result) error

Write writes the result to file and/or screen.

func (*StandardWriter) WriteErr added in v0.0.3

func (w *StandardWriter) WriteErr(errMessage *Error) error

type Writer

type Writer interface {
	// Close closes the output writer interface
	Close() error
	// Write writes the event to file and/or screen.
	Write(*Result) error
	WriteErr(*Error) error
	// GetResultCount returns the number of results written
	GetResultCount() int64
}

Writer is an interface which writes output to somewhere for katana events.

func New

func New(options Options) (Writer, error)

New returns a new output writer instance

Jump to

Keyboard shortcuts

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