new: wifi.recon will activate the interface if it's down instead of failing

This commit is contained in:
evilsocket 2019-02-06 09:42:48 +01:00
commit 003139a2e3
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
3 changed files with 55 additions and 24 deletions

View file

@ -7,6 +7,8 @@ import (
"regexp"
"strings"
"github.com/bettercap/bettercap/core"
"github.com/evilsocket/islazy/data"
"github.com/evilsocket/islazy/str"
@ -256,3 +258,12 @@ func FindInterface(name string) (*Endpoint, error) {
return nil, ErrNoIfaces
}
func ActivateInterface(name string) error {
if out, err := core.Exec("ifconfig", []string{name, "up"}); err != nil {
return err
} else if out != "" {
return fmt.Errorf("unexpected output while activating interface %s: %s", name, out)
}
return nil
}