profile

package
v0.0.0-...-1e0f2b1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileExtension = ".bb2"
)

Variables

View Source
var (
	ErrInvalidGrepEnabled   = errors.New("invalid grep enabled")
	ErrInvalidGrepOperator  = errors.New("invalid grep operator")
	ErrInvalidGrepType      = errors.New("invalid grep type")
	ErrInvalidGrepOption    = errors.New("invalid grep option")
	ErrInvalidStatusCode    = errors.New("invalid status code")
	ErrInvalidTimeDelay     = errors.New("invalid time delay")
	ErrInvalidContentLength = errors.New("invalid content length")
	ErrInvalidURLExtension  = errors.New("invalid url extension")
)
View Source
var (
	ErrInvalidPayloadIdx    = errors.New("invalid payload index")
	ErrInvalidPayloadBool   = errors.New("invalid payload bool")
	ErrInvalidPayloadFormat = errors.New("invalid payload format")

	ErrInvalidGrepIdx = errors.New("invalid grep index")
)
View Source
var (
	ErrProfilePath = errors.New("cannot read profile path")
	ErrUnknownType = errors.New("unknown profile type")
)
View Source
var ErrMissingProfiles = errors.New("missing profiles")

Functions

This section is empty.

Types

type Active

type Active struct {
	// Basic information
	Name    string   `json:"profile_name"`
	Enabled bool     `json:"enabled"`
	Type    Type     `json:"scanner"`
	Author  string   `json:"author"`
	Tags    []string `json:"Tags"`

	Steps []Step `json:"steps"`
}

Active represents an active profile.

func (Active) GetName

func (a Active) GetName() string

GetName returns the name of the active profile.

func (Active) GetTags

func (a Active) GetTags() []string

GetTags returns the tags of the active profile.

func (Active) GetType

func (a Active) GetType() Type

GetType returns the type of the active profile.

func (Active) IsEnabled

func (a Active) IsEnabled() bool

IsEnabled returns whether the active profile is enabled.

type ChangeHTTPMethodType

type ChangeHTTPMethodType string

ChangeHTTPMethodType represents the type of change to be made to the HTTP method during the scan. It can be PostToGet, GetToPost, or SwapGetAndPost.

const (
	ChangePostToGet      ChangeHTTPMethodType = "post_to_get"
	ChangeGetToPost      ChangeHTTPMethodType = "get_to_post"
	ChangeSwapGetAndPost ChangeHTTPMethodType = "get_post_get"
)

func (ChangeHTTPMethodType) GetToPost

func (t ChangeHTTPMethodType) GetToPost() bool

GetToPost returns true if the change is from GET to POST.

func (ChangeHTTPMethodType) PostToGet

func (t ChangeHTTPMethodType) PostToGet() bool

PostToGet returns true if the change is from POST to GET.

func (ChangeHTTPMethodType) SwapGetAndPost

func (t ChangeHTTPMethodType) SwapGetAndPost() bool

SwapGetAndPost returns true if the change is from GET to POST and vice versa.

type Config

type Config struct {
	Path string `default:"profiles"`
}

Config is the configuration for the FileProvider.

func (Config) ProfilesPath

func (cfg Config) ProfilesPath() string

ProfilesPath returns the path to the profiles' directory.

type FileProvider

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

FileProvider is an implementation of the Provider interface that reads profiles from one or multiple file system locations.

func NewFileProvider

func NewFileProvider(locations ...string) (FileProvider, error)

NewFileProvider creates a new FileProvider instance.

func (FileProvider) Actives

func (fp FileProvider) Actives() []*Active

Actives returns all the active profiles loaded from file system.

func (FileProvider) ActivesEnabled

func (fp FileProvider) ActivesEnabled() []*Active

ActivesEnabled returns all the active profiles loaded from the file system that are enabled.

func (FileProvider) From

func (fp FileProvider) From() []string

From returns the locations from where the profiles were loaded.

func (FileProvider) PassiveReqs

func (fp FileProvider) PassiveReqs() []*Request

PassiveReqs returns all the passive request profiles loaded from file system.

func (FileProvider) PassiveReqsEnabled

func (fp FileProvider) PassiveReqsEnabled() []*Request

PassiveReqsEnabled returns all the passive request profiles loaded from the file system that are enabled.

func (FileProvider) PassiveRes

