mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
new: implemented (http|https).proxy.whitelist and (http|https).proxy.blacklist parameters (closes #508)
This commit is contained in:
parent
6785650887
commit
cfd93c555a
4 changed files with 118 additions and 55 deletions
|
@ -2,6 +2,8 @@ package http_proxy
|
|||
|
||||
import (
|
||||
"github.com/bettercap/bettercap/session"
|
||||
|
||||
"github.com/evilsocket/islazy/str"
|
||||
)
|
||||
|
||||
type HttpProxy struct {
|
||||
|
@ -38,6 +40,12 @@ func NewHttpProxy(s *session.Session) *HttpProxy {
|
|||
"",
|
||||
"URL, path or javascript code to inject into every HTML page."))
|
||||
|
||||
mod.AddParam(session.NewStringParameter("http.proxy.blacklist", "", "",
|
||||
"Comma separated list of hostnames to skip while proxying (wildcard expressions can be used)."))
|
||||
|
||||
mod.AddParam(session.NewStringParameter("http.proxy.whitelist", "", "",
|
||||
"Comma separated list of hostnames to proxy if the blacklist is used (wildcard expressions can be used)."))
|
||||
|
||||
mod.AddParam(session.NewBoolParameter("http.proxy.sslstrip",
|
||||
"false",
|
||||
"Enable or disable SSL stripping."))
|
||||
|
@ -77,6 +85,8 @@ func (mod *HttpProxy) Configure() error {
|
|||
var scriptPath string
|
||||
var stripSSL bool
|
||||
var jsToInject string
|
||||
var blacklist string
|
||||
var whitelist string
|
||||
|
||||
if mod.Running() {
|
||||
return session.ErrAlreadyStarted
|
||||
|
@ -92,8 +102,15 @@ func (mod *HttpProxy) Configure() error {
|
|||
return err
|
||||
} else if err, jsToInject = mod.StringParam("http.proxy.injectjs"); err != nil {
|
||||
return err
|
||||
} else if err, blacklist = mod.StringParam("http.proxy.blacklist"); err != nil {
|
||||
return err
|
||||
} else if err, whitelist = mod.StringParam("http.proxy.whitelist"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mod.proxy.Blacklist = str.Comma(blacklist)
|
||||
mod.proxy.Whitelist = str.Comma(whitelist)
|
||||
|
||||
return mod.proxy.Configure(address, proxyPort, httpPort, scriptPath, jsToInject, stripSSL)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue