nullsec-lora-mesh 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nullsec_lora_mesh-0.1.0/LICENSE +21 -0
- nullsec_lora_mesh-0.1.0/PKG-INFO +243 -0
- nullsec_lora_mesh-0.1.0/README.md +211 -0
- nullsec_lora_mesh-0.1.0/apps/__init__.py +12 -0
- nullsec_lora_mesh-0.1.0/apps/cli.py +484 -0
- nullsec_lora_mesh-0.1.0/node/__init__.py +390 -0
- nullsec_lora_mesh-0.1.0/nullsec_lora_mesh.egg-info/PKG-INFO +243 -0
- nullsec_lora_mesh-0.1.0/nullsec_lora_mesh.egg-info/SOURCES.txt +29 -0
- nullsec_lora_mesh-0.1.0/nullsec_lora_mesh.egg-info/dependency_links.txt +1 -0
- nullsec_lora_mesh-0.1.0/nullsec_lora_mesh.egg-info/entry_points.txt +2 -0
- nullsec_lora_mesh-0.1.0/nullsec_lora_mesh.egg-info/requires.txt +16 -0
- nullsec_lora_mesh-0.1.0/nullsec_lora_mesh.egg-info/top_level.txt +5 -0
- nullsec_lora_mesh-0.1.0/protocol/__init__.py +214 -0
- nullsec_lora_mesh-0.1.0/protocol/compression.py +182 -0
- nullsec_lora_mesh-0.1.0/protocol/crypto.py +242 -0
- nullsec_lora_mesh-0.1.0/protocol/fec.py +240 -0
- nullsec_lora_mesh-0.1.0/protocol/routing.py +358 -0
- nullsec_lora_mesh-0.1.0/pyproject.toml +52 -0
- nullsec_lora_mesh-0.1.0/radio/__init__.py +56 -0
- nullsec_lora_mesh-0.1.0/radio/channel.py +509 -0
- nullsec_lora_mesh-0.1.0/radio/hal.py +1002 -0
- nullsec_lora_mesh-0.1.0/setup.cfg +4 -0
- nullsec_lora_mesh-0.1.0/tests/test_channel.py +280 -0
- nullsec_lora_mesh-0.1.0/tests/test_compression.py +67 -0
- nullsec_lora_mesh-0.1.0/tests/test_crypto.py +88 -0
- nullsec_lora_mesh-0.1.0/tests/test_frame.py +107 -0
- nullsec_lora_mesh-0.1.0/tests/test_radio.py +261 -0
- nullsec_lora_mesh-0.1.0/tests/test_routing.py +108 -0
- nullsec_lora_mesh-0.1.0/tests/test_transport.py +348 -0
- nullsec_lora_mesh-0.1.0/transport/__init__.py +42 -0
- nullsec_lora_mesh-0.1.0/transport/reliable.py +645 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 NullSec (bad-antics)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nullsec-lora-mesh
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Zero-leakage, high-speed compressed mesh communications over LoRa
|
|
5
|
+
Author-email: NullSec <badxantics@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: lora,mesh,encryption,compression,flipper-one,radio,protocol,security
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Communications
|
|
13
|
+
Classifier: Topic :: Security :: Cryptography
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: cryptography>=41.0
|
|
18
|
+
Requires-Dist: lz4>=4.3
|
|
19
|
+
Requires-Dist: zstandard>=0.21
|
|
20
|
+
Requires-Dist: pyserial>=3.5
|
|
21
|
+
Requires-Dist: click>=8.0
|
|
22
|
+
Requires-Dist: rich>=13.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
26
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
27
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
28
|
+
Provides-Extra: flipper
|
|
29
|
+
Requires-Dist: pyusb>=1.2; extra == "flipper"
|
|
30
|
+
Requires-Dist: protobuf>=4.0; extra == "flipper"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# NullSec LoRa Mesh
|
|
34
|
+
|
|
35
|
+
> Zero-leakage, high-speed compressed mesh communications framework for Flipper One and LoRa-enabled devices.
|
|
36
|
+
|
|
37
|
+
[](LICENSE)
|
|
38
|
+
[](https://www.python.org/)
|
|
39
|
+
|
|
40
|
+
## Overview
|
|
41
|
+
|
|
42
|
+
NullSec LoRa Mesh is a protocol framework for building secure, resilient mesh networks over LoRa radio. Designed for the **Flipper One** and compatible LoRa hardware, it provides:
|
|
43
|
+
|
|
44
|
+
- **Zero-leakage encryption** — ChaCha20-Poly1305 with ephemeral key exchange
|
|
45
|
+
- **High-speed compression** — LZ4/Zstandard adaptive compression for maximum throughput
|
|
46
|
+
- **Mesh routing** — Dynamic multi-hop routing with AODV-inspired protocol
|
|
47
|
+
- **Forward Error Correction** — Reed-Solomon FEC for reliable delivery over noisy channels
|
|
48
|
+
- **Anti-replay protection** — Monotonic counters and sliding window verification
|
|
49
|
+
- **Minimal overhead** — Designed for LoRa's low bandwidth (0.3 - 50 kbps)
|
|
50
|
+
|
|
51
|
+
## Architecture
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
┌─────────────────────────────────────────────────────┐
|
|
55
|
+
│ APPLICATION │
|
|
56
|
+
│ Chat │ File Transfer │ Telemetry │
|
|
57
|
+
├─────────────────────────────────────────────────────┤
|
|
58
|
+
│ TRANSPORT │
|
|
59
|
+
│ Fragmentation │ Reassembly │ Flow Control │
|
|
60
|
+
├─────────────────────────────────────────────────────┤
|
|
61
|
+
│ SECURITY │
|
|
62
|
+
│ ChaCha20-Poly1305 │ X25519 ECDH │ Anti-Replay │
|
|
63
|
+
├─────────────────────────────────────────────────────┤
|
|
64
|
+
│ COMPRESSION │
|
|
65
|
+
│ LZ4 (fast) │ Zstd (ratio) │ Adaptive │
|
|
66
|
+
├─────────────────────────────────────────────────────┤
|
|
67
|
+
│ MESH ROUTING │
|
|
68
|
+
│ AODV │ Flooding │ Gossip │ Route Maintenance │
|
|
69
|
+
├─────────────────────────────────────────────────────┤
|
|
70
|
+
│ LINK LAYER │
|
|
71
|
+
│ FEC (Reed-Solomon) │ CRC32 │ Duty Cycle Mgmt │
|
|
72
|
+
├─────────────────────────────────────────────────────┤
|
|
73
|
+
│ PHYSICAL │
|
|
74
|
+
│ LoRa SX1262/SX1276 │ SubGHz │ Flipper One │
|
|
75
|
+
└─────────────────────────────────────────────────────┘
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Protocol Design
|
|
79
|
+
|
|
80
|
+
### Frame Format
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
┌──────┬──────┬──────┬────────┬──────────┬──────────┬─────┐
|
|
84
|
+
│ Sync │ Ver │ Type │ Src ID │ Dst ID │ Seq/Frag │ Len │
|
|
85
|
+
│ 2B │ 1B │ 1B │ 4B │ 4B │ 4B │ 2B │
|
|
86
|
+
├──────┴──────┴──────┴────────┴──────────┴──────────┴─────┤
|
|
87
|
+
│ Payload (encrypted) │
|
|
88
|
+
│ 0 - 222 bytes │
|
|
89
|
+
├─────────────────────────────────────────────────────────┤
|
|
90
|
+
│ Auth Tag (16B) │
|
|
91
|
+
├─────────────────────────────────────────────────────────┤
|
|
92
|
+
│ FEC Parity (variable) │
|
|
93
|
+
└─────────────────────────────────────────────────────────┘
|
|
94
|
+
|
|
95
|
+
Total overhead: 18B header + 16B auth + FEC = ~40B minimum
|
|
96
|
+
Max payload per frame: 222 bytes (LoRa max 255B - overhead)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Message Types
|
|
100
|
+
|
|
101
|
+
| Type | ID | Description |
|
|
102
|
+
|------|-----|-------------|
|
|
103
|
+
| DATA | 0x01 | Encrypted data payload |
|
|
104
|
+
| ACK | 0x02 | Acknowledgment |
|
|
105
|
+
| RREQ | 0x03 | Route Request (broadcast) |
|
|
106
|
+
| RREP | 0x04 | Route Reply (unicast) |
|
|
107
|
+
| RERR | 0x05 | Route Error |
|
|
108
|
+
| HELLO | 0x06 | Neighbor discovery beacon |
|
|
109
|
+
| KEXCH | 0x07 | Key exchange (X25519) |
|
|
110
|
+
| FRAG | 0x08 | Fragment of larger message |
|
|
111
|
+
| PING | 0x09 | Keepalive / latency test |
|
|
112
|
+
| CTRL | 0x0A | Control / management |
|
|
113
|
+
|
|
114
|
+
### Compression Strategy
|
|
115
|
+
|
|
116
|
+
| Mode | Algorithm | Ratio | Speed | Use Case |
|
|
117
|
+
|------|-----------|-------|-------|----------|
|
|
118
|
+
| Fast | LZ4 | ~2:1 | 780 MB/s | Real-time chat, telemetry |
|
|
119
|
+
| Balanced | Zstd L3 | ~3:1 | 350 MB/s | General data |
|
|
120
|
+
| Maximum | Zstd L19 | ~5:1 | 15 MB/s | File transfer (pre-compress) |
|
|
121
|
+
| None | Passthrough | 1:1 | ∞ | Already compressed / encrypted data |
|
|
122
|
+
|
|
123
|
+
Adaptive mode auto-selects based on payload size and channel conditions.
|
|
124
|
+
|
|
125
|
+
### Security Model
|
|
126
|
+
|
|
127
|
+
1. **Key Exchange**: X25519 ECDH with ephemeral keys per session
|
|
128
|
+
2. **Encryption**: ChaCha20-Poly1305 AEAD (authenticated encryption)
|
|
129
|
+
3. **Anti-Replay**: 64-bit monotonic counter + sliding window (128 entries)
|
|
130
|
+
4. **Key Rotation**: Automatic rekeying every 1000 messages or 1 hour
|
|
131
|
+
5. **Forward Secrecy**: Ephemeral keys destroyed after session
|
|
132
|
+
6. **Zero Metadata Leakage**: Encrypted headers after initial handshake
|
|
133
|
+
|
|
134
|
+
## Installation
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pip install nullsec-lora-mesh
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Hardware Requirements
|
|
141
|
+
|
|
142
|
+
- **Flipper One** with LoRa module
|
|
143
|
+
- **SX1262** or **SX1276** LoRa transceiver
|
|
144
|
+
- Any LoRa HAT for Raspberry Pi (for gateway nodes)
|
|
145
|
+
|
|
146
|
+
## Quick Start
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from nullsec_lora import MeshNode, LoRaConfig
|
|
150
|
+
|
|
151
|
+
# Configure LoRa radio
|
|
152
|
+
config = LoRaConfig(
|
|
153
|
+
frequency=915.0, # MHz (US ISM band)
|
|
154
|
+
bandwidth=125000, # Hz
|
|
155
|
+
spreading_factor=7, # SF7-SF12
|
|
156
|
+
coding_rate=5, # 4/5
|
|
157
|
+
tx_power=14, # dBm
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
# Create a mesh node
|
|
161
|
+
node = MeshNode(
|
|
162
|
+
node_id=0x00000001,
|
|
163
|
+
config=config,
|
|
164
|
+
compression="adaptive",
|
|
165
|
+
encryption=True,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
# Start the node
|
|
169
|
+
node.start()
|
|
170
|
+
|
|
171
|
+
# Send a message
|
|
172
|
+
node.send(
|
|
173
|
+
dest=0x00000002,
|
|
174
|
+
data=b"Hello from the mesh!",
|
|
175
|
+
reliable=True, # Request ACK
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
# Receive messages
|
|
179
|
+
for msg in node.receive():
|
|
180
|
+
print(f"From {msg.src}: {msg.data}")
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Project Structure
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
nullsec-lora-mesh/
|
|
187
|
+
├── README.md
|
|
188
|
+
├── LICENSE
|
|
189
|
+
├── pyproject.toml
|
|
190
|
+
├── protocol/
|
|
191
|
+
│ ├── __init__.py
|
|
192
|
+
│ ├── frame.py # Frame encoding/decoding
|
|
193
|
+
│ ├── compression.py # LZ4/Zstd adaptive compression
|
|
194
|
+
│ ├── crypto.py # ChaCha20-Poly1305 + X25519
|
|
195
|
+
│ ├── fec.py # Reed-Solomon forward error correction
|
|
196
|
+
│ └── routing.py # AODV mesh routing
|
|
197
|
+
├── transport/
|
|
198
|
+
│ ├── __init__.py
|
|
199
|
+
│ ├── fragment.py # Message fragmentation
|
|
200
|
+
│ ├── reassembly.py # Fragment reassembly
|
|
201
|
+
│ └── flow.py # Flow control / congestion
|
|
202
|
+
├── radio/
|
|
203
|
+
│ ├── __init__.py
|
|
204
|
+
│ ├── lora.py # LoRa radio abstraction
|
|
205
|
+
│ ├── sx1262.py # SX1262 driver
|
|
206
|
+
│ └── flipper.py # Flipper One integration
|
|
207
|
+
├── node/
|
|
208
|
+
│ ├── __init__.py
|
|
209
|
+
│ ├── mesh.py # MeshNode main class
|
|
210
|
+
│ ├── neighbor.py # Neighbor table management
|
|
211
|
+
│ └── config.py # Node configuration
|
|
212
|
+
├── apps/
|
|
213
|
+
│ ├── chat.py # Mesh chat application
|
|
214
|
+
│ ├── file_transfer.py # Compressed file transfer
|
|
215
|
+
│ └── telemetry.py # Sensor telemetry relay
|
|
216
|
+
└── tests/
|
|
217
|
+
├── test_frame.py
|
|
218
|
+
├── test_compression.py
|
|
219
|
+
├── test_crypto.py
|
|
220
|
+
└── test_routing.py
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Roadmap
|
|
224
|
+
|
|
225
|
+
- [x] Protocol specification
|
|
226
|
+
- [x] Frame encoding/decoding
|
|
227
|
+
- [x] Compression layer (LZ4/Zstd)
|
|
228
|
+
- [x] Encryption layer (ChaCha20-Poly1305)
|
|
229
|
+
- [ ] FEC (Reed-Solomon)
|
|
230
|
+
- [ ] AODV routing implementation
|
|
231
|
+
- [ ] Flipper One radio driver
|
|
232
|
+
- [ ] File transfer application
|
|
233
|
+
- [ ] Mesh chat application
|
|
234
|
+
- [ ] Performance benchmarks
|
|
235
|
+
- [ ] Hardware testing with SX1262
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
240
|
+
|
|
241
|
+
## Author
|
|
242
|
+
|
|
243
|
+
**NullSec** (bad-antics) — badxantics@gmail.com
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# NullSec LoRa Mesh
|
|
2
|
+
|
|
3
|
+
> Zero-leakage, high-speed compressed mesh communications framework for Flipper One and LoRa-enabled devices.
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://www.python.org/)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
NullSec LoRa Mesh is a protocol framework for building secure, resilient mesh networks over LoRa radio. Designed for the **Flipper One** and compatible LoRa hardware, it provides:
|
|
11
|
+
|
|
12
|
+
- **Zero-leakage encryption** — ChaCha20-Poly1305 with ephemeral key exchange
|
|
13
|
+
- **High-speed compression** — LZ4/Zstandard adaptive compression for maximum throughput
|
|
14
|
+
- **Mesh routing** — Dynamic multi-hop routing with AODV-inspired protocol
|
|
15
|
+
- **Forward Error Correction** — Reed-Solomon FEC for reliable delivery over noisy channels
|
|
16
|
+
- **Anti-replay protection** — Monotonic counters and sliding window verification
|
|
17
|
+
- **Minimal overhead** — Designed for LoRa's low bandwidth (0.3 - 50 kbps)
|
|
18
|
+
|
|
19
|
+
## Architecture
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌─────────────────────────────────────────────────────┐
|
|
23
|
+
│ APPLICATION │
|
|
24
|
+
│ Chat │ File Transfer │ Telemetry │
|
|
25
|
+
├─────────────────────────────────────────────────────┤
|
|
26
|
+
│ TRANSPORT │
|
|
27
|
+
│ Fragmentation │ Reassembly │ Flow Control │
|
|
28
|
+
├─────────────────────────────────────────────────────┤
|
|
29
|
+
│ SECURITY │
|
|
30
|
+
│ ChaCha20-Poly1305 │ X25519 ECDH │ Anti-Replay │
|
|
31
|
+
├─────────────────────────────────────────────────────┤
|
|
32
|
+
│ COMPRESSION │
|
|
33
|
+
│ LZ4 (fast) │ Zstd (ratio) │ Adaptive │
|
|
34
|
+
├─────────────────────────────────────────────────────┤
|
|
35
|
+
│ MESH ROUTING │
|
|
36
|
+
│ AODV │ Flooding │ Gossip │ Route Maintenance │
|
|
37
|
+
├─────────────────────────────────────────────────────┤
|
|
38
|
+
│ LINK LAYER │
|
|
39
|
+
│ FEC (Reed-Solomon) │ CRC32 │ Duty Cycle Mgmt │
|
|
40
|
+
├─────────────────────────────────────────────────────┤
|
|
41
|
+
│ PHYSICAL │
|
|
42
|
+
│ LoRa SX1262/SX1276 │ SubGHz │ Flipper One │
|
|
43
|
+
└─────────────────────────────────────────────────────┘
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Protocol Design
|
|
47
|
+
|
|
48
|
+
### Frame Format
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
┌──────┬──────┬──────┬────────┬──────────┬──────────┬─────┐
|
|
52
|
+
│ Sync │ Ver │ Type │ Src ID │ Dst ID │ Seq/Frag │ Len │
|
|
53
|
+
│ 2B │ 1B │ 1B │ 4B │ 4B │ 4B │ 2B │
|
|
54
|
+
├──────┴──────┴──────┴────────┴──────────┴──────────┴─────┤
|
|
55
|
+
│ Payload (encrypted) │
|
|
56
|
+
│ 0 - 222 bytes │
|
|
57
|
+
├─────────────────────────────────────────────────────────┤
|
|
58
|
+
│ Auth Tag (16B) │
|
|
59
|
+
├─────────────────────────────────────────────────────────┤
|
|
60
|
+
│ FEC Parity (variable) │
|
|
61
|
+
└─────────────────────────────────────────────────────────┘
|
|
62
|
+
|
|
63
|
+
Total overhead: 18B header + 16B auth + FEC = ~40B minimum
|
|
64
|
+
Max payload per frame: 222 bytes (LoRa max 255B - overhead)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Message Types
|
|
68
|
+
|
|
69
|
+
| Type | ID | Description |
|
|
70
|
+
|------|-----|-------------|
|
|
71
|
+
| DATA | 0x01 | Encrypted data payload |
|
|
72
|
+
| ACK | 0x02 | Acknowledgment |
|
|
73
|
+
| RREQ | 0x03 | Route Request (broadcast) |
|
|
74
|
+
| RREP | 0x04 | Route Reply (unicast) |
|
|
75
|
+
| RERR | 0x05 | Route Error |
|
|
76
|
+
| HELLO | 0x06 | Neighbor discovery beacon |
|
|
77
|
+
| KEXCH | 0x07 | Key exchange (X25519) |
|
|
78
|
+
| FRAG | 0x08 | Fragment of larger message |
|
|
79
|
+
| PING | 0x09 | Keepalive / latency test |
|
|
80
|
+
| CTRL | 0x0A | Control / management |
|
|
81
|
+
|
|
82
|
+
### Compression Strategy
|
|
83
|
+
|
|
84
|
+
| Mode | Algorithm | Ratio | Speed | Use Case |
|
|
85
|
+
|------|-----------|-------|-------|----------|
|
|
86
|
+
| Fast | LZ4 | ~2:1 | 780 MB/s | Real-time chat, telemetry |
|
|
87
|
+
| Balanced | Zstd L3 | ~3:1 | 350 MB/s | General data |
|
|
88
|
+
| Maximum | Zstd L19 | ~5:1 | 15 MB/s | File transfer (pre-compress) |
|
|
89
|
+
| None | Passthrough | 1:1 | ∞ | Already compressed / encrypted data |
|
|
90
|
+
|
|
91
|
+
Adaptive mode auto-selects based on payload size and channel conditions.
|
|
92
|
+
|
|
93
|
+
### Security Model
|
|
94
|
+
|
|
95
|
+
1. **Key Exchange**: X25519 ECDH with ephemeral keys per session
|
|
96
|
+
2. **Encryption**: ChaCha20-Poly1305 AEAD (authenticated encryption)
|
|
97
|
+
3. **Anti-Replay**: 64-bit monotonic counter + sliding window (128 entries)
|
|
98
|
+
4. **Key Rotation**: Automatic rekeying every 1000 messages or 1 hour
|
|
99
|
+
5. **Forward Secrecy**: Ephemeral keys destroyed after session
|
|
100
|
+
6. **Zero Metadata Leakage**: Encrypted headers after initial handshake
|
|
101
|
+
|
|
102
|
+
## Installation
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install nullsec-lora-mesh
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Hardware Requirements
|
|
109
|
+
|
|
110
|
+
- **Flipper One** with LoRa module
|
|
111
|
+
- **SX1262** or **SX1276** LoRa transceiver
|
|
112
|
+
- Any LoRa HAT for Raspberry Pi (for gateway nodes)
|
|
113
|
+
|
|
114
|
+
## Quick Start
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from nullsec_lora import MeshNode, LoRaConfig
|
|
118
|
+
|
|
119
|
+
# Configure LoRa radio
|
|
120
|
+
config = LoRaConfig(
|
|
121
|
+
frequency=915.0, # MHz (US ISM band)
|
|
122
|
+
bandwidth=125000, # Hz
|
|
123
|
+
spreading_factor=7, # SF7-SF12
|
|
124
|
+
coding_rate=5, # 4/5
|
|
125
|
+
tx_power=14, # dBm
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
# Create a mesh node
|
|
129
|
+
node = MeshNode(
|
|
130
|
+
node_id=0x00000001,
|
|
131
|
+
config=config,
|
|
132
|
+
compression="adaptive",
|
|
133
|
+
encryption=True,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
# Start the node
|
|
137
|
+
node.start()
|
|
138
|
+
|
|
139
|
+
# Send a message
|
|
140
|
+
node.send(
|
|
141
|
+
dest=0x00000002,
|
|
142
|
+
data=b"Hello from the mesh!",
|
|
143
|
+
reliable=True, # Request ACK
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
# Receive messages
|
|
147
|
+
for msg in node.receive():
|
|
148
|
+
print(f"From {msg.src}: {msg.data}")
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Project Structure
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
nullsec-lora-mesh/
|
|
155
|
+
├── README.md
|
|
156
|
+
├── LICENSE
|
|
157
|
+
├── pyproject.toml
|
|
158
|
+
├── protocol/
|
|
159
|
+
│ ├── __init__.py
|
|
160
|
+
│ ├── frame.py # Frame encoding/decoding
|
|
161
|
+
│ ├── compression.py # LZ4/Zstd adaptive compression
|
|
162
|
+
│ ├── crypto.py # ChaCha20-Poly1305 + X25519
|
|
163
|
+
│ ├── fec.py # Reed-Solomon forward error correction
|
|
164
|
+
│ └── routing.py # AODV mesh routing
|
|
165
|
+
├── transport/
|
|
166
|
+
│ ├── __init__.py
|
|
167
|
+
│ ├── fragment.py # Message fragmentation
|
|
168
|
+
│ ├── reassembly.py # Fragment reassembly
|
|
169
|
+
│ └── flow.py # Flow control / congestion
|
|
170
|
+
├── radio/
|
|
171
|
+
│ ├── __init__.py
|
|
172
|
+
│ ├── lora.py # LoRa radio abstraction
|
|
173
|
+
│ ├── sx1262.py # SX1262 driver
|
|
174
|
+
│ └── flipper.py # Flipper One integration
|
|
175
|
+
├── node/
|
|
176
|
+
│ ├── __init__.py
|
|
177
|
+
│ ├── mesh.py # MeshNode main class
|
|
178
|
+
│ ├── neighbor.py # Neighbor table management
|
|
179
|
+
│ └── config.py # Node configuration
|
|
180
|
+
├── apps/
|
|
181
|
+
│ ├── chat.py # Mesh chat application
|
|
182
|
+
│ ├── file_transfer.py # Compressed file transfer
|
|
183
|
+
│ └── telemetry.py # Sensor telemetry relay
|
|
184
|
+
└── tests/
|
|
185
|
+
├── test_frame.py
|
|
186
|
+
├── test_compression.py
|
|
187
|
+
├── test_crypto.py
|
|
188
|
+
└── test_routing.py
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Roadmap
|
|
192
|
+
|
|
193
|
+
- [x] Protocol specification
|
|
194
|
+
- [x] Frame encoding/decoding
|
|
195
|
+
- [x] Compression layer (LZ4/Zstd)
|
|
196
|
+
- [x] Encryption layer (ChaCha20-Poly1305)
|
|
197
|
+
- [ ] FEC (Reed-Solomon)
|
|
198
|
+
- [ ] AODV routing implementation
|
|
199
|
+
- [ ] Flipper One radio driver
|
|
200
|
+
- [ ] File transfer application
|
|
201
|
+
- [ ] Mesh chat application
|
|
202
|
+
- [ ] Performance benchmarks
|
|
203
|
+
- [ ] Hardware testing with SX1262
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
208
|
+
|
|
209
|
+
## Author
|
|
210
|
+
|
|
211
|
+
**NullSec** (bad-antics) — badxantics@gmail.com
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
NullSec LoRa Mesh - Applications
|
|
3
|
+
|
|
4
|
+
CLI and application layer for mesh node management.
|
|
5
|
+
|
|
6
|
+
Provides:
|
|
7
|
+
- nullsec-mesh CLI tool (click-based)
|
|
8
|
+
- Node lifecycle management
|
|
9
|
+
- Real-time traffic monitoring
|
|
10
|
+
- Link quality benchmarking
|
|
11
|
+
- Protocol stack analysis
|
|
12
|
+
"""
|