Skip to content
This repository was archived by the owner on Nov 11, 2026. It is now read-only.
rmediatechPublic archive

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bastion: System Network Assessment & Interdiction Engine

Welcome to the Bastion documentation and architecture showcase repository. This repository serves as the public-facing architectural blueprint, topology mapping, and operational reference for the closed-source bastion project.

Bastion is a highly modular, enterprise-grade native systems compiler network assessment and defense engine. It features zero-allocation binary parsing, asynchronous raw socket sniffing, and lock-free kernel-level packet filter hooks (XDP/eBPF).


🏗️ System Architecture & Data Flow

Bastion is built as a capability-first background daemon paired with CLI controller planes and native library boundaries:

flowchart TB
    subgraph Control & Interface Plane
        A[Dashboard Controller] -->|WebSockets / Signaling| B[Control Plane Portal]
        C[Unified Sovereign CLI 'bastion'] -->|Unix Domain Socket UDS| D[Bastion Master Daemon]
    end

    subgraph Process & Analysis Plane
        D -->|Asynchronous Process Spawn| E[High-Speed Scanner 'scan']
        D -->|Asynchronous Process Spawn| F[UDP Scout Engine 'udp']
        D -->|Asynchronous Process Spawn| G[Layer 2 Subnet Sweep 'discover']
    end

    subgraph Kernel & Hardware Plane
        D -->|Packet Forge| H[Raw Socket Packet Injector]
        D -->|eBPF / XDP Hook| I[Kernel-Level Socket Filter]
        H --> J[Physical Interface Layer]
        I --> J
    end

    style D fill:#0b3d2e,stroke:#27ae60,color:#d5ffe9,stroke-width:1px
    style I fill:#1f3c4d,stroke:#3498db,color:#d5f0ff,stroke-width:1px
    style E fill:#1e1e1e,stroke:#333,color:#fff
    style F fill:#1e1e1e,stroke:#333,color:#fff
    style G fill:#1e1e1e,stroke:#333,color:#fff
Loading

🧩 Workspace Crate Architecture

Bastion strictly adheres to the One-Job-Principle (OJP) via modular workspaces:

  • core: Pure bitwise IP radix tries, L3/L4 policy evaluation, rate limiting, and zero-allocation network primitives.
  • daemon: The elevated background service managing kernel hooks (XDP/eBPF), Unix Domain Socket IPC (/tmp/bastion_master.sock), and lock-free atomic policy updates via Read-Copy-Update (RCU).
  • cli: The unified sovereign control utility (bastion). Features offline topic help, full UNIX man pages, 4 interchange formats, and 5 operational projection lenses.
  • ebpf & xdp: The raw kernel-level packet hook and shared BPF maps layer, allowing high-performance traffic drop controls directly in the network card driver path.
  • forge: A zero-copy TCP/UDP raw packet factory with O(1) buffer allocation bypassing the host OS protocol stack.
  • recon: Active and passive network discovery, stealth SYN sweeps, and TTL/window fingerprinting.
  • fingerprint: Heuristic protocol analysis and passive operating system identification.
  • utils: High-performance CIDR engines, network interface discovery, and IEEE OUI vendor resolution.
  • ffi: The stable C-compatible native interface (libbastion_ffi.so), allowing foreign runtime integrations.

🛡️ Core Capabilities

1. Lock-Free Packet Mitigation (Kernel-Level Hooks)

Utilizes kernel-level instruction bytecode loaded directly into network hook points (XDP). When an operator issues a block/unblock policy, the system updates a shared lock-free map, allowing packet drop evaluations to complete in nanoseconds at the driver level without kernel-to-userspace context switches.

2. Zero-Probe Passive OS Fingerprinting

By monitoring network interfaces passively, Bastion intercepts TCP syn-acks, matching IPv4 TTLs, window sizes, and IPv6 Hop Limits against operating system signature profiles. This allows it to classify network hosts without sending a single active probe.

3. Non-Blocking Bidirectional Orchestration

The daemon maintains a persistent coordinate connection, streaming structured CSV and JSON outputs in real-time. Command execution is delegated to spawned asynchronous readers, preventing communication deadlocks during active sweeps.


🎛️ Unified Sovereign CLI Interface

Bastion exposes a comprehensive, self-documenting command-line interface:

$ bastion --help
Usage: bastion [OPTIONS] [COMMAND]

Commands:
  ping     Ping the running daemon over UDS to verify health
  status   Retrieve active firewall drop-counters and engine state
  block    Add an IP or CIDR to the active kernel drop-list
  unblock  Remove an IP or CIDR from the active drop-list
  policy   Export or import complete firewall policy rule states
  syn      Display SYN defense metrics and velocity threshold rates
  help     Interactive help manual and topic deep dives
  man      Full UNIX-style manual page