func (fp FileProvider) PassiveRes() []*Response

PassiveRes returns all the passive response profiles loaded from file system.

func (FileProvider) PassiveResEnabled

func (fp FileProvider) PassiveResEnabled() []*Response

PassiveResEnabled returns all the passive response profiles loaded from the file system that are enabled.

func (FileProvider) Tags

func (fp FileProvider) Tags() []string

Tags returns all the tags found in the profiles loaded from the file system.

type Grep

type Grep struct {
	Enabled  bool
	Operator GrepOperator
	Type     GrepType
	Value    GrepValue
	Option   GrepOption
	Where    string // only used for passive profiles (requests)
}

Grep represents a Grep directive, used to identify matches during active and passive scans.

func GrepFromString

func GrepFromString(s string, rr map[string]string, includeWhere bool) (Grep, error)

GrepFromString initializes a Grep instance from a string.

type GrepOperator

type GrepOperator string

GrepOperator represents a Grep operator, used to combine multiple Grep directives within the same step/profile.

const (
	GrepOperatorNone   GrepOperator = ""
	GrepOperatorAnd    GrepOperator = "AND"
	GrepOperatorAndNot GrepOperator = "AND NOT"
	GrepOperatorOr     GrepOperator = "OR"
	GrepOperatorOrNot  GrepOperator = "OR NOT"
)

func (GrepOperator) And

func (op GrepOperator) And() bool

And returns whether the operator is AND.

func (GrepOperator) AndNot

func (op GrepOperator) AndNot() bool

AndNot returns whether the operator is AND NOT.

func (GrepOperator) Match

func (op GrepOperator) Match(x, y bool) bool

Match returns the result of the operator applied to the two given boolean values. So, basic logic operations are performed.

func (GrepOperator) None

func (op GrepOperator) None() bool

None returns whether the operator is None.

func (GrepOperator) Or

func (op GrepOperator) Or() bool

Or returns whether the operator is OR.

func (GrepOperator) OrNot

func (op GrepOperator) OrNot() bool

OrNot returns whether the operator is OR NOT.

type GrepOption

type GrepOption string

GrepOption represents a Grep option, used to determine how the value should be matched.

const (
	GrepOptionNone          GrepOption = ""
	GrepOptionCaseSensitive GrepOption = "Case sensitive"
	GrepOptionOnlyInHeaders GrepOption = "Only in Headers"
	GrepOptionNotInHeaders  GrepOption = "Not in Headers"
)

func (GrepOption) CaseSensitive

func (opt GrepOption) CaseSensitive() bool

CaseSensitive returns whether the GrepOption is CaseSensitive.

func (GrepOption) None

func (opt GrepOption) None() bool

None returns whether the GrepOption is None.

func (GrepOption) NotInHeaders

func (opt GrepOption) NotInHeaders() bool

NotInHeaders returns whether the GrepOption is NotInHeaders.

func (GrepOption) OnlyInHeaders

func (opt GrepOption) OnlyInHeaders() bool

OnlyInHeaders returns whether the GrepOption is OnlyInHeaders.

func (GrepOption) String

func (opt GrepOption) String() string

String returns the string representation of the GrepOption.

type GrepType

type GrepType string

GrepType represents a Grep type, used to determine the type of the value that should be matched.

const (
	GrepTypeSimpleString      GrepType = "Simple String"
	GrepTypeRegex             GrepType = "Regex"
	GrepTypeBlindHost         GrepType = "Blind Host"
	GrepTypeStatusCode        GrepType = "Status Code"
	GrepTypeTimeDelay         GrepType = "Time Delay"
	GrepTypeContentType       GrepType = "Content Type"
	GrepTypeContentLength     GrepType = "Content Length"
	GrepTypeContentLengthDiff GrepType = "Content Length Diff"
	GrepTypeURLExtension      GrepType = "URL Extension"
	GrepTypePayload           GrepType = "Payload"
	GrepTypePreEncodedPayload GrepType = "Pre-Encoded Payload"
)

func (GrepType) BlindHost

func (gt GrepType) BlindHost() bool

BlindHost returns whether the GrepType is BlindHost.

func (GrepType) ContentLength

func (gt GrepType) ContentLength() bool

ContentLength returns whether the GrepType is ContentLength.

func (GrepType) ContentLengthDiff

