mitm

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToProxyResponse

func ToProxyResponse(pRes proxyadapters.ResponseReaderAdapter, acceptEncodingHeader string) (*px.Response, error)

ToProxyResponse converts a ProxyResponse into a MITM proxy response object with body encoding matching the new request's acceptEncodingHeader. Since all responses are stored as uncompressed strings, the cached response might need to be encoded before being sent. This function encodes the response body based on the requested acceptEncodingHeader argument.

Types

type ConnectionStatsAdapter

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

ConnectionStatsAdapter is an adapter for the connection stats object

func NewProxyConnectionStatsAdapter

func NewProxyConnectionStatsAdapter(f *px.Flow) *ConnectionStatsAdapter

NewProxyConnectionStatsAdapter creates a new connection stats adapter object

func (*ConnectionStatsAdapter) GetClientIP

func (cs *ConnectionStatsAdapter) GetClientIP() string

GetClientIP returns the client IP address, to implement the ConnectionStatsReaderAdapter interface

func (*ConnectionStatsAdapter) GetProxyID

func (cs *ConnectionStatsAdapter) GetProxyID() string

GetProxyID returns the proxy ID, to implement the ConnectionStatsReaderAdapter interface

func (*ConnectionStatsAdapter) GetRequestURL

func (cs *ConnectionStatsAdapter) GetRequestURL() string

GetRequestURL returns the request URL, to implement the ConnectionStatsReaderAdapter interface

type FlowAdapter

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

FlowAdapter implements the proxyAdapters.ProxyFlowReaderAdapter interface

func NewFlowAdapter

func NewFlowAdapter(flow *px.Flow) *FlowAdapter

NewFlowAdapter creates a new flow adapter object

func (*FlowAdapter) GetConnectionStats

func (fa *FlowAdapter) GetConnectionStats() proxyadapters.ConnectionStatsReaderAdapter

GetConnectionStats returns the connection stats adapter, to implement the FlowReaderAdapter interface

func (*FlowAdapter) GetRequest

GetRequest returns the request adapter, to implement the FlowReaderAdapter interface

func (*FlowAdapter) GetResponse

GetResponse returns the response adapter, to implement the FlowReaderAdapter interface

func (*FlowAdapter) SetFlow

func (fa *FlowAdapter) SetFlow(flow *px.Flow)

SetFlow sets the connectionStats, request, and response (but only if the request and response weren't previously set). If SetRequest or SetResponse was run before this, the request/response in this flow will be ignored.

func (*FlowAdapter) SetRequest

func (fa *FlowAdapter) SetRequest(req *px.Request)

SetRequest copies the request, to keep the original flow

func (*FlowAdapter) SetResponse

func (fa *FlowAdapter) SetResponse(res *px.Response)

SetResponse copies the response, to keep the original flow

type ProxyRequestAdapter

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

ProxyRequestAdapter is a RequestAdapter implementation for mitmproxy requests

func NewProxyRequestAdapter

func NewProxyRequestAdapter(pxReq *px.Request) *ProxyRequestAdapter

NewProxyRequestAdapter creates a new request adapter object

func (*ProxyRequestAdapter) GetBodyBytes

func (r *ProxyRequestAdapter) GetBodyBytes() []byte

GetBodyBytes returns the request body, to implement the RequestReaderAdapter interface

func (*ProxyRequestAdapter) GetHeaders

func (r *ProxyRequestAdapter) GetHeaders() http.Header

GetHeaders returns the headers, to implement the RequestReaderAdapter interface

func (*ProxyRequestAdapter) GetMethod

func (r *ProxyRequestAdapter) GetMethod() string

GetMethod returns the HTTP request method, to implement the RequestReaderAdapter interface

func (*ProxyRequestAdapter) GetProto

func (r *ProxyRequestAdapter) GetProto() string

GetProto returns the HTTP protocol version, to implement the RequestReaderAdapter interface

func (*ProxyRequestAdapter) GetURL

func (r *ProxyRequestAdapter) GetURL() *url.URL

GetURL returns the request URL, to implement the RequestReaderAdapter interface

type ProxyResponseAdapter

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

ProxyResponseAdapter implements the proxyAdapters.ResponseReaderAdapter interface

func NewProxyResponseAdapter

func NewProxyResponseAdapter(pxResp *px.Response) *ProxyResponseAdapter

NewProxyResponseAdapter creates a new response adapter object

func (*ProxyResponseAdapter) GetBodyBytes

func (r *ProxyResponseAdapter) GetBodyBytes() []byte

GetBodyBytes returns the response body, to implement the ResponseReaderAdapter interface

func (*ProxyResponseAdapter) GetHeaders

func (r *ProxyResponseAdapter) GetHeaders() http.Header

GetHeaders returns the headers, to implement the ResponseReaderAdapter interface

func (*ProxyResponseAdapter) GetStatusCode

func (r *ProxyResponseAdapter) GetStatusCode() int

GetStatusCode returns the status code, to implement the ResponseReaderAdapter interface

Jump to

Keyboard shortcuts

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