mirror of
https://github.com/bettercap/bettercap
synced 2025-07-11 23:57:01 -07:00
fix: fixed a crash when net.sniff stats was called and sniffer was off
This commit is contained in:
parent
c75d4c391b
commit
be56b1ed7b
1 changed files with 3 additions and 2 deletions
|
@ -49,11 +49,12 @@ func NewSniffer(s *session.Session) *Sniffer {
|
||||||
sniff.AddHandler(session.NewModuleHandler("net.sniff stats", "",
|
sniff.AddHandler(session.NewModuleHandler("net.sniff stats", "",
|
||||||
"Print sniffer session configuration and statistics.",
|
"Print sniffer session configuration and statistics.",
|
||||||
func(args []string) error {
|
func(args []string) error {
|
||||||
sniff.Ctx.Log(sniff.Session)
|
|
||||||
|
|
||||||
if sniff.Stats == nil {
|
if sniff.Stats == nil {
|
||||||
return fmt.Errorf("No stats yet.")
|
return fmt.Errorf("No stats yet.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sniff.Ctx.Log(sniff.Session)
|
||||||
|
|
||||||
return sniff.Stats.Print()
|
return sniff.Stats.Print()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue