mirror of
https://github.com/bettercap/bettercap
synced 2025-07-05 20:42:09 -07:00
Implement HTTP proxy script onEvent call.
This commit is contained in:
parent
159aed5080
commit
91f5213526
1 changed files with 10 additions and 0 deletions
|
@ -27,6 +27,8 @@ import (
|
|||
"github.com/evilsocket/islazy/log"
|
||||
"github.com/evilsocket/islazy/str"
|
||||
"github.com/evilsocket/islazy/tui"
|
||||
|
||||
"github.com/robertkrimen/otto"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -432,6 +434,14 @@ func (p *HTTPProxy) Start() {
|
|||
}
|
||||
|
||||
func (p *HTTPProxy) Stop() error {
|
||||
if p.Script != nil {
|
||||
if p.Script.Plugin.HasFunc("onExit") {
|
||||
if _, err := p.Script.Call("onExit"); err != nil {
|
||||
log.Error("Error while executing onExit callback: %s", "\nTraceback:\n "+err.(*otto.Error).String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if p.doRedirect && p.Redirection != nil {
|
||||
p.Debug("disabling redirection %s", p.Redirection.String())
|
||||
if err := p.Sess.Firewall.EnableRedirection(p.Redirection, false); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue