forked from seemoo-lab/openhaystack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 52dde37
Showing
93 changed files
with
8,048 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: "Build application" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
lint-swiftlint: | ||
runs-on: macos-latest | ||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@v2 | ||
- name: "Run SwiftLint" | ||
run: swiftlint --reporter github-actions-logging | ||
|
||
build-app: | ||
runs-on: macos-latest | ||
needs: lint-swiftlint | ||
env: | ||
APP: OpenHaystack | ||
PROJECT_DIR: OpenHaystack | ||
defaults: | ||
run: | ||
working-directory: ${{ env.PROJECT_DIR }} | ||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@v2 | ||
- name: "Select Xcode 12" | ||
uses: devbotsxyz/xcode-select@v1 | ||
with: | ||
version: "12" | ||
- name: "Archive project" | ||
run: xcodebuild archive -scheme ${APP} -configuration release -archivePath ${APP}.xcarchive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: "Build firmware" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- Firmware/** | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- Firmware/** | ||
|
||
defaults: | ||
run: | ||
working-directory: Firmware | ||
|
||
jobs: | ||
build-firmware: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# Build firmware image | ||
- name: "Install build dependencies" | ||
run: brew install --cask gcc-arm-embedded | ||
- name: "Build firmware image" | ||
run: make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: "Create release" | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
jobs: | ||
build-and-release: | ||
name: "Create release on GitHub" | ||
runs-on: macos-latest | ||
env: | ||
APP: OpenHaystack | ||
PROJECT_DIR: OpenHaystack | ||
defaults: | ||
run: | ||
working-directory: ${{ env.PROJECT_DIR }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: "Select Xcode 12" | ||
uses: devbotsxyz/xcode-select@v1 | ||
with: | ||
version: "12" | ||
- name: "Archive project" | ||
run: xcodebuild archive -scheme ${APP} -configuration release -archivePath ${APP}.xcarchive | ||
- name: "Create ZIP" | ||
run: | | ||
pushd ${APP}.xcarchive/Products/Applications | ||
zip -r ../../../${APP}.zip ${APP}.app | ||
popd | ||
- name: "Create release" | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
- name: "Upload release asset" | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ env.PROJECT_DIR }}/${{ env.APP }}.zip | ||
asset_name: ${{ env.APP }}.zip | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
|
||
# Created by https://www.toptal.com/developers/gitignore/api/xcode,swift | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=xcode,swift | ||
|
||
### Swift ### | ||
# Xcode | ||
# | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
|
||
## User settings | ||
xcuserdata/ | ||
|
||
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) | ||
*.xcscmblueprint | ||
*.xccheckout | ||
|
||
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) | ||
build/ | ||
DerivedData/ | ||
*.moved-aside | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
|
||
## App packaging | ||
*.ipa | ||
*.dSYM.zip | ||
*.dSYM | ||
|
||
## Playgrounds | ||
timeline.xctimeline | ||
playground.xcworkspace | ||
|
||
# Swift Package Manager | ||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. | ||
# Packages/ | ||
# Package.pins | ||
# Package.resolved | ||
# *.xcodeproj | ||
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata | ||
# hence it is not needed unless you have added a package configuration file to your project | ||
# .swiftpm | ||
|
||
.build/ | ||
|
||
# CocoaPods | ||
# We recommend against adding the Pods directory to your .gitignore. However | ||
# you should judge for yourself, the pros and cons are mentioned at: | ||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | ||
# Pods/ | ||
# Add this line if you want to avoid checking in source code from the Xcode workspace | ||
# *.xcworkspace | ||
|
||
# Carthage | ||
# Add this line if you want to avoid checking in source code from Carthage dependencies. | ||
# Carthage/Checkouts | ||
|
||
Carthage/Build/ | ||
|
||
# Accio dependency management | ||
Dependencies/ | ||
.accio/ | ||
|
||
# fastlane | ||
# It is recommended to not store the screenshots in the git repo. | ||
# Instead, use fastlane to re-generate the screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://docs.fastlane.tools/best-practices/source-control/#source-control | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots/**/*.png | ||
fastlane/test_output | ||
|
||
# Code Injection | ||
# After new code Injection tools there's a generated folder /iOSInjectionProject | ||
# https://github.com/johnno1962/injectionforxcode | ||
|
||
iOSInjectionProject/ | ||
|
||
### Xcode ### | ||
# Xcode | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
|
||
|
||
|
||
|
||
## Gcc Patch | ||
/*.gcno | ||
|
||
### Xcode Patch ### | ||
*.xcodeproj/* | ||
!*.xcodeproj/project.pbxproj | ||
!*.xcodeproj/xcshareddata/ | ||
!*.xcworkspace/contents.xcworkspacedata | ||
**/xcshareddata/WorkspaceSettings.xcsettings | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/xcode,swift | ||
|
||
# Exports folder | ||
Exports/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "Firmware/blessed"] | ||
path = Firmware/blessed | ||
url = https://github.com/pauloborges/blessed.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# nRF SDK | ||
nrf51_sdk_v4_4_2_33551/ | ||
nrf51_sdk_v4_4_2_33551.zip | ||
|
||
# Build artifacts | ||
*.bin | ||
*.map | ||
*.out | ||
*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Copyright 2021 Secure Mobile Networking Lab (SEEMOO) | ||
Copyright 2021 The Open Wireless Link Project | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
PLATFORM := nRF51822 | ||
NRF51_SDK_PATH := $(shell pwd)/nrf51_sdk_v4_4_2_33551 | ||
NRF51_SDK_DOWNLOAD_URL := https://developer.nordicsemi.com/nRF5_SDK/nRF51_SDK_v4.x.x/nrf51_sdk_v4_4_2_33551.zip | ||
OPENHAYSTACK_FIRMWARE_PATH := $(shell pwd)/../OpenHaystack/OpenHaystack/HaystackApp/firmware.bin | ||
|
||
export PLATFORM | ||
export NRF51_SDK_PATH | ||
|
||
ifeq ($(DEPLOY_PATH),) | ||
DEPLOY_PATH := /Volumes/MICROBIT | ||
endif | ||
|
||
offline-finding/build/offline-finding.bin: $(NRF51_SDK_PATH) blessed/.git | ||
$(MAKE) -C blessed | ||
$(MAKE) -C offline-finding | ||
|
||
$(NRF51_SDK_PATH): | ||
wget $(NRF51_SDK_DOWNLOAD_URL) | ||
unzip $(NRF51_SDK_PATH).zip -d $(NRF51_SDK_PATH) | ||
|
||
blessed/.git: | ||
git submodule update --init | ||
|
||
clean: | ||
$(MAKE) -C blessed $@ | ||
$(MAKE) -C offline-finding $@ | ||
|
||
install: offline-finding/build/offline-finding.bin | ||
cp $< $(DEPLOY_PATH) | ||
|
||
update-app: offline-finding/build/offline-finding.bin | ||
cp $< $(OPENHAYSTACK_FIRMWARE_PATH) | ||
|
||
.PHONY: clean install update-app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# OpenHaystack Firmware for nRF51822 | ||
|
||
This project contains a PoC firmware for Nordic nRF51822 chips such as used by the [BBC micro:bit](https://microbit.org). | ||
After flashing our firmware, the device sends out Bluetooth Low Energy advertisements such that it can be found by [Apple's Find My network](https://developer.apple.com/find-my/). | ||
|
||
## Disclaimer | ||
|
||
Note that the firmware is just a proof-of-concept and currently only implements advertising a single static key. This means that **devices running this firmware are trackable** by other devices in proximity. | ||
|
||
## Requirements | ||
|
||
You need to [GNU Arm Embedded Toolchain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads) to build the firmware. | ||
On macOS, you can install it via [Homebrew](https://brew.sh): | ||
|
||
```bash | ||
brew install --cask gcc-arm-embedded | ||
``` | ||
|
||
## Build | ||
|
||
You need to specify a public key in the firmware image. You can either directly do so in the [source](offline-finding/main.c) (`public_key`) or patch the string `OFFLINEFINDINGPUBLICKEYHERE!` in the final firmware image. | ||
|
||
To build the firmware, it should suffice to run: | ||
|
||
```bash | ||
make | ||
``` | ||
|
||
from the main directory, which also takes care of downloading all dependencies. The deploy-ready image is then available at `offline-finding/build/offline-finding.bin`. | ||
|
||
## Deploy | ||
|
||
To deploy the image on a connected nRF device, you can run: | ||
|
||
```bash | ||
make install DEPLOY_PATH=/Volumes/MICROBIT | ||
``` | ||
|
||
*We tested this procedure with the BBC micro:bit V1 only, but other nRF51822-based devices should work as well.* | ||
|
||
## Author | ||
|
||
- **Milan Stute** ([@schmittner](https://github.com/schmittner), [email](mailto:[email protected]), [web](https://seemoo.de/mstute)) | ||
|
||
## License | ||
|
||
This firmware is licensed under the [**MIT License**](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
PROJECT_TARGET = offline-finding | ||
PROJECT_SOURCE_FILES = main.c | ||
|
||
BLESSED_PATH := ../blessed | ||
|
||
include $(BLESSED_PATH)/examples/Makefile.common |
Oops, something went wrong.