mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
fix: fixes 'iw executable not found in path' error on macOS (fixes #454)
This commit is contained in:
parent
871dfe3024
commit
c234f3d36b
2 changed files with 19 additions and 8 deletions
|
@ -265,10 +265,12 @@ func FindInterface(name string) (*Endpoint, error) {
|
|||
}
|
||||
|
||||
func SetWiFiRegion(region string) error {
|
||||
if out, err := core.Exec("iw", []string{"reg", "set", region}); err != nil {
|
||||
return err
|
||||
} else if out != "" {
|
||||
return fmt.Errorf("unexpected output while setting WiFi region %s: %s", region, out)
|
||||
if core.HasBinary("iw") {
|
||||
if out, err := core.Exec("iw", []string{"reg", "set", region}); err != nil {
|
||||
return err
|
||||
} else if out != "" {
|
||||
return fmt.Errorf("unexpected output while setting WiFi region %s: %s", region, out)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -283,10 +285,12 @@ func ActivateInterface(name string) error {
|
|||
}
|
||||
|
||||
func SetInterfaceTxPower(name string, txpower int) error {
|
||||
if out, err := core.ExecSilent("iwconfig", []string{name, "txpower", fmt.Sprintf("%d", txpower)}); err != nil {
|
||||
return err
|
||||
} else if out != "" {
|
||||
return fmt.Errorf("unexpected output while setting txpower to %d for interface %s: %s", txpower, name, out)
|
||||
if core.HasBinary("iwconfig") {
|
||||
if out, err := core.ExecSilent("iwconfig", []string{name, "txpower", fmt.Sprintf("%d", txpower)}); err != nil {
|
||||
return err
|
||||
} else if out != "" {
|
||||
return fmt.Errorf("unexpected output while setting txpower to %d for interface %s: %s", txpower, name, out)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue