-
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 0e6889e
Showing
21 changed files
with
1,452 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,16 @@ | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Set the following properties for all files: | ||
[*] | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[.py, .cpp] | ||
max_line_length = 80 |
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,271 @@ | ||
.env | ||
target | ||
.pybuilder | ||
|
||
#### below this line everything has been automatcally created #### | ||
# ---> Rust | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# ---> Python | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# ---> Vim | ||
# Swap | ||
[._]*.s[a-v][a-z] | ||
!*.svg # comment out if you don't need vector files | ||
[._]*.sw[a-p] | ||
[._]s[a-rt-v][a-z] | ||
[._]ss[a-gi-z] | ||
[._]sw[a-p] | ||
|
||
# Session | ||
Session.vim | ||
Sessionx.vim | ||
|
||
# Temporary | ||
.netrwhist | ||
*~ | ||
# Auto-generated tag files | ||
tags | ||
# Persistent undo | ||
[._]*.un~ | ||
|
||
# ---> SublimeText | ||
# Cache files for Sublime Text | ||
*.tmlanguage.cache | ||
*.tmPreferences.cache | ||
*.stTheme.cache | ||
|
||
# Workspace files are user-specific | ||
*.sublime-workspace | ||
|
||
# Project files should be checked into the repository, unless a significant | ||
# proportion of contributors will probably not be using Sublime Text | ||
# *.sublime-project | ||
|
||
# SFTP configuration file | ||
sftp-config.json | ||
|
||
# Package control specific files | ||
Package Control.last-run | ||
Package Control.ca-list | ||
Package Control.ca-bundle | ||
Package Control.system-ca-bundle | ||
Package Control.cache/ | ||
Package Control.ca-certs/ | ||
Package Control.merged-ca-bundle | ||
Package Control.user-ca-bundle | ||
oscrypto-ca-bundle.crt | ||
bh_unicode_properties.cache | ||
|
||
# Sublime-github package stores a github token in this file | ||
# https://packagecontrol.io/packages/sublime-github | ||
GitHub.sublime-settings | ||
|
||
# ---> Linux | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
# ---> macOS | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# ---> Windows | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
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 "src/main/arduino/src/rc-switch"] | ||
path = src/main/arduino/src/rc-switch | ||
url = https://github.com/sui77/rc-switch.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,19 @@ | ||
MIT License Copyright (c) <2020> <Stefan Sterz> | ||
|
||
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 (including the next | ||
paragraph) 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,18 @@ | ||
.PHONY: all | ||
|
||
PORT ?= /dev/ttyACM0 | ||
ARCH ?= arduino:avr:mega:cpu=atmega2560 | ||
|
||
all: arduino-verify rc-snitch | ||
|
||
clean: | ||
pyb clean | ||
|
||
arduino-upload: src/main/arduino/main.cpp | ||
arduino --upload --port $(PORT) --board $(ARCH) $^ | ||
|
||
arduino-verify: src/main/arduino/main.cpp | ||
arduino --verify --board $(ARCH) $^ | ||
|
||
rc-snitch: build.py | ||
pyb |
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,56 @@ | ||
# RC Snitch | ||
This is a project for the course «Secure Mobile Systems» at TU Darmstadt. It attempts to demonstrate some implementation flaws with common radio controlled power outlets. It can: | ||
|
||
- Send Codes to turn on or off radio controlled power outlets | ||
- Detect whether such codes are send | ||
- React to such codes | ||
|
||
## Dependencies | ||
- Hardware | ||
+ Arduino Uno or Mega 2560 (other might work too, but have not been tested) | ||
+ 433MHz Transmitter | ||
+ 433MHz Receiver | ||
- Software | ||
+ Python 3.8+ and `pip` | ||
+ Arduino IDE 1.8+ | ||
|
||
## Setup | ||
### Hardware | ||
Connect the transmitter and the receiver to the Arduino as follows: | ||
|
||
- On both the transmitter and the receiver connect the pin labelled `VCC` or `5V+` to the `5V` outlet of the Arduino. | ||
- On both the transmitter and the receiver connect `GND` to the same outlet on the Arduino. | ||
- On the transmitter connect the `DATA` pin to pin 10 on the Arduino. | ||
- On the receiver connect the `DATA` pin that is closer to the `GND` pin to pin 2 on the Arduino. | ||
|
||
### Software | ||
After installing the Arduino IDE make sure that the Arduino boards are correctly installed with `arduino --install-boards arduino:avr`. Then clone this repository with `git clone --recurse-submodules https://github.com/sterzy/rc-snitch.git` and set up the python project as follows: | ||
|
||
```bash | ||
pip3 install virtualenv --user | ||
virtualenv .env | ||
source .env/bin/activate | ||
pip install -r requirements.txt | ||
``` | ||
|
||
Then you should be able to execute the following commands: | ||
|
||
- `make`: This will execute the `all` target which will just verify the project and create (but not install) the python utility. | ||
- `make arduino-upload`: If everything works out, this command should upload the Arduino firmware to the board. Per default, `/dev/ttyACM0` as the port and the Arduino Mega as the board will be used. These values can be overwritten with the following environment variables: | ||
+ `PORT` specifies the port that the Arduino is connected to. | ||
+ `ARCH` specifies the board that is actually used. The following two boards have been tested: Arduino Mega 2560 (`"arduino:avr:mega:cpu=atmega2560"`) and Arduino Uno (`"arduino:avr:uno"`) | ||
- `make rc-snitch`: This will create the python utility. | ||
|
||
Note that at this point the python utility is not installed yet. After executing `make rc-snitch` install it with the following commands: | ||
|
||
```bash | ||
pip install --upgrade ./target/dist/rc-snitch-1.0.dev0/dist/rc_snitch-1.0.dev0-py3-none-any.whl | ||
rc-snitch -h | ||
``` | ||
|
||
To understand how it works `rc-snitch -h` can be executed, which display a helpful description of the utility. Every sub-command (`send`, `sniff`, `block` and `profile`) has its own help message. The utility can be removed with `pip uninstall rc-snitch`. | ||
|
||
## Further Reading | ||
- [SUI77 - Low cost RC power sockets (radio outlets)+arduino](https://sui77.wordpress.com/2011/04/12/163/) | ||
- This project is based on the rc-switch library: [SUI77 - rc-switch](https://github.com/sui77/rc-switch) | ||
- [Arduino IDE CLI Documentation](https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc) |
Oops, something went wrong.