func (gt GrepType) ContentLengthDiff() bool

ContentLengthDiff returns whether the GrepType is ContentLengthDiff.

func (GrepType) ContentType

func (gt GrepType) ContentType() bool

ContentType returns whether the GrepType is ContentType.

func (GrepType) ContentURLExtension

func (gt GrepType) ContentURLExtension() bool

ContentURLExtension returns whether the GrepType is URLExtension.

func (GrepType) Payload

func (gt GrepType) Payload() bool

Payload returns whether the GrepType is Payload.

func (GrepType) PreEncodedPayload

func (gt GrepType) PreEncodedPayload() bool

PreEncodedPayload returns whether the GrepType is PreEncodedPayload.

func (GrepType) Regex

func (gt GrepType) Regex() bool

Regex returns whether the GrepType is Regex.

func (GrepType) SimpleString

func (gt GrepType) SimpleString() bool

SimpleString returns whether the GrepType is SimpleString.

func (GrepType) StatusCode

func (gt GrepType) StatusCode() bool

StatusCode returns whether the GrepType is StatusCode.

func (GrepType) String

func (gt GrepType) String() string

String returns the string representation of the GrepType.

func (GrepType) TimeDelay

func (gt GrepType) TimeDelay() bool

TimeDelay returns whether the GrepType is TimeDelay.

type GrepValue

type GrepValue string

GrepValue represents the value of a Grep directive.

func (GrepValue) AsContentLength

func (v GrepValue) AsContentLength() int

AsContentLength returns the GrepValue as an integer that represents the content length.

func (GrepValue) AsContentTypes

func (v GrepValue) AsContentTypes() []string

AsContentTypes returns the GrepValue as a slice of content types (strings).

func (GrepValue) AsPayload

func (v GrepValue) AsPayload() string

AsPayload returns the GrepValue as a string.

func (GrepValue) AsPreEncodedPayload

func (v GrepValue) AsPreEncodedPayload() string

AsPreEncodedPayload returns the GrepValue as a string.

func (GrepValue) AsRegex

func (v GrepValue) AsRegex() string

AsRegex returns the GrepValue as a regex string.

func (GrepValue) AsStatusCodes

func (v GrepValue) AsStatusCodes() []int

AsStatusCodes returns the GrepValue as a slice of status codes (integers).

func (GrepValue) AsString

func (v GrepValue) AsString() string

AsString returns the GrepValue as a string.

func (GrepValue) AsTimeDelaySeconds

func (v GrepValue) AsTimeDelaySeconds() int

AsTimeDelaySeconds returns the GrepValue as an integer that represents the time delay in seconds.

func (GrepValue) AsURLExtensions

func (v GrepValue) AsURLExtensions() []string

AsURLExtensions returns the GrepValue as a slice of URL extensions (strings).

func (GrepValue) Replace

func (v GrepValue) Replace(rr map[string]string) GrepValue

Replace replaces the labels with the corresponding values.

type InsertionPointMode

type InsertionPointMode string

InsertionPointMode represents the mode of the insertion point.

const (
	InsertionPointModeAny  InsertionPointMode = "any"
	InsertionPointModeSame InsertionPointMode = "same"
)

func (InsertionPointMode) Any

func (ipm InsertionPointMode) Any() bool

Any returns true if the insertion point mode is any.

func (InsertionPointMode) Same

func (ipm InsertionPointMode) Same() bool

Same returns true if the insertion point mode is same.

type InsertionPointType

type InsertionPointType string

InsertionPointType represents the type of insertion point.

const (
	ParamURLValue         InsertionPointType = "param_url"
	ParamBodyValue        InsertionPointType = "param_body"
	CookieValue           InsertionPointType = "param_cookie"
	ParamXMLValue         InsertionPointType = "param_xml"
	ParamXMLAttrValue     InsertionPointType = "param_xml_attr"
	ParamMultiAttrValue   InsertionPointType = "param_multipart_attr"
	ParamJSONValue        InsertionPointType = "param_json"
	CookieName            InsertionPointType = "param_name_cookie"
	ParamXMLName          InsertionPointType = "param_name_xml"
	URLPathFolder         InsertionPointType = "url_path_folder"
	ParamURLName          InsertionPointType = "param_name_url"
	ParamBodyName         InsertionPointType = "param_name_body"
	EntireBodyXML         InsertionPointType = "entire_body_xml"
	URLPathFile           InsertionPointType = "url_path_filename"
	ParamXMLAttrName      InsertionPointType = "param_name_xml_attr"
	ParamMultiAttrName    InsertionPointType = "param_name_multi_part_attr"
	ParamJSONName         InsertionPointType = "param_name_json"
	MultiplePathDiscovery InsertionPointType = "extension_provice"
	SinglePathDiscovery   InsertionPointType = "single_path_discovery"
	HeaderUserAgent       InsertionPointType = "user_agent"
	HeaderReferer         InsertionPointType = "referer"
	HeaderOrigin          InsertionPointType = "origin"
	HeaderHost            InsertionPointType = "host"
	HeaderContentType     InsertionPointType = "content_type"
	HeaderAccept          InsertionPointType = "accept"
	HeaderAcceptLanguage  InsertionPointType = "accept_language"
	HeaderAcceptEncoding  InsertionPointType = "accept_encoding"
	HeaderNew             InsertionPointType = "new_headers"
	EntireBody            InsertionPointType = "entire_body"
	EntireBodyJSON        InsertionPointType = "entire_body_json"
	EntireBodyMulti       InsertionPointType = "entire_body_multipart"
)

func (InsertionPointType) String

func (i InsertionPointType) String() string

String returns the string representation of the insertion point type.

type IssueInformation

type IssueInformation interface {
	GetIssueName() string
	GetIssueSeverity() string
	GetIssueConfidence() string
	GetIssueDetail() string
	GetIssueBackground() string
	GetRemediationDetail() string
	GetRemediationBackground() string
}

IssueInformation represents the information of an issue. It can be part of a step (active) or a scan profile (passive).

type MatchAndReplace

type MatchAndReplace struct {
	Type    MatchAndReplaceType  `json:"type"`
	Match   string               `json:"match"`
	Replace string               `json:"replace"`
	Regex   MatchAndReplaceRegex `json:"regex"`
}

MatchAndReplace represents a match and replace operation.

type MatchAndReplaceRegex

type MatchAndReplaceRegex string

MatchAndReplaceRegex represents the type of match and replace operation.

const (
	MatchAndReplaceString MatchAndReplaceRegex = "String"
	MatchAndReplaceRegexp MatchAndReplaceRegex = "Regex"
)

func (MatchAndReplaceRegex) Regex

func (r MatchAndReplaceRegex) Regex() bool

Regex returns true if the match and replace operation is for a regular expression.

func (MatchAndReplaceRegex) String

func (r MatchAndReplaceRegex) String() bool

String returns true if the match and replace operation is for a string.

type MatchAndReplaceType

type MatchAndReplaceType string

MatchAndReplaceType represents the type of match and replace operation.

const (
	MatchAndReplaceRequest MatchAndReplaceType = "Request"
	MatchAndReplacePayload MatchAndReplaceType = "Payload"
)

func (MatchAndReplaceType) Payload

func (t MatchAndReplaceType) Payload() bool

Payload returns true if the match and replace operation is for the payload.

func (MatchAndReplaceType) Request

func (t MatchAndReplaceType) Request() bool

Request returns true if the match and replace operation is for the request.

type PayloadPosition

type PayloadPosition string

PayloadPosition represents the position of the payload.

const (
	Replace PayloadPosition = "replace"
	Append  PayloadPosition = "append"
	Insert  PayloadPosition = "insert"
)

type Profile

type Profile interface {
	GetName() string
	GetType() Type
	IsEnabled() bool
	GetTags() []string
}

Profile represents the behavior expected from a scan profile. It can be a passive or active profile (e.g. Active).

type Provider

type Provider interface {
	Actives() []*Active
	ActivesEnabled() []*Active

	PassiveReqs() []*Request
	PassiveReqsEnabled() []*Request

	PassiveRes() []*Response
	PassiveResEnabled() []*Response

	Tags() []string

	From() []string
}

Provider is the interface that defines the expected behavior of a profile provider.

For instance, the FileProvider provides profiles from one or multiple file-disk location.

type Redirect

type Redirect int

Redirect represents the redirect type.

const (
	RedirectNever  Redirect = 1
	RedirectOnSite Redirect = 2
	RedirectAlways Redirect = 4
)

func (Redirect) Always

