started working on #154

This commit is contained in:
evilsocket 2018-03-08 17:37:55 +01:00
parent 1a8826436e
commit 741d9d8f6e
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
4 changed files with 125 additions and 91 deletions

View file

@ -31,6 +31,10 @@ func NewHttpsProxy(s *session.Session) *HttpsProxy {
"8083",
"Port to bind the HTTPS proxy to."))
p.AddParam(session.NewBoolParameter("https.proxy.sslstrip",
"true",
"Enable or disable SSL stripping."))
p.AddParam(session.NewStringParameter("https.proxy.certificate",
"~/.bettercap-ca.cert.pem",
"",
@ -81,36 +85,27 @@ func (p *HttpsProxy) Configure() error {
var scriptPath string
var certFile string
var keyFile string
var stripSSL bool
if p.Running() == true {
return session.ErrAlreadyStarted
}
if err, address = p.StringParam("https.proxy.address"); err != nil {
} else if err, address = p.StringParam("https.proxy.address"); err != nil {
return err
}
if err, proxyPort = p.IntParam("https.proxy.port"); err != nil {
} else if err, proxyPort = p.IntParam("https.proxy.port"); err != nil {
return err
}
if err, httpPort = p.IntParam("https.port"); err != nil {
} else if err, httpPort = p.IntParam("https.port"); err != nil {
return err
}
if err, certFile = p.StringParam("https.proxy.certificate"); err != nil {
} else if err, stripSSL = p.BoolParam("https.proxy.sslstrip"); err != nil {
return err
} else if err, certFile = p.StringParam("https.proxy.certificate"); err != nil {
return err
} else if certFile, err = core.ExpandPath(certFile); err != nil {
return err
}
if err, keyFile = p.StringParam("https.proxy.key"); err != nil {
} else if err, keyFile = p.StringParam("https.proxy.key"); err != nil {
return err
} else if keyFile, err = core.ExpandPath(keyFile); err != nil {
return err
}
if err, scriptPath = p.StringParam("https.proxy.script"); err != nil {
} else if err, scriptPath = p.StringParam("https.proxy.script"); err != nil {
return err
}
@ -125,7 +120,7 @@ func (p *HttpsProxy) Configure() error {
log.Info("Loading proxy certification authority TLS certificate from %s", certFile)
}
return p.proxy.ConfigureTLS(address, proxyPort, httpPort, scriptPath, certFile, keyFile)
return p.proxy.ConfigureTLS(address, proxyPort, httpPort, scriptPath, certFile, keyFile, stripSSL)
}
func (p *HttpsProxy) Start() error {