From 87171cbd1d57c3f7922d4acd25702bf654248146 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Tue, 19 Feb 2019 22:48:08 +0100 Subject: [PATCH 1/3] fix: fixed compilation error on macOS (fixes #453) --- network/ble_unsupported.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/network/ble_unsupported.go b/network/ble_unsupported.go index 0a22772f..9765fe9d 100644 --- a/network/ble_unsupported.go +++ b/network/ble_unsupported.go @@ -48,3 +48,7 @@ func (b *BLE) MarshalJSON() ([]byte, error) { } return json.Marshal(doc) } + +func (b *BLE) EachDevice(cb func(mac string, d *BLEDevice)) { + +} From 871dfe3024dad88a49690461d17a711ff3a3e9fe Mon Sep 17 00:00:00 2001 From: evilsocket Date: Tue, 19 Feb 2019 22:55:23 +0100 Subject: [PATCH 2/3] Releasing v2.17 --- core/banner.go | 2 +- snapcraft.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/banner.go b/core/banner.go index 206b320b..bafbf803 100644 --- a/core/banner.go +++ b/core/banner.go @@ -2,7 +2,7 @@ package core const ( Name = "bettercap" - Version = "2.16" + Version = "2.17" Author = "Simone 'evilsocket' Margaritelli" Website = "https://bettercap.org/" ) diff --git a/snapcraft.yaml b/snapcraft.yaml index f5e79daf..18ce1a3d 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -1,5 +1,5 @@ name: bettercap -version: '2.16' +version: '2.17' summary: 802.11, BLE and Ethernet networks reconnaissance and MITM attacks tool. description: | The Swiss Army knife for 802.11, BLE and Ethernet networks reconnaissance and MITM attacks. From c234f3d36bd3d2a00e56d0812ad239a65c831e8f Mon Sep 17 00:00:00 2001 From: evilsocket Date: Wed, 20 Feb 2019 12:27:01 +0100 Subject: [PATCH 3/3] fix: fixes 'iw executable not found in path' error on macOS (fixes #454) --- core/core.go | 7 +++++++ network/net.go | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/core/core.go b/core/core.go index b3b6436d..f79e6ffc 100644 --- a/core/core.go +++ b/core/core.go @@ -27,6 +27,13 @@ func UniqueInts(a []int, sorted bool) []int { return uniq } +func HasBinary(executable string) bool { + if path, err := exec.LookPath(executable); err != nil || path == "" { + return false + } + return true +} + func ExecSilent(executable string, args []string) (string, error) { path, err := exec.LookPath(executable) if err != nil { diff --git a/network/net.go b/network/net.go index 1c717bde..37123537 100644 --- a/network/net.go +++ b/network/net.go @@ -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 }