func (r Redirect) Always() bool

Always returns true if the redirect type is always.

func (Redirect) Never

func (r Redirect) Never() bool

Never returns true if the redirect type is never.

func (Redirect) OnSite

func (r Redirect) OnSite() bool

OnSite returns true if the redirect type is on site.

type Request

type Request struct {
	// Basic information
	Name    string   `json:"profile_name"`
	Enabled bool     `json:"enabled"`
	Type    Type     `json:"scanner"`
	Author  string   `json:"author"`
	Tags    []string `json:"Tags"`

	Greps []string `json:"grep"`

	// Issue information
	IssueName             string `json:"issue_name"`
	IssueSeverity         string `json:"issue_severity"`
	IssueConfidence       string `json:"issue_confidence"`
	IssueDetail           string `json:"issue_detail"`
	RemediationDetail     string `json:"remediation_detail"`
	IssueBackground       string `json:"issue_background"`
	RemediationBackground string `json:"remediation_background"`
}

Request represents a passive request profile.

func (Request) GetIssueBackground

func (r Request) GetIssueBackground() string

GetIssueBackground returns the issue background associated with the request profile.

func (Request) GetIssueConfidence

func (r Request) GetIssueConfidence() string

GetIssueConfidence returns the issue confidence associated with the request profile.

func (Request) GetIssueDetail

func (r Request) GetIssueDetail() string

GetIssueDetail returns the issue detail associated with the request profile.

func (Request) GetIssueName

func (r Request) GetIssueName() string

GetIssueName returns the issue name associated with the request profile.

func (Request) GetIssueSeverity

func (r Request) GetIssueSeverity() string

GetIssueSeverity returns the issue severity associated with the request profile.

func (Request) GetName

func (r Request) GetName() string

GetName returns the name of the request profile.

func (Request) GetRemediationBackground

func (r Request) GetRemediationBackground() string

GetRemediationBackground returns the remediation background associated with the request profile.

func (Request) GetRemediationDetail

func (r Request) GetRemediationDetail() string

GetRemediationDetail returns the remediation detail associated with the request profile.

func (Request) GetTags

func (r Request) GetTags() []string

GetTags returns the tags of the request profile.

func (Request) GetType

func (r Request) GetType() Type

GetType returns the type of the request profile.

func (Request) GrepAt

func (r Request) GrepAt(idx int, rr map[string]string) (Grep, error)

GrepAt returns the grep at the given index. In case the index is out of range, or the format is invalid, an error is returned.

func (Request) IsEnabled

func (r Request) IsEnabled() bool

IsEnabled returns whether the request profile is enabled.

type RequestType

type RequestType string

RequestType represents the type of request.

const (
	OriginalRequest RequestType = "original"
	RawRequest      RequestType = "raw_request"
)

func (RequestType) OriginalRequest

func (rt RequestType) OriginalRequest() bool

OriginalRequest returns true if the request type is original.

func (RequestType) RawRequest

func (rt RequestType) RawRequest() bool

RawRequest returns true if the request type is raw.

type Response

type Response struct {
	// Basic information
	Name    string   `json:"profile_name"`
	Enabled bool     `json:"enabled"`
	Type    Type     `json:"scanner"`
	Author  string   `json:"author"`
	Tags    []string `json:"Tags"`

	Greps []string `json:"grep"`

	// Issue information
	IssueName             string `json:"issue_name"`
	IssueSeverity         string `json:"issue_severity"`
	IssueConfidence       string `json:"issue_confidence"`
	IssueDetail           string `json:"issue_detail"`
	RemediationDetail     string `json:"remediation_detail"`
	IssueBackground       string `json:"issue_background"`
	RemediationBackground string `json:"remediation_background"`
}

Response represents a passive response profile.

func (Response) GetIssueBackground

func (p Response) GetIssueBackground() string

GetIssueBackground returns the issue background associated with the response profile.

func (Response) GetIssueConfidence

func (p Response) GetIssueConfidence() string

GetIssueConfidence returns the issue confidence associated with the response profile.

func (Response) GetIssueDetail

func (p Response) GetIssueDetail() string

GetIssueDetail returns the issue detail associated with the response profile.

func (Response) GetIssueName

func (p Response) GetIssueName() string

GetIssueName returns the issue name associated with the response profile.

func (Response) GetIssueSeverity

