mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
new: implemented http.proxy.injectjs and https.proxy.injectjs to inject javascript code, files or URLs without a proxy module
This commit is contained in:
parent
7839a90c82
commit
6c3157e9c4
4 changed files with 74 additions and 12 deletions
|
@ -33,6 +33,11 @@ func NewHttpProxy(s *session.Session) *HttpProxy {
|
|||
"",
|
||||
"Path of a proxy JS script."))
|
||||
|
||||
p.AddParam(session.NewStringParameter("http.proxy.injectjs",
|
||||
"",
|
||||
"",
|
||||
"URL, path or javascript code to inject into every HTML page."))
|
||||
|
||||
p.AddParam(session.NewBoolParameter("http.proxy.sslstrip",
|
||||
"false",
|
||||
"Enable or disable SSL stripping."))
|
||||
|
@ -71,6 +76,7 @@ func (p *HttpProxy) Configure() error {
|
|||
var httpPort int
|
||||
var scriptPath string
|
||||
var stripSSL bool
|
||||
var jsToInject string
|
||||
|
||||
if p.Running() {
|
||||
return session.ErrAlreadyStarted
|
||||
|
@ -84,9 +90,11 @@ func (p *HttpProxy) Configure() error {
|
|||
return err
|
||||
} else if err, stripSSL = p.BoolParam("http.proxy.sslstrip"); err != nil {
|
||||
return err
|
||||
} else if err, jsToInject = p.StringParam("http.proxy.injectjs"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return p.proxy.Configure(address, proxyPort, httpPort, scriptPath, stripSSL)
|
||||
return p.proxy.Configure(address, proxyPort, httpPort, scriptPath, jsToInject, stripSSL)
|
||||
}
|
||||
|
||||
func (p *HttpProxy) Start() error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue