mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
new: implemented channel hopping for wifi.recon module ( ref #53 )
This commit is contained in:
parent
e1e2e33f57
commit
a66f5fabbb
4 changed files with 87 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue