resturp

package
v0.0.0-...-09ba4a7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnexpectedStatusCodeReceived is returned when a http request
	// response does not match expected status code.
	ErrUnexpectedStatusCodeReceived = errors.New("unexpected status code received")

	// ErrGraphQLResponse is returned when a http request to the Burp GraphQL
	// API respond with a formatted error.
	ErrGraphQLResponse = errors.New("GraphQL API error response received")

	// ErrNoLocationHeader is returned when creating a Burp scan and
	// the scan ID is available in the location header response.
	ErrNoLocationHeader = errors.New("no location header received")
)
View Source
var (
	GraphQLQueryTemplate = `` /* 273-byte string literal not displayed */

)

Functions

This section is empty.

Types

type ApplicationLogin

type ApplicationLogin struct {
	Password string `json:"password,omitempty"`
	Username string `json:"username,omitempty"`
}

ApplicationLogin defines credentials to be used in a scan.

type Doer

type Doer interface {
	Do(*http.Request) (*http.Response, error)
}

Doer contains the methods needed by Resturp in order to make http client calls.

type Evidence

type Evidence struct {
	Detail struct {
		BandFlags []string `json:"band_flags"`
		Payload   struct {
			Bytes string `json:"bytes"`
			Flags int64  `json:"flags"`
		} `json:"payload"`
	} `json:"detail"`
	RequestResponse struct {
		Request []struct {
			Data   string `json:"data"`
			Length int64  `json:"length"`
			Type   string `json:"type"`
		} `json:"request"`
		RequestTime string `json:"request_time"`
		Response    []struct {
			Data   string `json:"data"`
			Length int64  `json:"length"`
			Type   string `json:"type"`
		} `json:"response"`
		URL                 string `json:"url"`
		WasRedirectFollowed bool   `json:"was_redirect_followed"`
	} `json:"request_response"`
	Type string `json:"type"`
}

type GraphQLErrorResponse

type GraphQLErrorResponse struct {
	Errors []struct {
		Message    string `json:"message"`
		Extensions struct {
			Code int `json:"code"`
		} `json:"extensions"`
	} `json:"errors"`
}

GraphQLErrorResponse defines the Burp GrapQL API error response structure.

type GraphQLQueryTemplateParams

type GraphQLQueryTemplateParams struct {
	OperationName         string
	VariablesInputID      uint
	QueryMutationFunction string
}

type Issue

type Issue struct {
	Caption      string     `json:"caption"`
	Confidence   string     `json:"confidence"`
	Description  string     `json:"description"`
	Evidence     []Evidence `json:"evidence"`
	InternalData string     `json:"internal_data"`
	Name         string     `json:"name"`
	Origin       string     `json:"origin"`
	Path         string     `json:"path"`
	SerialNumber string     `json:"serial_number"`
	Severity     string     `json:"severity"`
	TypeIndex    int64      `json:"type_index"`
}

type IssueDefinition

type IssueDefinition struct {
	IssueTypeID                  string `json:"issue_type_id"`
	Name                         string `json:"name"`
	Description                  string `json:"description"`
	Remediation                  string `json:"remediation"`
	References                   string `json:"references"`
	VulnerabilityClassifications string `json:"vulnerability_classifications"`
}

type IssueEvent

type IssueEvent struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Issue Issue  `json:"issue"`
}

type Resturp

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

Resturp is a client for the Burp scanner rest API.

func New

func New(d Doer, burpBaseURL string, APIKey string, logger *log.Entry) (*Resturp, error)

New returns a ready to use Burp REST client. The burpRESTURL must have the form: https://hostname:port.

func (*Resturp) CancelScan

func (r *Resturp) CancelScan(ctx context.Context, ID uint)

CancelScan cancels the scan with the given id.

func (*Resturp) DeleteScan

func (r *Resturp) DeleteScan(ctx context.Context, ID uint)

DeleteScan deletes the scan with the given id.

func (*Resturp) GetIssueDefinitions

func (r *Resturp) GetIssueDefinitions(ctx context.Context) ([]IssueDefinition, error)

GetIssueDefinitions gets the current defined issues in burp.

func (*Resturp) GetScanStatus

func (r *Resturp) GetScanStatus(ctx context.Context, ID uint) (*ScanStatus, error)

GetScanStatus returns the status of a scan.

func (*Resturp) LaunchScan

func (r *Resturp) LaunchScan(ctx context.Context, targetURL string, configs []string) (uint, error)

LaunchScan runs a new scan using the specified configurations against the given target url. The configurations must exist in the Burp library, for instance: "Minimize false positives". It returns the id of the created scan.

type Scan

type Scan struct {
	ApplicationLogins  []ApplicationLogin  `json:"application_logins,omitempty"`
	Name               string              `json:"name,omitempty"`
	ResourcePool       string              `json:"resource_pool,omitempty"`
	ScanCallback       *ScanCallback       `json:"scan_callback,omitempty"`
	ScanConfigurations []ScanConfiguration `json:"scan_configurations,omitempty"`
	Scope              *Scope              `json:"scope,omitempty"`
	Urls               []string            `json:"urls"`
}

Scan defines the information required by the BURP API to create a scan.

type ScanCallback

type ScanCallback struct {
	URL string `json:"url,omitempty"`
}

ScanCallback defines a url to be call when the scan finishes.

type ScanConfiguration

type ScanConfiguration struct {
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
}

ScanConfiguration defines a named configuration to be used in a scan. The configuration must be present in the Burp scan configuration library. The type parameter must be set to NamedConfiguration.

type ScanPayloadError

type ScanPayloadError struct {
	Type string
	Err  string `json:"error"`
}

ScanPayloadError defines the info returned by burp when there is controlled error creating a scan.

func (ScanPayloadError) Error

func (s ScanPayloadError) Error() string

type ScanStatus

type ScanStatus struct {
	TaskID      string       `json:"task_id"`
	Status      string       `json:"scan_status"`
	IssueEvents []IssueEvent `json:"issue_events"`
}

ScanStatus defines the info returned by the Burp API when querying the status of a scan.

type Scope

type Scope struct {
	Exclude []struct {
		Rule string `json:"rule,omitempty"`
	} `json:"exclude,omitempty"`
	Include []struct {
		Rule string `json:"rule,omitempty"`
	} `json:"include,omitempty"`
	Type string `json:"type,omitempty"`
}

Scope defines rules to include or exclude url's in a web scan.

Jump to

Keyboard shortcuts

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