A Go implementation of OpenDrop.
Warning
This library only works until macOS Ventura and iOS 15. Apple apparently changed the way their AirDrop protocol works.
Big thanks to Seemoo 🇩🇪 for developing Open-Source implementations for AirDrop.
This project is inspired by GoOpenDrop.
- 🔓 Works without the need of extraction of Apple signed certificates
- ⚡ Easy High-Level Go API
- 💪 Manages everything
This project has been developed and tested on a Raspberry Pi 4B 2GB.
Other platforms may not work as good as on a Raspberry Pi.
You NEED a Wifi card with ACTIVE MONITORING.
Type iw list
into your Terminal.
Now check if you can find Device supports active monitor (which will ACK incoming frames)
in the entry of your Wifi Card.
One-liner:
iw list | grep -q "Device supports active monitor"; echo $?
Does it return 0
? Your Wifi Card supports active monitor mode.
If it returns 1
it does not.
I am using the ALLNET ALL-WA1200AC
Wifi Card. It is plug-and-play.
First make sure you got Go installed on your machine.
If you want to install Go quickly you can try using this script.
This repository offers you a quick installation script:
wget -q -O - https://git.io/vQhTU | bash
Now install the required packages:
sudo apt install imagemagick bluez
Ideally make a quick test if owl works:
sudo owl -i <WIFI_INTERFACE> -c 44 -v
If everything seems to work hit CTLR + C
.
Run
go get -u github.com/Binozo/GoDrop
in your Project.
Now you can finally use this library 🥳
Example:
package main
import (
"fmt"
"github.com/Binozo/GoDrop/pkg/air"
"github.com/Binozo/GoDrop/pkg/airdrop"
"github.com/Binozo/GoDrop/pkg/owl"
"github.com/korylprince/go-cpio-odc"
)
func main() {
// Configure your GoDrop setup
// (You can define the Wifi interface here)
airdrop.Config(air.Config{DebugMode: true, HostName: "GoDrop"})
// Let's subscribe to OWL-errors
// Great for debugging and checking if
// OWL works correctly on your hardware
//
// Take a look `owl.SubscribeToLogs()` if you want
// to listen to logs
go func() {
for {
owlError := <-owl.SubscribeToErrors()
fmt.Println("An owl error occurred:", owlError.ErrorType)
fmt.Println("Logs:", owlError.Logs)
}
}()
// Init everything required (wifi, owl, ble...)
err := airdrop.Init()
if err != nil {
panic(err)
}
// Here you can accept or decline the sending request
// If you don't define this all requests will be declined
airdrop.OnAsk(func(request air.Request) bool {
fmt.Println("Incoming request from", request.SenderComputerName)
fmt.Println("Wants to send", len(request.Files), "files")
return true // accepting
})
// Here you will be able to access the received files
// Note that OnAsk will be called first, after that
// you will get the files here
airdrop.OnFiles(func(request air.Request, files []*cpio.File) {
fmt.Println("Got files from", request.SenderComputerName)
for _, file := range files {
fmt.Println("Filename:", file.Name())
}
})
err = airdrop.StartReceiving()
if err != nil {
panic(err)
}
}
(You can find this file here: example/example.go)
- Add discovering receiver functionality
- Improve discovering (sometimes the receiver doesn't react)
- Add uploading feature (first we need to improve discovering)