def run(self): """Creates the wifi advertisement with the given ssid, and phone or email """ ssid = self.args.get("ssid", 'none') phone = self.args.get("phone", 'none') email = self.args.get("email", 'none') appleid = self.args.get("appleid", 'none') interval = int(self.args.get("interval", 200)) dev_id = int(self.args.get("ble_iface", 0)) toggle_device(dev_id, True) header = (0x02, 0x01, 0x1a, 0x1a, 0xff, 0x4c, 0x00) const1 = (0x0f, 0x11, 0xc0, 0x08) id1 = (0xff, 0xff, 0xff) contact_id_mail = self.get_hash(email) contact_id_tel = self.get_hash(phone) contact_id_appleid = self.get_hash(appleid) id_wifi = self.get_hash(ssid) const2 = (0x10, 0x02, 0x0b, 0x0c,) try: sock = bluez.hci_open_dev(dev_id) except: print_error(f"Cannot open bluetooth device {dev_id}") return try: print_info("Start advertising press ctrl + c to quit...") start_le_advertising(sock, adv_type=0x00, min_interval=interval, max_interval=interval, data=( header + const1 + id1 + contact_id_appleid + contact_id_tel + contact_id_mail + id_wifi + const2)) while True: sleep(2) except: stop_le_advertising(sock)
def advertisment(self): """Get values for the accesories of the airpod and genrates an le advertising with them """ if self.args.random: left_speaker, right_speaker, case = self.random_values() else: left_speaker = (100,) right_speaker = (100,) case = (100,) interval = self.args.interval toggle_device(self.args.ble_iface, True) data1 = (0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x01, 0x02, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45) data2 = (0xda, 0x29, 0x58, 0xab, 0x8d, 0x29, 0x40, 0x3d, 0x5c, 0x1b, 0x93, 0x3a) try: sock = bluez.hci_open_dev(args.ble_iface) except: print(f"Cannot open bluetooth device {self.args.ble_iface}") return try: print("Start advertising press ctrl + c to quit...") start_le_advertising(sock, adv_type=0x03, min_interval=interval, max_interval=interval, data=(data1 + left_speaker + right_speaker + case + data2)) while True: sleep(2) except: stop_le_advertising(sock) print() print("Bye")
def adv_airdrop(self): while True: dev_id = self.dev_id toggle_device(dev_id, True) header = (0x02, 0x01, 0x1a, 0x1b, 0xff, 0x4c, 0x00) data1 = (0x05, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01) apple_id = (0x00, 0x00) phone = (0x00, 0x00) email = (0xb7, 0x9b) data2 = (0x00, 0x00, 0x00, 0x10, 0x02, 0x0b, 0x00) try: sock = bluez.hci_open_dev(dev_id) except: print("Cannot open bluetooth device %i" % dev_id) raise start_le_advertising(sock, adv_type=0x02, min_interval=500, max_interval=500, data=(header + data1 + apple_id + phone + email + data2)) time.sleep(10) stop_le_advertising(sock)
def advertisment(self): """Creates the wifi advertisement with the given ssid, and phone or email """ if (not self.ssid): print("Error, must provide ssid") return toggle_device(self.ble_iface, True) header = (0x02, 0x01, 0x1a, 0x1a, 0xff, 0x4c, 0x00) const1 = (0x0f, 0x11, 0xc0, 0x08) id1 = (0xff, 0xff, 0xff) contact_id_mail = self.get_hash(self.email) contact_id_tel = self.get_hash(self.phone) contact_id_appleid = self.get_hash(self.appleid) id_wifi = self.get_hash(self.ssid) const2 = ( 0x10, 0x02, 0x0b, 0x0c, ) try: sock = bluez.hci_open_dev(dev_id) except: print(f"Cannot open bluetooth device {self.ble_iface}") return try: print("Start advertising press ctrl + c to quit...") start_le_advertising( sock, adv_type=0x00, min_interval=interval, max_interval=interval, data=(header + const1 + id1 + contact_id_appleid + contact_id_tel + contact_id_mail + id_wifi + const2)) while True: sleep(2) except: stop_le_advertising(sock) print() print("Bye")
def run(self): """Get values for the accesories of the airpod and genrates an le advertising with them """ random = str(self.args.get("random", "False")).lower() == "true" interval = int(self.args.get("interval", 10)) dev_id = int(self.args.get("ble_iface", 0)) if random: left_speaker, right_speaker, case = self.random_values() else: left_speaker = (int(self.args.get("left_speaker", 0)), ) right_speaker = (int(self.args.get("right_speaker", 0)), ) case = (int(self.args.get("case", 0)), ) toggle_device(dev_id, True) data1 = (0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x01, 0x02, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45) data2 = (0xda, 0x29, 0x58, 0xab, 0x8d, 0x29, 0x40, 0x3d, 0x5c, 0x1b, 0x93, 0x3a) try: sock = bluez.hci_open_dev(dev_id) except: print_error("Cannot open bluetooth device %i" % dev_id) return try: print_info("Start advertising press ctrl + c to quit...") start_le_advertising(sock, adv_type=0x03, min_interval=interval, max_interval=interval, data=(data1 + left_speaker + right_speaker + case + data2)) while True: sleep(2) except: stop_le_advertising(sock) print() print_error("Bye")
return tuple(bytearray.fromhex(hashlib.sha256(data.encode('utf-8')).hexdigest())[:size]) dev_id = 0 # the bluetooth device is hci0 toggle_device(dev_id, True) header = (0x02, 0x01, 0x1a, 0x1a, 0xff, 0x4c, 0x00) const1 = (0x0f, 0x11, 0xc0, 0x08) id1 = (0xff, 0xff, 0xff) contact_id_mail = get_hash(args.email) contact_id_tel = get_hash(args.phone) contact_id_appleid = get_hash(args.appleid) id_wifi = get_hash(args.ssid) const2 = (0x10, 0x02, 0x0b, 0x0c,) print("Start advertising...") try: sock = bluez.hci_open_dev(dev_id) except: print("Cannot open bluetooth device %i" % dev_id) raise try: start_le_advertising(sock, adv_type=0x00, min_interval=args.interval, max_interval=args.interval, data=( header + const1 + id1 + contact_id_appleid + contact_id_tel + contact_id_mail + id_wifi + const2)) while True: sleep(2) except: stop_le_advertising(sock) raise