results

package
v0.0.0-...-c20d51c Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package results provides writers for several types of output.

Index

Constants

View Source
const (
	LinkHREF = LinkType(iota)
	LinkIMG
	LinkScript
	LinkStyle
	LinkUnknown
)

Variables

View Source
var LinkTypes = []string{
	"href",
	"img",
	"script",
	"style",
	"",
}
View Source
var OutputFormats = []string{"text", "csv", "html", "diff"}

Available output formats as strings.

Functions

func FoundSomething

func FoundSomething(code int) bool

Returns true if this is a "useful" result

func ReportResult

func ReportResult(res *Result) bool

Returns true if this result should be included in reports

Types

type BaselineResult

type BaselineResult struct {
	Result

	// Which properties are significant
	PathSignificant    bool
	HeadersSignificant []string
	CodeSignificant    bool
}

func NewBaselineResult

func NewBaselineResult(results ...Result) (*BaselineResult, error)

func (*BaselineResult) Matches

func (b *BaselineResult) Matches(a *Result) bool

type CSVResultsManager

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

CSVResultsManager writes a CSV containing all of the results.

func (*CSVResultsManager) Run

func (rm *CSVResultsManager) Run(res <-chan *Result)

func (*CSVResultsManager) Wait

func (b *CSVResultsManager) Wait()

type DiffResultsManager

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

func NewDiffResultsManager

func NewDiffResultsManager(fp io.WriteCloser) *DiffResultsManager

func (*DiffResultsManager) AddGroup

func (drm *DiffResultsManager) AddGroup(baselineResults ...Result) error

func (*DiffResultsManager) Append

func (drm *DiffResultsManager) Append(result *Result)

func (*DiffResultsManager) Run

func (drm *DiffResultsManager) Run(rChan <-chan *Result)

func (*DiffResultsManager) Wait

func (drm *DiffResultsManager) Wait()

func (*DiffResultsManager) WriteResults

func (drm *DiffResultsManager) WriteResults() error

type HTMLResultsManager

type HTMLResultsManager struct {
	BaseURL string
	// contains filtered or unexported fields
}

HTMLResultsManager writes an HTML file containing the results.

func (*HTMLResultsManager) Run

func (rm *HTMLResultsManager) Run(res <-chan *Result)

func (*HTMLResultsManager) Wait

func (b *HTMLResultsManager) Wait()

type LinkCheckResultsManager

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

Check results for broken links.

func (*LinkCheckResultsManager) Run

func (rm *LinkCheckResultsManager) Run(resChan <-chan *Result)

func (*LinkCheckResultsManager) Wait

func (b *LinkCheckResultsManager) Wait()

type LinkType

type LinkType int

Types of links

type PlainResultsManager

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

PlainResultsManager is designed to output a very basic output that is good for human reading, but not so good for machine parsing. This is the default output and provides a decent way to review results on-screen.

func (*PlainResultsManager) Run

func (rm *PlainResultsManager) Run(res <-chan *Result)

func (*PlainResultsManager) Wait

func (b *PlainResultsManager) Wait()

type Result

type Result struct {
	// URL of resource
	URL *url.URL
	// Host header (if different)
	Host string
	// HTTP Status Code
	Code int
	// Error if one occurred
	Error error
	// Redirect URL
	Redir *url.URL
	// Content length
	Length int64
	// Content-type header
	ContentType string
	// Known Headers
	RequestHeader http.Header
	// Response headers
	ResponseHeader http.Header
	// Group used for potentially bucketing results
	ResultGroup string
	// Links contained in result
	Links map[string]LinkType
}

This is the result emitted by the worker for each URL tested.

func NewResult

func NewResult(URL *url.URL, host string) *Result

Create a new result.

func NewResultForTask

func NewResultForTask(t *task.Task) *Result
func (r *Result) AddLink(URL *url.URL, ltype LinkType)

Add a link to these results.

func (*Result) String

func (r *Result) String() string

Convert a result to a minimal string

type ResultGroupGenerator

type ResultGroupGenerator func(*Result) string
var GetResultGroup ResultGroupGenerator = func(*Result) string { return "" }

type ResultsManager

type ResultsManager interface {
	// Run reads all of the Results in the given channel and writes them to an
	// appropriate output sink.  Run should start its own goroutine for the bulk
	// of the work.
	Run(<-chan *Result)
	// Wait until the channel has been read and output done.
	Wait()
}

ResultsManager provides an interface for reading results from a channel and writing them to some form of output.

func GetResultsManager

func GetResultsManager(settings *ss.ScanSettings) (ResultsManager, error)

Construct a ResultsManager for the given settings in the ss.ScanSettings. Returns an object satisfying the ResultsManager interface or an error.

Jump to

Keyboard shortcuts

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