still working on #154

This commit is contained in:
evilsocket 2018-03-08 18:13:45 +01:00
commit 2d53890501
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
3 changed files with 70 additions and 3 deletions

View file

@ -0,0 +1,48 @@
package modules
import (
"net/http"
"sync"
// "strings"
// "github.com/bettercap/bettercap/core"
// "github.com/bettercap/bettercap/log"
"github.com/elazarl/goproxy"
)
type cookieTracker struct {
sync.RWMutex
set map[string]string
}
func NewCookieTracker() *cookieTracker {
return &cookieTracker{
set: make(map[string]string),
}
}
type SSLStripper struct {
Enabled bool
cookies *cookieTracker
}
func NewSSLStripper(enabled bool) *SSLStripper {
return &SSLStripper{
Enabled: enabled,
cookies: NewCookieTracker(),
}
}
// sslstrip preprocessing, takes care of:
//
// - patching / removing security related headers
// - making unknown session cookies expire
// - handling stripped domains
func (s *SSLStripper) Preprocess(req *http.Request, ctx *goproxy.ProxyCtx) (redir *http.Response) {
if s.Enabled == false {
return
}
return
}