Skip to content
HarshuBuildsPublic

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

๐Ÿ“ก SilentNet

License: MIT Python: 3.8+ UI: CustomTkinter Network: P2P Mesh E2EE: AES--256--GCM

Zero-Infrastructure Decentralized Emergency Mesh Network


SilentNet Desktop UI

Important

Disaster Protocol Scenario: Centralized telecommunications infrastructure, cellular base stations, and internet backbones are offline. SilentNet creates an ad-hoc, self-healing communication grid over local Wi-Fi and Ethernet subnets. It requires zero external servers and no custom hardware, deploying entirely on standard laptops and workstations.


โšก The Problem & The Solution

The Problem ๐Ÿ“‰

During large-scale natural disasters (hurricanes, earthquakes, grid failures) or physical infrastructure attacks, centralized communication channels collapse. Traditional messaging suites (WhatsApp, Signal, Slack) are rendered useless without access to cloud servers. Survivors and emergency response personnel are left isolated, unable to exchange medical status, request supplies, or coordinate perimeter security.

The Solution ๐Ÿ›ก๏ธ

SilentNet is a zero-configuration, serverless, peer-to-peer (P2P) mesh networking protocol and client suite. By utilizing localized network interfaces, it automatically detects neighboring nodes, establishes a cooperative routing network, and routes end-to-end encrypted (E2EE) messages. If two nodes are out of direct contact but share a common neighbor, the network automatically computes and forwards packets through intermediate hops.


๐Ÿš€ Core Features

  • ๐Ÿ“ก Decentralized P2P Mesh Routing (TCP/UDP): SilentNet utilizes a hybrid network architecture. Periodic UDP broadcasts disseminate active routing tables and cryptographic public keys. Point-to-point TCP tunnels are dynamically created to forward packets across multi-hop paths using a local Shortest-Path routing algorithm.
  • ๐Ÿง  Offline NLP Medical & Hazard Triage: Powered by a zero-dependency, local Natural Language Processing (NLP) classifier ([triage_engine.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/triage_engine.py)). Transmissions are scanned for word-boundary hazard stems (e.g., breach, hostile, bleeding, starving, rations), auto-tagged for priority (SECURITY > MEDICAL > SUPPLIES > GENERAL), and automatically routed into dedicated tactical feed tabs.
  • ๐Ÿ”’ Secure Private Squads: Create isolated communication channels (Squads) protected by hybrid end-to-end encryption. Symmetric session keys are generated on-the-fly and asymmetrically sealed for each participant, ensuring intermediate relays cannot peek into private group coordination.
  • ๐Ÿฉบ Global & Medical Emergency Channels: Open, network-wide broadcast channels designed to facilitate direct medical requests, volunteer coordination, and general status updates.
  • ๐Ÿ•น๏ธ Tactical Radar visualization: A custom, hardware-accelerated radar canvas ([desktop_app.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/desktop_app.py)). Visualizes neighboring nodes as glowing blips plotted deterministically using MD5 name-hash spatial mapping, featuring a cinematic sweep gradient and an acoustic alert ping when survivors are swept.
  • ๐Ÿ’ป Cross-Interface Deployments: Runs as a rich CustomTkinter Desktop GUI, an interactive terminal Textual dashboard ([silent_net_tui.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/silent_net_tui.py)), or a pure headless command-line interface daemon ([silent_net.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/silent_net.py)).
  • ๐Ÿ’ฅ Chaos Resilience & Self-Healing: The system incorporates a simulation Chaos Engine ([chaos_engine.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/chaos_engine.py)) that mimics sudden node dropouts and EMP strikes, enabling real-world verification of dynamic routing updates and automatic path recalculations.

๐Ÿ—๏ธ Technical Architecture

SilentNet operates on a modular architecture divided into clean functional domains:

graph TD
    A[UI / TUI Layer] <-->|Thread-Safe Queues| B[SilentNode Network Broker]
    B <-->|Symmetric/Asymmetric Crypto| C[Crypto Engine]
    B <-->|Payload Filtering| D[Triage Engine]
    B <-->|Simulation Testing| E[Chaos Engine]
    
    subgraph Socket Broker
        B -->|UDP Broadcasts| F[Neighbor Discovery]
        B -->|TCP Sockets| G[Multi-hop BFS Router]
    end
