from pyclui import Logger from bluepy.btle import BTLEException from bluetooth.btcommon import BluetoothError from .ui import parse_cmdline from .helper import find_rfkill_devid, get_microbit_devpaths from .br_scan import BRScanner from .le_scan import LEScanner from .gatt_scan import GATTScanner from .sdp_scan import SDPScanner from .stack_scan import StackScanner from .vuln_scan import VulnScanner logger = Logger(__name__, logging.INFO) logger.debug("__name__: {}".format(__name__)) def init_hci(iface='hci0'): hci = HCI(iface) exitcode, output = subprocess.getstatusoutput('rfkill unblock %d' % find_rfkill_devid(iface)) if exitcode != 0: logger.error('rfkill: ' + output) sys.exit(exitcode) exitcode, output = subprocess.getstatusoutput("hciconfig up " + iface) if exitcode != 0: logger.error("Failed to up " + iface) sys.exit(exitcode)
IFACE_PROP = 'org.freedesktop.DBus.Properties' mainloop = GObject.MainLoop() logger = Logger(__name__, logging.INFO) oui_file = pkg_resources.resource_stream(__name__, "res/oui.txt") oui_file = io.TextIOWrapper(oui_file) oui_company_names = {} for line in oui_file: items = line.strip().split('\t\t') if len(items) == 2 and ' (hex)' in items[0]: company_id = items[0].removesuffix(' (hex)') oui_company_names[company_id] = items[1] logger.debug("oui_company_names: {}".format(oui_company_names)) class InvalidArgsException(DBusException): _dbus_error_name = 'org.freedesktop.DBus.Error.InvalidArgs' class NotSupportedException(DBusException): _dbus_error_name = 'org.bluez.Error.NotSupported' class NotPermittedException(DBusException): _dbus_error_name = 'org.bluez.Error.NotPermitted' class InvalidValueLengthException(DBusException):