Skip to main content

Serial Diode

Generic wire protocol and implementation for one-way data transfer over UART serial.

Usage

General

The serial device can be specified with --device and baudrate with --baudrate. If device is unspecified, it will attempt to guess the correct device based on platform and name. If baudrate is unspecified, it defaults to 115200 Hz.

See --help for detailed usage information.

Send

Run diode send <path/to/file> to send <file>.

Receive

Run diode listen, which will listen forever. When it receives a valid payload, it will write it to out/<file> where <file> was specified in the payload metadata.

Note that on some systems this may need to be run as root to allow access to the serial port. It is generally preferable to add the user to the appropriate group with something similar to usermod -a -G uucp <username>.

Wire format

┌─────┬──────────┬─────────────┬──────┬─────┬───────┐
│ SOT │ metadata │ data_length │ data │ EXT │ crc32 │
└─────┴──────────┴─────────────┴──────┴─────┴───────┘

Here:

  • metadata is 32 bytes,
  • data_length is 8 bytes,
  • data is data_length bytes,
  • crc32 is 8 bytes,
  • SOT and EXT are the bytes x02, x03,
  • crc32 is the value of the CRC32 function acting on metadata || data.

Installation

Install in developer mode with make install_dev && source venv/bin/activate.

Install as user with make install.

Install from PyPI with pip install data-diode.

Install Bash completion with source bash_completion/diode.

Testing

Run make test.

For ad-hoc testing, socat -d -d pty,raw,echo=0 pty,raw,echo=0 can be useful to connect two virtual serial devices. If a physical serial device exists, connect with screen /dev/<device_name> [<baud_rate>] where <baud_rate> is likely 115200.

Metadata

Release files for data-diode 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for data-diode 0.0.4
File Size Uploaded
data-diode-0.0.4.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for data-diode 0.0.4
File Interpreter ABI Platform
data_diode-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / data-diode-0.0.4.tar.gz

Download URL data-diode-0.0.4.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bbd9bf4f6c8a41dbcf95b8ccfb39a9ceb145d32108157027bcbb2315c144b36f
BLAKE2b-256 checksum
How to use checksums
eca2bf17ba687fe005aef8d950e1743f41840a74e064ad6d47d058c032b613ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.7

Release files / data_diode-0.0.4-py3-none-any.whl

Download URL data_diode-0.0.4-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccc281bdb8f9ba709d4bf329aa219c919f28f7a55de98a6708cdaffe8dc27cd2
BLAKE2b-256 checksum
How to use checksums
6a4529795b34230328165cd15e495fe86bed9fc4c1030f53027ad5b6bd5b4dd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page