mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 13:09:49 -07:00
new: added session.stopped event (and fixed session.started event propagation)
This commit is contained in:
parent
fd160bf7ca
commit
22de9d3d4f
3 changed files with 5 additions and 4 deletions
|
@ -132,7 +132,7 @@ func (mod *EventsStream) Render(output io.Writer, e session.Event) {
|
||||||
mod.viewUpdateEvent(output, e)
|
mod.viewUpdateEvent(output, e)
|
||||||
} else if e.Tag == "gateway.change" {
|
} else if e.Tag == "gateway.change" {
|
||||||
mod.viewGatewayEvent(output, e)
|
mod.viewGatewayEvent(output, e)
|
||||||
} else if e.Tag != "tick" {
|
} else if e.Tag != "tick" && e.Tag != "session.started" && e.Tag != "session.stopped" {
|
||||||
fmt.Fprintf(output, "[%s] [%s] %v\n", e.Time.Format(mod.timeFormat), tui.Green(e.Tag), e)
|
fmt.Fprintf(output, "[%s] [%s] %v\n", e.Time.Format(mod.timeFormat), tui.Green(e.Tag), e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,9 +306,7 @@ func (s *Session) Start() error {
|
||||||
|
|
||||||
s.startNetMon()
|
s.startNetMon()
|
||||||
|
|
||||||
if *s.Options.Debug {
|
s.Events.Add("session.started", nil)
|
||||||
s.Events.Add("session.started", nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
// register js functions here to avoid cyclic dependency between
|
// register js functions here to avoid cyclic dependency between
|
||||||
// js and session
|
// js and session
|
||||||
|
|
|
@ -155,6 +155,9 @@ func (s *Session) activeHandler(args []string, sess *Session) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Session) exitHandler(args []string, sess *Session) error {
|
func (s *Session) exitHandler(args []string, sess *Session) error {
|
||||||
|
// notify any listener that the session is about to end
|
||||||
|
s.Events.Add("session.stopped", nil)
|
||||||
|
|
||||||
for _, mod := range s.Modules {
|
for _, mod := range s.Modules {
|
||||||
if mod.Running() {
|
if mod.Running() {
|
||||||
mod.Stop()
|
mod.Stop()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue