seemoo-lab / opendrop

An open Apple AirDrop implementation written in Python
https://owlink.org
GNU General Public License v3.0
8.63k stars 273 forks source link

Can't discover devices #94

Open twoexem opened 2 years ago

twoexem commented 2 years ago

I can't seem to discover devices and neither can they. I have the TP-Link Archer T1U and owl starts running, but my PC doesn't get detected by an Apple device nor can it detect other AirDrop devices. Do I somehow have to connect it to a WiFi network or anything like that? I'm rather puzzled by this. If somebody needs more info I'll happily provide it, but I don't want to make this report unnecessary long.

twoexem commented 2 years ago

Opendrop can discover itself, so if I run opendrop -i awdl0 find and run opendrop receive in another terminal, they get discovered. I just can't get an iPad and an iPhone to detect my laptop. Does anybody know a possible solution to my problem?

bodaay commented 2 years ago

I assume you have done all the steps required, extracting keys and using them. The only thing that might be missing on your side, is that you need to send Airdrop BLE Beacon so IOS device will initiate its HTTPS server and will be able to receive /Discover Post request

One easy soltuion to test out without going through BLE thing, you can have two IOS devices, one of them start Airdrop as if you need to share a file, the other device will be discoverable

if you are running on raspberry pi with BLE 4.0 (newer ones have BLE 5.0), 5.0 will not work with apple_blee since hci api is deprecated, I have the required code for 5.0 but its in Golang, and its using bluez with d-bus ineterface. I'll upload the whole project which will be all in one soon

you can use adv_wifi.py from apple_blee project as base and send BLE Beacon for Airdrop, here is a snippets for the changes you need to make:


def generate_airdrop_beacon_data(appleid="email@example.com",phone="97411111111",email="email@example.com",email2="email@example.com"):
    adv_type=0x03 # dont touch this

    header = (0x02, 0x01, 0x1a, 0x17, 0xff, 0x4c, 0x00)
    const1=(0x05,0x12,0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,0x01)

    first_2_bytes_apple_id_sha256 = get_hash(appleid,size=2)
    first_2_bytes_phone_sha256 = get_hash(phone,size=2)
    first_2_bytes_email_sha256 = get_hash(email,size=2)
    first_2_bytes_email2_sha256 = get_hash(email2,size=2)
    const_suffix_zero=(0x00,)

    data=(header + const1 +  first_2_bytes_apple_id_sha256 + first_2_bytes_phone_sha256 + first_2_bytes_email_sha256 + first_2_bytes_email2_sha256 + const_suffix_zero)

    return adv_type,data
twoexem commented 2 years ago

I need to extract the keys? Didn't know it was neccessary, thought it was optional. I'll try that out and perform the BLE code thing too. Thanks for your reply!

bodaay commented 2 years ago

if that works, you may need to do this as well anyway. Make sure you install old libarchive, new ones not compatible with the code in your requirements file for pip: libarchive-c==2.9

twoexem commented 2 years ago

@bodaay Is there any way I can get a keychain without actually owning a Mac? The Macbook Pro a friend lended me doesn't want to boot into recovery mode, and I don't know anybody else who owns a Mac.

bodaay commented 2 years ago

to be honest i'm not sure, I think you do need a mac and Apple Developer license as well. I don't know whether apple changed something, because I thought same initially that keys are optional, but for me it never worked without the keys. Having the keys actually is pretty good, you can be a verified contact as well, just add a contact in your phone with same apple id as email for the extracted keys.

if you are verified: 1- you can send while Airdrop in contacts mode only 2- There is a thumbnail picture while asking for accept.

twoexem commented 2 years ago

Okay, I see. I'll have to ask other friends if they own a Mac or something similar. Thanks for your help, I'll update you once I get any results.

bodaay commented 1 year ago

I've uploaded a full all in one soltuion:

https://github.com/bodaay/GoOpenDrop

lucasromeiro commented 1 year ago

I'm having trouble extracting keys from my Mac Studio. did you have any problems?
can you give me any tips?

thank you for any help.