As we know, AirDrop is Apple’s proprietary protocol. However, it is possible to use AirDrop on non-Apple devices and enable those devices to work with Apple devices.
Of course, there are some prerequisites and limits. I’m specifically using Android as an example in this article.
At the time of writing, I haven’t finished the tool’s development.
The AirDrop’s web service runs at application layer. And AWDL operates at the data link layer and the physical layer.
Besides, I found that on macOS, the receiver registers a mDNS service not only on the AWDL interface (awdl0) but also on all network interfaces (lo0, en0) after discovering a BLE advertisement.
On macOS we can enable the capability to browse all interfaces. With it on, sharing via AirDrop will discover devices on non-AWDL interfaces.
Although the AWDL protocol is very complicated and difficult to implement, AirDrop does not absolutely rely on AWDL on macOS. So we can replace AWDL with any other Ethernet without looking into it.
Limitation
Mac-only
AirDrop in Everyone mode
LAN-only
Only if BrowseAllInterfaces is turned on and Ethernet (non-WiFi) is connected, sharing via AirDrop will be able to discover devices on the LAN.
Note: even though condition 4 is not fulfilled, other devices can AirDrop to the Mac
init { val interfaces = mutableListOf<NetworkInterface>() for (ifName in ifNames) { val networkInterface = NetworkInterface.getByName(ifName) if (networkInterface != null) { interfaces.add(networkInterface) } } for (networkInterface in interfaces) { var if4: Inet4Address? = null var if6: Inet6Address? = null for (address in networkInterface.inetAddresses) { if (address.isLoopbackAddress) { continue } if (address is Inet4Address) { if4 = address } elseif (address is Inet6Address) { if6 = address } } addresses.add(if6 ?: if4 ?: continue) }
Log.d("JmDNS", "addresses: $addresses") } // Start JmDNS instances, run in non-UI thread funstartDiscover() { // Each InetAddress create a JmDNS instance mDNSs = addresses.map { JmDNS.create(it).apply { addServiceListener("_airdrop._tcp.local.", listener) } } Log.v("JmDNS", "mDNSs: $mDNSs") }
}
Send HTTP Requests
Send request to AirDrop files.
TODO
Register a AirDrop service
Register a mDNS service and create a HTTP server to receive files.
TODO
References
Paper: Milan Stute, Sashank Narain, Alex Mariotto, Alexander Heinrich, David Kreitschmann, Guevara Noubir, and Matthias Hollick. A Billion Open Interfaces for Eve and Mallory: MitM, DoS, and Tracking Attacks on iOS and macOS Through Apple Wireless Direct Link. 28th USENIX Security Symposium (USENIX Security ’19), August 14–16, 2019, Santa Clara, CA, USA. Link