Options:
  -f, --format <FORMAT>  [default: tui] [possible values: tui, md, json, csv]
  -l, --lens <LENS>      [default: grid] [possible values: 1..5, grid, story, tree, spec, waterfall]
  -v, --verbose          Enable verbose diagnostic output
  -s, --socket <SOCKET>  Override daemon UDS socket path

4 Interchange Formats (-f, --format)

  • tui: Colorized terminal UI cards and formatted tables.
  • md: GitHub-Flavored Markdown reports.
  • json: Machine-readable, zero-allocation structured JSON.
  • csv: Spreadsheet-ready data strictly defended against Formula Injection (=, +, -, @, \t, \r escaped with ').

5 Operational Lenses (-l, --lens <1..5>)

  • 1 | grid: Compact dashboard card view.
  • 2 | story: Chronological firewall event narrative.
  • 3 | tree: Hierarchical architecture and subsystem breakdown.
  • 4 | spec: Raw technical parameter audit table.
  • 5 | waterfall: Distribution histogram and latency breakdown chart.

🖥️ Expected CLI Outputs & Telemetry

Below are real-world expected stdout results collected during operations on an RFC 5737 documentation subnet (198.51.100.0/24) testing against target hosts:

1. Layer 2 Discovery Sweep (discover)

Performs high-speed active/passive ARP and NDP subnet mapping:

$ discover wlan0 --stdout --cidr 198.51.100.0/24
[*] Initializing Fast L2 Discovery on interface: wlan0
  -> Source MAC: 00:11:22:33:44:55
  -> Source IPv4: 198.51.100.57
  -> Sweeping subnet: 198.51.100.0/24
  -> Source IPv6: 2001:db8:85a3::8a2e:370:7334

[!] Draining Subnet Matrix (254 ARP / 254 NDP)...
[*] Broadcasting IPv6 ff02::1 Multicast Echo Request...
[*] Broadcasting active SSDP & mDNS multicast discovery queries...
[*] Raw packet drainage complete. Yielding for returns (3s)...

[+] Network convergence captured. Found 14 active hosts.
[+] Aggregated down to 14 distinct Layer 2 endpoints.

--- CSV REPORT ---
IP,MAC,Hostname
198.51.100.1,00:11:22:33:44:01,gateway_router
198.51.100.159,00:11:22:33:44:59,network_printer
198.51.100.160,00:11:22:33:44:60,workstation_ssh
198.51.100.185,00:11:22:33:44:85,smart_tv_display
[+] Target sequence completed.

2. TCP Stealth SYN & Banner Scan (scan)

Scans host ports using raw half-open SYN packets (falling back to user-space Connect sockets when permissions aren't elevated) and initiates zero-allocation active fingerprinters on discovery:

# Scan custom target SSH port on workstation
$ scan 198.51.100.160 22,80,443,2222
>> Engine initialized. Scanning 4 ports on 198.51.100.160 using Stealth SYN (auto-fallback) ...
============================================================
 🔥 TACTICAL SCAN RESULTS FOR 198.51.100.160
============================================================
 [+] PORT 2222  : OPEN ... [ SSH-2.0-OpenSSH_9.2p1 Linux-2+deb12u10 ]
============================================================
# Scan default TCP services on the subnet gateway router
$ scan 198.51.100.1 53,80,443
>> Engine initialized. Scanning 3 ports on 198.51.100.1 using Stealth SYN (auto-fallback) ...
============================================================
 🔥 TACTICAL SCAN RESULTS FOR 198.51.100.1
============================================================
 [+] PORT 53    : OPEN ... [ DNS TCP Service ]
 [+] PORT 80    : OPEN ... [ HTTP/1.0 301 Moved Permanently ]
 [+] PORT 443   : OPEN ... [ Unknown (Raw: ) ]
============================================================

3. UDP Active Protocol Scouting (udp)

Verifies UDP listeners. Since UDP is connectionless, --scout actively fires NTP, SSDP, SNMP, and DNS signature payloads to verify response patterns:

$ udp 198.51.100.1 53,123,161,1900 --scout
[*] Initializing UDP Tactical Scout on 198.51.100.1...
[*] Sending active protocol probes (DNS, NTP, SNMP, SSDP)...
============================================================
 🔥 UDP SCOUT RESULTS FOR 198.51.100.1
============================================================
 [+] PORT 53    : OPEN       ... [ DNS Responder ]
 [+] PORT 123   : OPEN       ... [ NTP Server Daemon ]
 [+] PORT 1900  : FILTERED   ... [ SSDP UPnP Advertisements ]
============================================================

🕶️ Operational Disclosure Model

Documentation in this repository emphasizes operational outcomes, interfaces, and architecture topologies over vendor-specific deployment details. Low-level internal structures are mapped only where required for platform compatibility.


📂 Extended Documentation Guides

For detailed engineering checklists, integration protocols, and testing models, refer to:


© 2026. All Rights Reserved. This showcase documentation is open-source; the core implementation codebase is private and proprietary.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors