recorder

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostPorts

func HostPorts(list []Run) (hostports []string, runs map[string][]Run)

HostPorts returns a list of host:port combinations, and the list of runs sorted by the hostport combination.

func SortRuns

func SortRuns(list []Run)

SortRuns sorts the list first by URL then start timestamp.

Types

type Data

type Data struct {
	Start           time.Time `json:"start"`
	End             time.Time `json:"end"`
	TotalRequests   int       `json:"total_requests"`
	SentRequests    int       `json:"sent_requests"`
	HiddenResponses int       `json:"hidden_responses"`
	ShownResponses  int       `json:"shown_responses"`
	Cancelled       bool      `json:"cancelled"`

	Names       []string   `json:"names"`
	Template    Template   `json:"template"`
	InputFile   string     `json:"input_file,omitempty"`
	Ranges      []string   `json:"ranges,omitempty"`
	RangeFormat string     `json:"range_format,omitempty"`
	Responses   []Response `json:"responses"`
	Extract     []string   `json:"extract,omitempty"`
	ExtractPipe []string   `json:"extract_pipe,omitempty"`
}

Data is the data structure written to the file by a Recorder.

type Recorder

type Recorder struct {
	*request.Request
	Data
	// contains filtered or unexported fields
}

Recorder records information about received responses in a file encoded as .

func New

func New(filename string, request *request.Request) (*Recorder, error)

New creates a new recorder.

func (*Recorder) Run

func (r *Recorder) Run(ctx context.Context, in <-chan response.Response, out chan<- response.Response, inCount <-chan int, outCount chan<- int) error

Run reads responses from ch and forwards them to the returned channel, recording statistics on the way. When ch is closed or the context is cancelled, the output file is closed, processing stops, and the output channel is closed.

type Response

type Response struct {
	Values   []string `json:"values"`
	Error    string   `json:"error,omitempty"`
	Duration float64  `json:"duration"`

	StatusCode    int                `json:"status_code"`
	StatusText    string             `json:"status_text"`
	Header        response.TextStats `json:"header"`
	Body          response.TextStats `json:"body"`
	ExtractedData []string           `json:"extracted_data,omitempty"`
	ExtractError  string             `json:"extract_error,omitempty"`
}

Response is the result of a request sent to the target.

func NewResponse

func NewResponse(r response.Response) (res Response)

NewResponse builds a Response struct for serialization with JSON.

type Run

type Run struct {
	Logfile   string
	JSONFile  string
	URL       *url.URL
	Host      string
	Port      string
	Hostport  string
	PathQuery string
	Data
}

Run describes one run of the 'fuzz' command.

func LoadRuns

func LoadRuns(dir string) (runs []Run, err error)

LoadRuns parses all JSON files in dir and returns a list of runs.

type Template

type Template struct {
	URL    string      `json:"url"`
	Method string      `json:"method"`
	Body   string      `json:"body,omitempty"`
	Header http.Header `json:"header"`
}

Template is the template used to construct an HTTP request.

func NewTemplate

func NewTemplate(request *request.Request) (t Template, err error)

NewTemplate builds a template to write to the JSON data file.

Jump to

Keyboard shortcuts

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