func (p Response) GetIssueSeverity() string

GetIssueSeverity returns the issue severity associated with the response profile.

func (Response) GetName

func (p Response) GetName() string

GetName returns the name of the response profile.

func (Response) GetRemediationBackground

func (p Response) GetRemediationBackground() string

GetRemediationBackground returns the remediation background associated with the response profile.

func (Response) GetRemediationDetail

func (p Response) GetRemediationDetail() string

GetRemediationDetail returns the remediation detail associated with the response profile.

func (Response) GetTags

func (p Response) GetTags() []string

GetTags returns the tags of the response profile.

func (Response) GetType

func (p Response) GetType() Type

GetType returns the type of the response profile.

func (Response) GrepAt

func (p Response) GrepAt(idx int, rr map[string]string) (Grep, error)

GrepAt returns the grep at the given index. In case the index is out of range, or the format is invalid, an error is returned.

func (Response) IsEnabled

func (p Response) IsEnabled() bool

IsEnabled returns whether the response profile is enabled.

type ShowAlertType

type ShowAlertType string

ShowAlertType represents the type of alert to show.

const (
	ShowAlertNone   ShowAlertType = "none"
	ShowAlertOne    ShowAlertType = "one"
	ShowAlertAlways ShowAlertType = "always"
)

func (ShowAlertType) Always

func (t ShowAlertType) Always() bool

Always returns true if the alert type is always.

func (ShowAlertType) Enabled

func (t ShowAlertType) Enabled() bool

Enabled returns true if the alert type is one or always.

func (ShowAlertType) None

func (t ShowAlertType) None() bool

None returns true if the alert type is none.

func (ShowAlertType) One

func (t ShowAlertType) One() bool

One returns true if the alert type is one.

type Step

type Step struct {
	RequestType          RequestType          `json:"request_type"`
	InsertionPoint       InsertionPointMode   `json:"insertion_point"`
	RawRequest           string               `json:"raw_request"`
	Payloads             []string             `json:"payloads"`
	PayloadPosition      PayloadPosition      `json:"payload_position"`
	ChangeHTTPMethod     bool                 `json:"change_http_request"`
	ChangeHTTPMethodType ChangeHTTPMethodType `json:"change_http_request_type"`
	InsertionPoints      []InsertionPointType `json:"insertion_points"`
	CustomHeaders        []string             `json:"new_headers"`
	MatchAndReplaces     []MatchAndReplace    `json:"match_replace"`
	Encoder              []string             `json:"encoder"`
	URLEncode            bool                 `json:"url_encode"`
	CharsToURLEncode     string               `json:"chars_to_url_encode"`
	Greps                []string             `json:"grep"`
	RedirType            string               `json:"redir_type"`
	MaxRedir             int                  `json:"max_redir"`

	// Issue information
	ShowAlert             ShowAlertType `json:"show_alert"`
	IssueName             string        `json:"issue_name"`
	IssueSeverity         string        `json:"issue_severity"`
	IssueConfidence       string        `json:"issue_confidence"`
	IssueDetail           string        `json:"issue_detail"`
	RemediationDetail     string        `json:"remediation_detail"`
	IssueBackground       string        `json:"issue_background"`
	RemediationBackground string        `json:"remediation_background"`
}

Step represents a single step, part of an Active profile.

func (Step) GetIssueBackground

func (s Step) GetIssueBackground() string

GetIssueBackground returns the issue background associated with the step.

func (Step) GetIssueConfidence

func (s Step) GetIssueConfidence() string

GetIssueConfidence returns the issue confidence associated with the step.

func (Step) GetIssueDetail

func (s Step) GetIssueDetail() string

GetIssueDetail returns the issue detail associated with the step.

func (Step) GetIssueName

func (s Step) GetIssueName() string

GetIssueName returns the issue name associated with the step.

func (Step) GetIssueSeverity

func (s Step) GetIssueSeverity() string

GetIssueSeverity returns the issue severity associated with the step.

func (Step) GetRemediationBackground

func (s Step) GetRemediationBackground() string

GetRemediationBackground returns the remediation background associated with the step.

func (Step) GetRemediationDetail

func (s Step) GetRemediationDetail() string

GetRemediationDetail returns the remediation detail associated with the step.

func (Step) GetToPost

func (s Step) GetToPost() bool

