proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package proxy provides the MITM HTTP/HTTPS proxy engine for bola.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImportHAR

func ImportHAR(harPath string, cfg *config.Config, db *graph.DB, v *vault.Vault) (int, error)

ImportHAR parses a HAR file and populates the resource graph.

func InScope

func InScope(path string, include, exclude []string) bool

InScope checks if a path matches the include/exclude filter patterns.

func MatchGlob

func MatchGlob(pattern, path string) bool

MatchGlob performs a simple glob-style path match. Supports * as a wildcard for one or more path segments.

func NormalizePath

func NormalizePath(path string) string

NormalizePath replaces ID-like segments with type placeholders.

Types

type HAR

type HAR struct {
	Log HARLog `json:"log"`
}

HAR is the top-level HAR 1.2 file structure.

type HARContent

type HARContent struct {
	Size     int    `json:"size"`
	MimeType string `json:"mimeType"`
	Text     string `json:"text"`
}

HARContent represents the response body.

type HARCookie

type HARCookie struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

HARCookie represents a cookie in the HAR entry.

type HAREntry

type HAREntry struct {
	Request  HARRequest  `json:"request"`
	Response HARResponse `json:"response"`
}

HAREntry represents a single HTTP exchange in a HAR file.

type HARHeader

type HARHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

HARHeader is a name-value header pair.

type HARLog

type HARLog struct {
	Version string     `json:"version"`
	Entries []HAREntry `json:"entries"`
}

HARLog contains the HAR entries.

type HARPost

type HARPost struct {
	MimeType string `json:"mimeType"`
	Text     string `json:"text"`
}

HARPost represents POST/PUT request body data.

type HARQuery

type HARQuery struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

HARQuery is a query string parameter.

type HARRequest

type HARRequest struct {
	Method      string      `json:"method"`
	URL         string      `json:"url"`
	Headers     []HARHeader `json:"headers"`
	QueryString []HARQuery  `json:"queryString"`
	PostData    *HARPost    `json:"postData,omitempty"`
	Cookies     []HARCookie `json:"cookies"`
}

HARRequest represents the request portion of a HAR entry.

type HARResponse

type HARResponse struct {
	Status  int         `json:"status"`
	Headers []HARHeader `json:"headers"`
	Content HARContent  `json:"content"`
}

HARResponse represents the response portion of a HAR entry.

type IDType

type IDType string

IDType represents the classification of an extracted object identifier.

const (
	IDTypeUUID    IDType = "uuid"
	IDTypeInteger IDType = "integer"
	IDTypeMongoID IDType = "mongoid"
	IDTypeHash    IDType = "hash"
)

func ClassifyID

func ClassifyID(val string) IDType

ClassifyID determines the type of an identifier string. Returns empty string if the value doesn't look like an ID.

type ObjectID

type ObjectID struct {
	Value    string // the actual ID value
	Type     IDType // uuid | integer | mongoid | hash
	Location string // path | query | body | header
	Key      string // the parameter or JSON key name
}

ObjectID represents an object identifier extracted from an HTTP exchange.

func ExtractAll

func ExtractAll(reqURL *url.URL, body []byte, respHeaders http.Header) []ObjectID

ExtractAll extracts all object IDs from a URL, response body, and headers.

func ExtractFromBody

func ExtractFromBody(body []byte, contentType string) []ObjectID

ExtractFromBody extracts object IDs from a response body.

func ExtractFromHeaders

func ExtractFromHeaders(headers http.Header) []ObjectID

ExtractFromHeaders extracts object IDs from HTTP response headers.

func ExtractFromURL

func ExtractFromURL(u *url.URL) []ObjectID

ExtractFromURL extracts object IDs from URL path segments and query parameters.

type Proxy

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

Proxy is a MITM HTTP/HTTPS proxy for traffic capture and resource graph building.

func New

func New(cfg *config.Config, db *graph.DB, v *vault.Vault) (*Proxy, error)

New creates a new MITM proxy engine.

func (*Proxy) Start

func (p *Proxy) Start() error

Start begins listening for proxy connections.

func (*Proxy) Stop

func (p *Proxy) Stop()

Stop gracefully shuts down the proxy server.

Jump to

Keyboard shortcuts

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