Transfer data through a unidirectional network (i.e., a data diode).
First, ensure you have Python version 3.11 or greater.
To install from PyPI:
pip install pydiode
Or to install from source, clone the repo then run:
pip install .
Note: If local installs are slow, remove large files from the repo (e.g., build
, dist
, and random_data
). When installing, pip makes a copy of everything, so large files slow it down.
To run the GUI, Tk must be installed. For example:
- On macOS:
sudo port install py311-tkinter
sudo port install tk -x11 +quartz
- On Linux:
sudo apt install python3.11-tk
The pydiode-gui
command will launch the GUI. The GUI can also be run from a frozen executable (see packaging instructions below).
Documentation:
pydiode --help
pydiode send --help
pydiode receive --help
Start a receiver on localhost:
pydiode --debug receive 127.0.0.1
Send data to the receiver, from localhost to localhost:
pydiode --debug send 127.0.0.1 127.0.0.1
Type some information into the receiver. When finished, press enter, then type Control-D to signal the end-of-file. The receiver should print the received information.
With debug-level logging, you will see details about each packet sent and received. Omit the --debug
paramater when sending large amount of data, since debug-level logging incurs significant CPU usage.
python -m unittest discover
Since the unit tests run on the installed code, remember to install the latest version of the code before running the unit tests.
Follow the instructions in freeze/README.md
If you use this code as part of a publication, please cite our PEP '23 paper:
Peter Story, “Building an Affordable Data Diode to Protect Journalists,” Workshop on Privacy Engineering in Practice (PEP '23), August 2023