new: implemented channel hopping for wifi.recon module ( ref #53 )

This commit is contained in:
evilsocket 2018-02-17 02:41:10 +01:00
parent e1e2e33f57
commit a66f5fabbb
4 changed files with 87 additions and 2 deletions

View file

@ -1,8 +1,11 @@
package network
import (
"fmt"
"net"
"regexp"
"github.com/evilsocket/bettercap-ng/core"
)
// only matches gateway lines
@ -26,3 +29,13 @@ func IPv4RouteIsGateway(ifname string, tokens []string, f func(gateway string) (
func getInterfaceName(iface net.Interface) string {
return iface.Name
}
func SetInterfaceChannel(iface string, channel int) error {
out, err := core.Exec("iwconfig", []string{iface, "channel", fmt.Sprintf("%d", channel)})
if err != nil {
return err
} else if out != "" {
return fmt.Errorf("Unexpected output while setting interface %s to channel %d: %s", iface, channel, out)
}
return nil
}