http

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoScheme

func AutoScheme(target string) string

AutoScheme probes HTTPS then falls back to HTTP if the target has no scheme.

func NormalizeURI

func NormalizeURI(parts ...string) string

NormalizeURI joins path segments cleanly.

func WithPool

func WithPool(ctx context.Context, threads int, proxyURL string) context.Context

WithPool returns a context carrying a shared HTTP transport.

Types

type Option

type Option func(*Session)

Option configures a Session.

func WithProxy

func WithProxy(proxyURL string) Option

WithProxy sets an HTTP/SOCKS5 proxy on the session transport.

func WithTransport

func WithTransport(t *nethttp.Transport) Option

WithTransport sets a shared transport for connection pooling.

type Request

type Request struct {
	Method      string
	Path        string
	Query       url.Values
	Form        url.Values
	Body        io.Reader
	ContentType string
	Headers     map[string]string
	Ctx         context.Context
	Timeout     time.Duration
	NoRedirect  bool
	NoCookies   bool
	BasicAuth   [2]string
	MaxBody     int64
}

Request describes a single HTTP request.

type Response

type Response struct {
	*nethttp.Response
	// contains filtered or unexported fields
}

Response wraps a standard http.Response with convenience methods for body parsing (HTML, JSON, raw text).

func WrapResponse

func WrapResponse(resp *nethttp.Response) *Response

WrapResponse wraps a standard *http.Response into a *Response.

func (*Response) BodyBytes

func (r *Response) BodyBytes() ([]byte, error)

BodyBytes reads the full response body and caches it.

func (*Response) BodyString

func (r *Response) BodyString() (string, error)

BodyString returns the response body as a string.

func (*Response) Contains

func (r *Response) Contains(substr string) bool

Contains checks whether the response body contains the given substring.

func (*Response) ContainsAll

func (r *Response) ContainsAll(substrs ...string) bool

ContainsAll checks whether the response body contains all given substrings.

func (*Response) ContainsAny

func (r *Response) ContainsAny(substrs ...string) bool

ContainsAny checks whether the response body contains at least one of the given substrings.

func (*Response) HTML

func (r *Response) HTML() (*goquery.Document, error)

HTML parses the response body as HTML and returns a goquery Document.

func (*Response) JSON

func (r *Response) JSON(target any) error

JSON unmarshals the response body into the given target.

type Run

type Run struct {
	Session   *Session
	Target    string
	TargetURI string
	Ctx       context.Context
}

Run binds a Session to a target for the duration of an exploit.

func FromModule

func FromModule(params sdk.Params, opts ...Option) *Run

FromModule creates a Run from module params.

func NewRun

func NewRun(ctx context.Context, target string, opts ...Option) *Run

NewRun creates a Run with a fresh session. Auto-detects scheme if missing.

func (*Run) Send

func (r *Run) Send(req Request) (*Response, error)

Send dispatches a request through the bound session. Path is joined to TargetURI.

type Session

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

Session is a persistent HTTP client shared across requests.

func NewSession

func NewSession(opts ...Option) *Session

NewSession creates a new HTTP session. TLS verification is disabled by default.

func (*Session) Get

func (s *Session) Get(target string) (*Response, error)

Get is a shortcut for GET requests.

func (*Session) PostForm

func (s *Session) PostForm(target string, data url.Values) (*Response, error)

PostForm is a shortcut for POST with form data.

func (*Session) Run

func (s *Session) Run(ctx context.Context, target string) *Run

Run binds this Session to a target.

func (*Session) Send

func (s *Session) Send(target string, req Request) (*Response, error)

Send builds and sends an HTTP request.

Jump to

Keyboard shortcuts

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