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@2f3390cf36 which was a fix for issue bettercap/bettercap#657 due to maybe the code not being tested extensively.
This commit is contained in:
skooch 2020-03-19 14:30:27 +11:00 committed by GitHub
commit 140f33109f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}