Loading

1. Decentralized Node Discovery & Network Topology

Every node runs a daemon thread broadcasting UDP packets containing local discovery metadata to the subnet broadcast address (e.g., 255.255.255.255). This payload includes:

  • Local IP address and dynamic TCP server port.
  • RSA-2048 Public Key in PEM format.
  • A list of currently active neighbors (creating a distributed topological map).

Receiving nodes update their internal routing dictionary, caching peers and public keys. Stale nodes are pruned automatically by a background thread after a 15-second timeout of missing heartbeats.

2. Multi-hop Breadth-First Search (BFS) Routing

When a message is sent to a target node that is not directly reachable on the local subnet:

  1. The sending node parses the cached distributed topology to construct a directional graph.
  2. A Breadth-First Search (BFS) algorithm computes the shortest route vector: $$\text{Route} = [\text{Node}_A \rightarrow \text{Node}_B \rightarrow \text{Node}_C]$$
  3. The packet is wrapped with an unencrypted routing header detailing the next hop and final destination, while the payload is sealed.
  4. Intermediate nodes inspect the header, verify they are the designated next hop, and forward the raw packet down the path. They cannot read or modify the encrypted payload.
sequenceDiagram
    participant A as Sender Node (A)
    participant B as Relay Node (B)
    participant C as Recipient Node (C)

    Note over A: 1. Generate AES-256 session key & IV<br/>2. Encrypt message payload using AES-GCM<br/>3. Seal AES key using C's RSA-2048 Public Key
    Note over A: 4. Compute BFS path: [Node-A -> Node-B -> Node-C]
    A->>B: TCP connection: Send routed packet
    Note over B: Read unencrypted 'final_destination' routing header<br/>Forward raw packet to C
    B->>C: TCP connection: Forward raw packet
    Note over C: 1. Decrypt AES key with local RSA Private Key<br/>2. Decrypt payload via AES-GCM<br/>3. Run plaintext through NLP Triage Engine
Loading

3. Dynamic TCP Port Scaling

In order to allow seamless simulation of multiple local nodes on a single physical machine during development:

  • Instead of failing on bind conflicts (port already in use), SilentNet dynamically increments the TCP listening port:
    tcp_port = args.tcp
    while True:
        try:
            test_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            test_sock.bind(('0.0.0.0', tcp_port))
            test_sock.close()
            break
        except OSError:
            tcp_port += 1
  • The dynamically assigned port is broadcasted in the node's UDP heartbeat so peers automatically connect to the updated port.

4. Hybrid Cryptosystem (RSA-2048 + AES-256-GCM)

SilentNet relies on end-to-end encryption (E2EE) built on top of the cryptography library ([crypto_engine.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/crypto_engine.py)):

  • Asymmetric Envelope: RSA-2048 (OAEP with SHA-256 digest) is used to safely transmit symmetric keys between peers.
  • Symmetric Encryption: AES-256-GCM ensures authenticated, high-performance encryption of the actual message text and metadata.
  • Base64 Encapsulation: Binary bytes are encoded into base64 characters for transport inside JSON socket packets.

5. Thread Safety & UI Concurrency

To ensure CustomTkinter remains responsive and free of graphical freezes, SilentNet runs network operations asynchronously:

  • UI rendering and animations run on the main Tkinter thread.
  • Sockets, cryptographic key generation, file system logging, and network pruning run on independent, daemon-configured worker threads.
  • All state updates (such as discoveries, arrivals, and logs) are posted to a thread-safe FIFO Queue (queue.Queue) read periodically by the UI loop, avoiding raw Tkinter cross-thread crashes. Shared data maps are guarded with threading.Lock and threading.RLock mutexes.

๐Ÿ› ๏ธ Installation & Build

Prerequisites

  • Python 3.8 or higher.
  • C++ Compiler Build Tools (required for installing some cryptographic libraries).

Installing Dependencies

Install all required libraries from the terminal:

pip install customtkinter cryptography rich textual pyinstaller

Compiling to a Standalone Executable

To package the Python source files into a single, dependency-free executable binary for Windows, use the automated build tool ([build_exe.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/build_exe.py)):

python build_exe.py

This script automatically locates the CustomTkinter asset directory in your local environment, cleans up previous builds, and compiles desktop_app.py using PyInstaller.

Manual PyInstaller Compilation Command

If you prefer to compile manually, run the following command (substitute the path to CustomTkinter's assets according to your virtual environment location):

pyinstaller --onefile --windowed --name SilentNet --clean --noconfirm --collect-all customtkinter --add-data "C:\Users\<YourUser>\AppData\Local\Programs\Python\Python39\Lib\site-packages\customtkinter\assets;customtkinter/assets" desktop_app.py

๐ŸŽฎ Usage Guide

1. Launching Nodes

Option A: Graphical Desktop App ๐Ÿ–ฅ๏ธ

Run the desktop app from source:

python desktop_app.py

Or launch the pre-compiled binary located inside the dist/ directory.

Option B: Terminal User Interface (TUI) ๐Ÿ“Ÿ

For headless servers or low-power terminal environments:

python silent_net_tui.py

Option C: Headless Command Line Interface (CLI) โš™๏ธ

For raw command-line usage and scripting:

python silent_net.py --name Command-Center

2. Local Mesh Simulation (Multi-Node Setup)

To test mesh discovery, multi-hop routing, and triage routing on a single development machine:

  1. Open 3 separate terminals.
  2. Launch the nodes, assigning distinct names:
    • Terminal 1: python desktop_app.py --name Survivor-A
    • Terminal 2: python desktop_app.py --name Survivor-B
    • Terminal 3: python desktop_app.py --name Survivor-C
  3. The nodes will dynamically scale their TCP ports, exchange UDP heartbeats, and display glowing blips on their tactical radars.

3. Forming Private Squads

  1. Click "Form Squad" in the sidebar.
  2. Enter a unique Squad name.
  3. Select active peers from the checklist to include in the squad.
  4. Click "Create Squad" to distribute the squad keys. An E2EE-protected tab will appear on all squad members' dashboards.

4. Simulating Network Disruption (EMP Strike)

  1. On one of the nodes (e.g., Survivor-B), click the "Trigger EMP Strike" button in the lower dashboard panel.
  2. Survivor-B will immediately shut down its socket listeners and broadcasters, advertising its offline status.
  3. Survivor-A and Survivor-C will dynamically detect the loss of Survivor-B, prune it from their routing maps, and auto-heal the pathfinding vectors to redirect communications.

๐Ÿงช Automated Verification & Testing

Verify that your network setup and pathfinding code function nominally by running the test suite:

  • Integration Test: Verifies basic socket binds, key creation, and direct E2EE message exchanges:
    python test_integration.py
  • Resilience & Chaos Test: Spins up a virtual 3-node topology, blocks direct connections between ends to force multi-hop routing, triggers an EMP strike on the central relay node, and asserts that the pending messages are buffered and routes auto-heal:
    python test_chaos.py

๐Ÿ“‚ Codebase File Layout

Component Source File Description
Desktop Client [desktop_app.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/desktop_app.py) CustomTkinter GUI featuring the custom tactical radar widget, message triage feed tabs, and the EMP simulation control room.
Network Broker [silent_net.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/silent_net.py) Socket listeners/broadcasters, dynamic TCP port negotiation, and the BFS pathfinder engine.
Cryptographic Engine [crypto_engine.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/crypto_engine.py) RSA-2048 and AES-256-GCM envelope sealing, key exportation, and verification.
Triage Engine [triage_engine.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/triage_engine.py) Keyword processing, word stemming patterns, and automatic threat categorization.
Chaos Manager [chaos_engine.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/chaos_engine.py) Implements EMP simulation protocols, socket closures, and emergency broadcast indicators.
Terminal TUI [silent_net_tui.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/silent_net_tui.py) Lightweight Textual terminal user interface for command-line mesh navigation.
Compiler Tool [build_exe.py](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/build_exe.py) Script to package all custom assets and themes into a standalone executable.

SilentNet is an open-source project designed to ensure secure, resilient communications remain accessible in critical scenarios. Review the [LICENSE](file:///H:/HARSH_PROJET/HAKATOMES PROJECTS/BUILD.IT/SilentNet/LICENSE) for more details.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages