fix: fixed a crash when net.sniff stats was called and sniffer was off

This commit is contained in:
evilsocket 2018-01-10 03:20:00 +01:00
parent c75d4c391b
commit be56b1ed7b

View file

@ -49,11 +49,12 @@ func NewSniffer(s *session.Session) *Sniffer {
sniff.AddHandler(session.NewModuleHandler("net.sniff stats", "",
"Print sniffer session configuration and statistics.",
func(args []string) error {
sniff.Ctx.Log(sniff.Session)
if sniff.Stats == nil {
return fmt.Errorf("No stats yet.")
}
sniff.Ctx.Log(sniff.Session)
return sniff.Stats.Print()
}))