From fd506b15335a622dbaaa18e7adbea4308f578c1c Mon Sep 17 00:00:00 2001 From: dadav <33197631+dadav@users.noreply.github.com> Date: Fri, 1 Nov 2019 21:42:02 +0100 Subject: [PATCH] Fix bt-tether config --- pwnagotchi/defaults.yml | 4 +++- pwnagotchi/plugins/default/bt-tether.py | 17 +++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pwnagotchi/defaults.yml b/pwnagotchi/defaults.yml index 501211d..0d7f9f7 100644 --- a/pwnagotchi/defaults.yml +++ b/pwnagotchi/defaults.yml @@ -73,6 +73,7 @@ main: enabled: false # if you want to use this, set ui.display.video.address to 0.0.0.0 devices: android-phone: + enabled: false search_order: 1 # search for this first mac: ~ # mac of your bluetooth device ip: '192.168.44.44' # ip from which your pwnagotchi should be reachable @@ -83,9 +84,10 @@ main: share_internet: false priority: 1 # low routing priority; ios (prio: 999) would win here ios-phone: + enabled: false search_order: 2 # search for this second mac: ~ # mac of your bluetooth device - ip: '172.20.10.2' # ip from which your pwnagotchi should be reachable + ip: '172.20.10.6' # ip from which your pwnagotchi should be reachable netmask: 24 interval: 5 # check every 5 minutes for device scantime: 20 diff --git a/pwnagotchi/plugins/default/bt-tether.py b/pwnagotchi/plugins/default/bt-tether.py index 4665fb8..36e9816 100644 --- a/pwnagotchi/plugins/default/bt-tether.py +++ b/pwnagotchi/plugins/default/bt-tether.py @@ -426,29 +426,30 @@ class BTTether(plugins.Plugin): self.devices = dict() def on_loaded(self): + # new config if 'devices' in self.options: for device, options in self.options['devices'].items(): - for device_opt in ['priority', 'scantime', 'search_order', 'max_tries', 'share_internet', 'mac', 'ip', 'netmask', 'interval']: + for device_opt in ['enabled', 'priority', 'scantime', 'search_order', 'max_tries', 'share_internet', 'mac', 'ip', 'netmask', 'interval']: if device_opt not in options or (device_opt in options and options[device_opt] is None): logging.error("BT-TET: Pleace specify the %s for device %s.", device_opt, device) break else: - self.devices[device] = Device(name=device, **options) - elif 'mac' in self.options: - # legacy + if options['enabled']: + self.devices[device] = Device(name=device, **options) + + # legacy + if 'mac' in self.options: for opt in ['share_internet', 'mac', 'ip', 'netmask', 'interval']: if opt not in self.options or (opt in self.options and self.options[opt] is None): logging.error("BT-TET: Please specify the %s in your config.yml.", opt) return - self.devices['default'] = Device(name='default', **self.options) - else: - logging.error("BT-TET: No configuration found") - return + self.devices['legacy'] = Device(name='legacy', **self.options) if not self.devices: logging.error("BT-TET: No valid devices found") return + # ensure bluetooth is running bt_unit = SystemdUnitWrapper('bluetooth.service') if not bt_unit.is_active():