GetToPost returns false if ChangeHTTPMethod is false. Otherwise, returns p.ChangeHTTPMethodType.GetToPost().

func (Step) GrepAt

func (s Step) GrepAt(idx int, rr map[string]string) (Grep, error)

GrepAt returns the grep at the given index. In case the index is out of range, or the format is invalid, an error is returned.

func (Step) HasBHGrepType

func (s Step) HasBHGrepType() bool

HasBHGrepType returns true if the step has a GrepTypeBlindHost grep.

func (Step) InsertionPointEnabled

func (s Step) InsertionPointEnabled(ipt InsertionPointType, method string) bool

InsertionPointEnabled returns true if the step has the given insertion point enabled.

The method parameter is used to make the decision based on the HTTP method and ChangeHTTPMethodType.

func (Step) MaxRedirects

func (s Step) MaxRedirects() int

MaxRedirects is a helper function that returns the maximum number of redirects to follow.

func (Step) PayloadAt

func (s Step) PayloadAt(idx int) (bool, string, error)

PayloadAt returns the payload at the given index, and whether it is enabled or not. In case the index is out of range, or the format is invalid, an error is returned.

func (Step) PayloadAtEncoded

func (s Step) PayloadAtEncoded(idx int) (bool, string, error)

PayloadAtEncoded is the equivalent of PayloadAt, but it returns the Payload encoded, if so.

func (Step) PostToGet

func (s Step) PostToGet() bool

PostToGet returns false if ChangeHTTPMethod is false. Otherwise, returns p.ChangeHTTPMethodType.PostToGet().

func (Step) RedirectType

func (s Step) RedirectType() Redirect

RedirectType is a helper function that returns the allowed redirect type based on the profile.

func (Step) SwapGetAndPost

func (s Step) SwapGetAndPost() bool

SwapGetAndPost returns false if ChangeHTTPMethod is false. Otherwise, returns p.ChangeHTTPMethodType.SwapGetAndPost().

type Type

type Type string

Type represents the type of profile.

const (
	TypeActive     Type = "active"
	TypePassiveReq Type = "passive_request"
	TypePassiveRes Type = "passive_response"
)

func (Type) Active

func (t Type) Active() bool

Active returns true if the profile type is active.

func (Type) PassiveReq

func (t Type) PassiveReq() bool

PassiveReq returns true if the profile type is passive request.

func (Type) PassiveRes

func (t Type) PassiveRes() bool

PassiveRes returns true if the profile type is passive response.

func (Type) String

func (t Type) String() string

String returns the string representation of the profile type.

type ZipProvider

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

ZipProvider is a profile provider that reads profiles from a zip file.

func NewMultipartFromProvider

func NewMultipartFromProvider(ctx context.Context, form *multipart.Form) (ZipProvider, error)

NewMultipartFromProvider reads the profiles from a multipart form.

func NewZipProvider

func NewZipProvider(ctx context.Context, contents []byte) (ZipProvider, error)

NewZipProvider creates a new ZipProvider from the given zip file contents.

func (ZipProvider) Actives

func (zp ZipProvider) Actives() []*Active

Actives returns the active profiles loaded from the zip file.

func (ZipProvider) ActivesEnabled

func (zp ZipProvider) ActivesEnabled() []*Active

ActivesEnabled returns the active profiles loaded from the zip file that are enabled.

func (ZipProvider) From

func (zp ZipProvider) From() []string

From returns the locations of the profiles loaded from the zip file.

func (ZipProvider) PassiveReqs

func (zp ZipProvider) PassiveReqs() []*Request

PassiveReqs returns the passive request profiles loaded from the zip file.

func (ZipProvider) PassiveReqsEnabled

func (zp ZipProvider) PassiveReqsEnabled() []*Request

PassiveReqsEnabled returns the passive request profiles loaded from the zip file that are enabled.

func (ZipProvider) PassiveRes

func (zp ZipProvider) PassiveRes() []*Response

PassiveRes returns the passive response profiles loaded from the zip file.

func (ZipProvider) PassiveResEnabled

func (zp ZipProvider) PassiveResEnabled() []*Response

PassiveResEnabled returns the passive response profiles loaded from the zip file that are enabled.

func (ZipProvider) Tags

func (zp ZipProvider) Tags() []string

Tags returns the tags of the profiles loaded from the zip file.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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