fix: fixed a nil pointer dereference when wifi.show is called but the wifi module is not running (fixes #562)

This commit is contained in:
evilsocket 2019-05-01 12:27:52 +02:00
commit f8566d6020
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -10,6 +10,7 @@ import (
"github.com/bettercap/bettercap/modules/net_recon"
"github.com/bettercap/bettercap/network"
"github.com/bettercap/bettercap/session"
"github.com/dustin/go-humanize"
@ -315,6 +316,10 @@ func (mod *WiFiModule) showStatusBar() {
}
func (mod *WiFiModule) Show() (err error) {
if mod.Running() == false {
return session.ErrAlreadyStopped(mod.Name())
}
var stations []*network.Station
if err, stations = mod.doSelection(); err != nil {
return
@ -343,8 +348,11 @@ func (mod *WiFiModule) Show() (err error) {
}
func (mod *WiFiModule) ShowWPS(bssid string) (err error) {
toShow := []*network.Station{}
if mod.Running() == false {
return session.ErrAlreadyStopped(mod.Name())
}
toShow := []*network.Station{}
if bssid == network.BroadcastMac {
for _, station := range mod.Session.WiFi.List() {
if station.HasWPS() {