From 140f33109fd45d7ea3a4c7e0d9db7eb83f5ac4e8 Mon Sep 17 00:00:00 2001 From: skooch Date: Thu, 19 Mar 2020 14:30:27 +1100 Subject: [PATCH] Fix iw txpower syntax The syntax used to set the txpower is incorrect and misses the keyword "fixed", this results in wireless adapter drivers that only support iw failing to initialize within bettercap. This bug was introduced in commit bettercap/bettercap@2f3390cf363d3f2542e87359710b694ec3d386c8 which was a fix for issue bettercap/bettercap#657 due to maybe the code not being tested extensively. --- network/net.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/net.go b/network/net.go index 35d2510a..fe7e4c8a 100644 --- a/network/net.go +++ b/network/net.go @@ -287,7 +287,7 @@ func ActivateInterface(name string) error { func SetInterfaceTxPower(name string, txpower int) error { if core.HasBinary("iw") { Debug("SetInterfaceTxPower(%s, %d) iw based", name, txpower) - if _, err := core.Exec("iw", []string{"dev", name, "set", "txpower", fmt.Sprintf("%dmBm", + if _, err := core.Exec("iw", []string{"dev", name, "set", "txpower", "fixed", fmt.Sprintf("%dmBm", txpower)}); err != nil { return err }