FindMy: Fix key generation script

This commit is contained in:
Willy-JL
2024-03-09 04:20:04 +00:00
parent d23f64d693
commit 448033c802

View File

@@ -23,11 +23,16 @@ def convert_key_to_hex(private_key, public_key):
return private_key_hex, public_key_hex return private_key_hex, public_key_hex
def generate_mac_and_payload(public_key): def generate_mac_and_payload(public_key):
public_key_bytes = public_key.public_numbers().x.to_bytes(28, byteorder='big') key = public_key.public_numbers().x.to_bytes(28, byteorder='big')
mac = public_key_bytes[:6].hex()
payload = advertisement_template() addr = bytearray(key[:6])
payload[7:29] = public_key_bytes[6:22] addr[0] |= 0b11000000
return mac, payload.hex()
adv = advertisement_template()
adv[7:29] = key[6:28]
adv[29] = key[0] >> 6
return addr.hex(), adv.hex()
def main(): def main():
nkeys = int(input('Enter the number of keys to generate: ')) nkeys = int(input('Enter the number of keys to generate: '))