Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CookieTracker

type CookieTracker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCookieTracker

func NewCookieTracker() *CookieTracker

func (*CookieTracker) Expire

func (t *CookieTracker) Expire(req *http.Request) *http.Response

func (*CookieTracker) IsClean

func (t *CookieTracker) IsClean(req *http.Request) bool

func (*CookieTracker) Track

func (t *CookieTracker) Track(req *http.Request)

type HTTPProxy

type HTTPProxy struct {
	Name        string
	Address     string
	Server      *http.Server
	Redirection *firewall.Redirection
	Proxy       *goproxy.ProxyHttpServer
	Script      *HttpProxyScript
	CertFile    string
	KeyFile     string
	Blacklist   []string
	Whitelist   []string
	// contains filtered or unexported fields
}

func NewHTTPProxy

func NewHTTPProxy(s *session.Session) *HTTPProxy

func (*HTTPProxy) Configure

func (p *HTTPProxy) Configure(address string, proxyPort int, httpPort int, scriptPath string, jsToInject string, stripSSL bool) error

func (*HTTPProxy) ConfigureTLS

func (p *HTTPProxy) ConfigureTLS(address string, proxyPort int, httpPort int, scriptPath string, certFile string, keyFile string, jsToInject string, stripSSL bool) (err error)

func (*HTTPProxy) Debug

func (p *HTTPProxy) Debug(format string, args ...interface{})

func (*HTTPProxy) Error

func (p *HTTPProxy) Error(format string, args ...interface{})

func (*HTTPProxy) Fatal

func (p *HTTPProxy) Fatal(format string, args ...interface{})

func (*HTTPProxy) Info

func (p *HTTPProxy) Info(format string, args ...interface{})

func (*HTTPProxy) Start

func (p *HTTPProxy) Start()

func (*HTTPProxy) Stop

func (p *HTTPProxy) Stop() error

func (*HTTPProxy) TLSConfigFromCA

func (p *HTTPProxy) TLSConfigFromCA(ca *tls.Certificate) func(host string, ctx *goproxy.ProxyCtx) (*tls.Config, error)

func (*HTTPProxy) Warning

func (p *HTTPProxy) Warning(format string, args ...interface{})

type Host

type Host struct {
	Hostname string
	Address  net.IP
	Resolved sync.WaitGroup
}

func NewHost

func NewHost(name string) *Host

type HostTracker

type HostTracker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewHostTracker

func NewHostTracker() *HostTracker

func (*HostTracker) Track

func (t *HostTracker) Track(host, stripped string)

func (*HostTracker) Unstrip

func (t *HostTracker) Unstrip(stripped string) *Host

type HttpProxy

type HttpProxy struct {
	session.SessionModule
	// contains filtered or unexported fields
}

func NewHttpProxy

func NewHttpProxy(s *session.Session) *HttpProxy

func (*HttpProxy) Author

func (mod *HttpProxy) Author() string

func (*HttpProxy) Configure

func (mod *HttpProxy) Configure() error

func (*HttpProxy) Description

func (mod *HttpProxy) Description() string

func (*HttpProxy) Name

func (mod *HttpProxy) Name() string

func (*HttpProxy) Start

func (mod *HttpProxy) Start() error

func (*HttpProxy) Stop

func (mod *HttpProxy) Stop() error

type HttpProxyScript

type HttpProxyScript struct {
	*plugin.Plugin
	// contains filtered or unexported fields
}

func LoadHttpProxyScript

func LoadHttpProxyScript(path string, sess *session.Session) (err error, s *HttpProxyScript)

func (*HttpProxyScript) OnCommand

func (s *HttpProxyScript) OnCommand(cmd string) bool

func (*HttpProxyScript) OnRequest

func (s *HttpProxyScript) OnRequest(original *http.Request) (jsreq *JSRequest, jsres *JSResponse)

func (*HttpProxyScript) OnResponse

func (s *HttpProxyScript) OnResponse(res *http.Response) (jsreq *JSRequest, jsres *JSResponse)

type JSRequest

type JSRequest struct {
	Client      map[string]string
	Method      string
	Version     string
	Scheme      string
	Path        string
	Query       string
	Hostname    string
	ContentType string
	Headers     string
	Body        string
	// contains filtered or unexported fields
}

func NewJSRequest

func NewJSRequest(req *http.Request) *JSRequest

func (*JSRequest) GetHeader

func (j *JSRequest) GetHeader(name, deflt string) string

func (*JSRequest) NewHash

func (j *JSRequest) NewHash() string

func (*JSRequest) ParseForm

func (j *JSRequest) ParseForm() map[string]string

func (*JSRequest) ReadBody

func (j *JSRequest) ReadBody() string

func (*JSRequest) RemoveHeader

func (j *JSRequest) RemoveHeader(name string)

func (*JSRequest) SetHeader

func (j *JSRequest) SetHeader(name, value string)

func (*JSRequest) ToRequest

func (j *JSRequest) ToRequest() (req *http.Request)

func (*JSRequest) UpdateHash

func (j *JSRequest) UpdateHash()

func (*JSRequest) WasModified

func (j *JSRequest) WasModified() bool

type JSResponse

type JSResponse struct {
	Status      int
	ContentType string
	Headers     string
	Body        string
	// contains filtered or unexported fields
}

func NewJSResponse

func NewJSResponse(res *http.Response) *JSResponse

func (*JSResponse) ClearBody

func (j *JSResponse) ClearBody()

func (*JSResponse) GetHeader

func (j *JSResponse) GetHeader(name, deflt string) string

func (*JSResponse) NewHash

func (j *JSResponse) NewHash() string

func (*JSResponse) ReadBody

func (j *JSResponse) ReadBody() string

func (*JSResponse) RemoveHeader

func (j *JSResponse) RemoveHeader(name string)

func (*JSResponse) SetHeader

func (j *JSResponse) SetHeader(name, value string)

func (*JSResponse) ToResponse

func (j *JSResponse) ToResponse(req *http.Request) (resp *http.Response)

func (*JSResponse) UpdateHash

func (j *JSResponse) UpdateHash()

func (*JSResponse) WasModified

func (j *JSResponse) WasModified() bool

type SSLStripper

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

func NewSSLStripper

func NewSSLStripper(s *session.Session, enabled bool) *SSLStripper

func (*SSLStripper) Enable

func (s *SSLStripper) Enable(enabled bool)

func (*SSLStripper) Enabled

func (s *SSLStripper) Enabled() bool

func (*SSLStripper) Preprocess

func (s *SSLStripper) Preprocess(req *http.Request, ctx *goproxy.ProxyCtx) (redir *http.Response)

    sslstrip preprocessing, takes care of:

    - handling stripped domains - making unknown session cookies expire

    func (*SSLStripper) Process

    func (s *SSLStripper) Process(res *http.Response, ctx *goproxy.ProxyCtx)