Documentation
¶
Overview ¶
Package injection models injection points (parameters, body fields, headers, cookies, path segments and explicit `*` markers) and renders per-test requests from a base request.
Index ¶
Constants ¶
const ( TypeGET = "GET" TypePOST = "POST" TypeJSON = "JSON" TypeXML = "XML" TypeHeader = "HEADER" TypeCookie = "COOKIE" TypePath = "PATH" TypeMarker = "MARKER" )
Point types.
const Marker = "*"
Marker is the character a user embeds in a URL, header or body to force an injection position.
Variables ¶
var ( // ErrMalformedRawRequest indicates a Burp-style request file could not be // parsed. ErrMalformedRawRequest = errors.New("malformed raw request") // ErrUnsupportedMethod indicates the request line used a method the // engine will not replay. ErrUnsupportedMethod = errors.New("unsupported HTTP method in raw request") )
var ErrNoInjectionPoints = errors.New("no injectable parameters or markers found")
ErrNoInjectionPoints is returned when nothing can receive a payload.
Functions ¶
This section is empty.
Types ¶
type InjectionPoint ¶
type InjectionPoint struct {
Type string
Name string
Value string
Location string
// contains filtered or unexported fields
}
InjectionPoint is one location that can receive a payload, with closures to materialise an injected request and the clean baseline request.
func Enumerate ¶
func Enumerate(rs RequestSource, opts Options) ([]*InjectionPoint, error)
Enumerate finds every injectable position in the request and returns the points in deterministic order. Markers take precedence: when any `*` is present, only marker points are produced.
func (*InjectionPoint) Render ¶
func (p *InjectionPoint) Render(value string) *RenderedRequest
Render returns the request with value injected at this point.
func (*InjectionPoint) RenderBase ¶
func (p *InjectionPoint) RenderBase() *RenderedRequest
RenderBase returns the clean request with all markers emptied and no injection applied.
type RawRequest ¶
RawRequest is the parsed form of a Burp-style request file.
func ParseRaw ¶
func ParseRaw(data []byte, tls bool) (*RawRequest, error)
ParseRaw parses a Burp-style raw HTTP request. Line endings are handled for both \r\n and bare \n. Errors carry the offending line number.
func (*RawRequest) AbsoluteURL ¶
func (r *RawRequest) AbsoluteURL(tls bool) string
AbsoluteURL reconstructs a full URL (scheme derived from tls, host from the Host header, target as typed). It returns "" when host parsing fails.
func (*RawRequest) Host ¶
func (r *RawRequest) Host() string
Host extracts the Host header value, if present.
type RenderedRequest ¶
RenderedRequest is a fully materialised request ready to be sent.
type RequestSource ¶
RequestSource describes the request that will be scanned for points.
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template is a string with zero or more * markers. Render keeps one marker populated and empties the rest, so each marker is exercised independently while the document stays syntactically valid.
func NewTemplate ¶
NewTemplate splits raw on the marker character, preserving empties so that round-tripping reconstructs the original exactly.
func (*Template) HasMarkers ¶
HasMarkers reports whether the template contains at least one marker.
func (*Template) Render ¶
Render returns the template with the marker at idx replaced by value and every other marker emptied.
func (*Template) RenderAllEmpty ¶
RenderAllEmpty returns the template with every marker emptied. This is used for the clean (baseline) request when markers are present.