GoDrop

module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2023 License: GPL-3.0

README ΒΆ

GoDrop

A Go implementation of OpenDrop.

Go Reference

Big thanks to Seemoo πŸ‡©πŸ‡ͺ for developing Open-Source implementations for AirDrop.

Made In Germany

This project is inspired by GoOpenDrop.

Features

  • πŸ”“ Works without the need of extraction of Apple signed certificates
  • ⚑ Easy High-Level Go API
  • πŸ’ͺ Manages everything
πŸ”Œ Note: This project is designed to be extended by you
βœ”οΈ Works the best on a Raspberry Pi

Setup

Prerequisites

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.

(I didn't test Nexamon patched firmwares.)
How do I know my Wifi Card supports 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.

Dependencies
Go

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
Packages

Now install the required packages:

sudo apt install imagemagick bluez
OWL

Follow OWL's setup here.

Ideally make a quick test if owl works:

sudo owl -i <WIFI_INTERFACE> -c 44 -v

If everything seems to work hit CTLR + C.

Go Module

Run

go get -u github.com/Binozo/GoDrop

in your Project.

Usage

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)
TODO's

Directories ΒΆ

Path Synopsis
internal
ble
pkg
air
owl

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL