mirror of
https://github.com/bettercap/bettercap
synced 2025-08-22 06:23:18 -07:00
Add ability to set channels using Nexmon
Nexmon firmware
This commit is contained in:
parent
8acf81f61d
commit
c7dc62e35e
1 changed files with 8 additions and 1 deletions
|
@ -40,7 +40,14 @@ func SetInterfaceChannel(iface string, channel int) error {
|
||||||
if curr == channel {
|
if curr == channel {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if core.HasBinary("nexutil") {
|
||||||
|
Debug("SetInterfaceChannel(%s, %d) nexutil based", iface, channel)
|
||||||
|
out, err := core.Exec("nexutil", []string{"-i -s 30 -v", 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)
|
||||||
|
}
|
||||||
if core.HasBinary("iw") {
|
if core.HasBinary("iw") {
|
||||||
Debug("SetInterfaceChannel(%s, %d) iw based", iface, channel)
|
Debug("SetInterfaceChannel(%s, %d) iw based", iface, channel)
|
||||||
out, err := core.Exec("iw", []string{"dev", iface, "set", "channel", fmt.Sprintf("%d", channel)})
|
out, err := core.Exec("iw", []string{"dev", iface, "set", "channel", fmt.Sprintf("%d", channel)})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue