mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 05:23:19 -07:00
new: new wifi.region and wifi.txpower parameters
This commit is contained in:
parent
2446cde2e1
commit
345c1f5d45
2 changed files with 52 additions and 6 deletions
|
@ -264,6 +264,15 @@ func FindInterface(name string) (*Endpoint, error) {
|
|||
return nil, ErrNoIfaces
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ActivateInterface(name string) error {
|
||||
if out, err := core.Exec("ifconfig", []string{name, "up"}); err != nil {
|
||||
return err
|
||||
|
@ -273,6 +282,15 @@ func ActivateInterface(name string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GatewayProvidedByUser(iface *Endpoint, gateway string) (*Endpoint, error) {
|
||||
Debug("GatewayProvidedByUser(%s) [cmd=%v opts=%v parser=%v]", gateway, IPv4RouteCmd, IPv4RouteCmdOpts, IPv4RouteParser)
|
||||
if IPv4Validator.MatchString(gateway) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue