From 51246b89dd0a3b56cb16dd9e18a5b9d1d2c57b8a Mon Sep 17 00:00:00 2001 From: Milan Stute Date: Wed, 2 Dec 2020 10:09:52 +0100 Subject: [PATCH] Support AirDrop authentication by using extracted secrets (fixes #53) --- README.md | 4 ++-- opendrop/config.py | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 041d201..3c9fbb7 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ [![Language grade](https://img.shields.io/lgtm/grade/python/github/seemoo-lab/opendrop?label=code%20quality)](https://lgtm.com/projects/g/seemoo-lab/opendrop/context:python) *OpenDrop* is a command-line tool that allows sharing files between devices directly over Wi-Fi. Its unique feature is that it is protocol-compatible with Apple AirDrop which allows to share files with Apple devices running iOS and macOS. -Currently (and probably also for the foreseeable future), OpenDrop only supports sending to Apple devices that are discoverable by *everybody* as the default *contacts only* mode requires [Apple-signed certificates](https://www.apple.com/certificateauthority/pdf/Apple_AAI_CPS_v6.1.pdf). - +~~Currently (and probably also for the foreseeable future), OpenDrop only supports sending to Apple devices that are discoverable by *everybody* as the default *contacts only* mode requires [Apple-signed certificates](https://www.apple.com/certificateauthority/pdf/Apple_AAI_CPS_v6.1.pdf).~~ +We support contacts-only devices by using extracted AirDrop credentials (keys and certificates) from macOS via our [keychain extractor](https://github.com/seemoo-lab/airdrop-keychain-extractor). ## Disclaimer diff --git a/opendrop/config.py b/opendrop/config.py index 3334b18..f97a6ad 100644 --- a/opendrop/config.py +++ b/opendrop/config.py @@ -120,8 +120,14 @@ class AirDropConfig: logger.info("Key file or certificate does not exist") self.create_default_key() - # TODO extract record data from a sample exchange + self.record_file = os.path.join(self.key_dir, "validation_record.cms") self.record_data = None + if os.path.exists(self.record_file): + logger.debug("Using provided Apple ID Validation Record") + with open(self.record_file, "rb") as f: + self.record_data = f.read() + else: + logger.debug("No Apple ID Validation Record found") def create_default_key(self): logger.info("Create new self-signed certificate in {}".format(self.key_dir))