mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
new: http and https proxy modules can now define an onCommand callback to handle custom session commands (closes #182)
This commit is contained in:
parent
77f8e070bc
commit
86ba73f5bb
3 changed files with 59 additions and 5 deletions
|
@ -144,6 +144,13 @@ func (p *HTTPProxy) Configure(address string, proxyPort int, httpPort int, scrip
|
|||
|
||||
log.Debug("Applied redirection %s", p.Redirection.String())
|
||||
|
||||
p.sess.UnkCmdCallback = func(cmd string) bool {
|
||||
if p.Script != nil {
|
||||
return p.Script.OnCommand(cmd)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -323,6 +330,8 @@ func (p *HTTPProxy) Stop() error {
|
|||
p.Redirection = nil
|
||||
}
|
||||
|
||||
p.sess.UnkCmdCallback = nil
|
||||
|
||||
if p.isTLS == true {
|
||||
p.isRunning = false
|
||||
p.sniListener.Close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue