mitm

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyDict   = NewResponseBody([]byte("{}"))
	EmptyArray  = NewResponseBody([]byte("[]"))
	OnePixelPNG = NewResponseBody([]byte{
		0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48,
		0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x06, 0x00, 0x00,
		0x00, 0x1f, 0x15, 0xc4, 0x89, 0x00, 0x00, 0x00, 0x11, 0x49, 0x44, 0x41, 0x54, 0x78,
		0x9c, 0x62, 0x62, 0x60, 0x60, 0x60, 0x00, 0x04, 0x00, 0x00, 0xff, 0xff, 0x00, 0x0f,
		0x00, 0x03, 0xfe, 0x8f, 0xeb, 0xcf, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44,
		0xae, 0x42, 0x60, 0x82,
	})
)

Functions

func CanRewriteBody

func CanRewriteBody(contentLength int64, contentEncoding, contentType string) bool

func ParseRewrite

func ParseRewrite(line string) (C.Rewrite, error)

Types

type Body

type Body interface {
	Body() io.ReadCloser
	ContentLength() int64
}

type ResponseBody

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

func NewResponseBody

func NewResponseBody(data []byte) *ResponseBody

func (*ResponseBody) Body

func (r *ResponseBody) Body() io.ReadCloser

func (*ResponseBody) ContentLength

func (r *ResponseBody) ContentLength() int64

type RewriteHandler

type RewriteHandler struct{}

func (*RewriteHandler) HandleApiRequest

func (h *RewriteHandler) HandleApiRequest(*C.MitmSession) bool

func (*RewriteHandler) HandleError

func (h *RewriteHandler) HandleError(*C.MitmSession, error)

HandleError session maybe nil

func (*RewriteHandler) HandleRequest

func (*RewriteHandler) HandleRequest(session *C.MitmSession) (*http.Request, *http.Response)

func (*RewriteHandler) HandleResponse

func (*RewriteHandler) HandleResponse(session *C.MitmSession) *http.Response

type RewriteRule

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

func NewRewriteRule

func NewRewriteRule(urlRegx *regexp.Regexp, ruleType C.RewriteType, ruleRegx []*regexp.Regexp, rulePayload []string) *RewriteRule

func (*RewriteRule) ReplaceSubPayload

func (r *RewriteRule) ReplaceSubPayload(oldData string) (string, bool)

func (*RewriteRule) ReplaceURLPayload

func (r *RewriteRule) ReplaceURLPayload(matchSub []string) string

func (*RewriteRule) RulePayload

func (r *RewriteRule) RulePayload() []string

func (*RewriteRule) RuleRegx

func (r *RewriteRule) RuleRegx() []*regexp.Regexp

func (*RewriteRule) RuleType

func (r *RewriteRule) RuleType() C.RewriteType

func (*RewriteRule) URLRegx

func (r *RewriteRule) URLRegx() *regexp.Regexp

type RewriteRules

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

func NewRewriteRules

func NewRewriteRules(req []C.Rewrite, res []C.Rewrite) *RewriteRules

func (*RewriteRules) SearchInRequest

func (rr *RewriteRules) SearchInRequest(do func(C.Rewrite) bool) bool

func (*RewriteRules) SearchInResponse

func (rr *RewriteRules) SearchInResponse(do func(C.Rewrite) bool) bool

Jump to

Keyboard shortcuts

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