How itayshallev/spine works
1. Repository shape
SPINE is primarily a Linux-native C++ intrusion-detection and network-enforcement system. Its runtime code is under src/. A separate spine-gui/ directory contains a Vite/React frontend intended to visualize or control the system, but the visible C++ tree does not show an API/server adapter connecting that GUI to the IDS core.
2. Top-level orchestration
main.cpp is the process entry point. Shared application-level concerns are represented by configuration, componentsCommunicator, IComponent, common custom types, and utilities. These form the coordination layer around otherwise distinct detection, defense, persistence, and logging components.
3. Component boundary model
IComponent provides a common abstraction for major backend components. componentsCommunicator is the likely in-process messaging/coordination boundary between them, rather than direct coupling among every subsystem. An architecture diagram should show the components connected through this coordinator, with configuration as a shared input.
4. Traffic interception boundary
The system operates at the Linux packet-processing boundary using libnetfilter_queue, as stated in the README. netfilterCapture and netfilterPacket represent packets received from Netfilter queues; this is the primary ingress for traffic that SPINE can inspect and potentially enforce policy upon. Deployment therefore depends on Linux firewall/Netfilter rules routing packets into the configured queue.
5. Packet capture implementations
IPacketCapture abstracts packet acquisition. Two concrete capture paths exist: netfilterCapture, for Netfilter Queue interception/enforcement, and libpcapCapture, for packet capture via libpcap. This is an important pluggability boundary: downstream analysis should depend on the capture interface rather than on a specific packet source.
6. Network-stack normalization and parsing
Captured raw data is converted into the project’s packet model through packet, packetBuilder, and packetsQueue. The protocol-layer subsystem parses Ethernet, ARP, IPv4, IPv6, ICMP, TCP, and UDP headers. This layer isolates low-level byte parsing and protocol metadata extraction from attack-detection logic.
7. Packet lifecycle and output
Packet capture feeds packet construction/parsing, then packets are queued for downstream consumers. packetSender provides the complementary packet-output capability, likely used when intercepted traffic must be forwarded, reinjected, modified, or otherwise given a Netfilter verdict. Show packet ingress from the OS into capture, internal normalization/queueing, and a possible outbound/verdict path back to the network stack.
8. Attack detection subsystem
attackDetectionComponent is the detection-facing component that consumes parsed packet information. attackDetection and packetAnalyzer provide the general analysis layer, while individual detectors encapsulate specific attack signatures or thresholds: ARP spoofing, generic flooding, ICMP/ping floods, and TCP SYN floods.
9. Detection data flow
The expected central runtime flow is: Linux/Netfilter or libpcap capture → packet parsing/model → packet analysis → specialized detectors → detection event/result. Detection output should fan out to both logging and defensive response. The detection subsystem should not be drawn as owning raw socket or firewall integration; those remain network-stack and defense responsibilities.
10. Defense and enforcement subsystem
defenseComponent receives or acts on detected threats. networkRulesManager is the infrastructure-facing adapter responsible for applying network rules, likely through Linux firewall/Netfilter mechanisms. This separates deciding that traffic is malicious from changing host/network policy to block or mitigate it.
11. Persistence subsystem
The database component consists of DBComponent and DBManager. It forms a storage boundary behind a component and manager abstraction. The specific database technology is not identifiable from the provided tree, so it should be shown as an internal persistence adapter connected to an external/local database, not labeled with a particular vendor.
12. Logging subsystem
loggingComponent handles operational and security-event logging as a separate consumer of events from detection, defense, and possibly other components. It should be represented independently from the database subsystem because the repository explicitly distinguishes logging from database management.
13. Configuration and shared utilities
configuration centralizes runtime settings, likely including capture, detector, and component behavior. customTypes contains shared domain data structures, while utils provides cross-cutting helpers. These are supporting dependencies rather than independently deployed services.
14. Frontend application
spine-gui is a standalone JavaScript frontend built with React, Vite, Tailwind CSS, PostCSS, and ESLint. Its UI is organized into dashboard, block management, defense controls, logs viewing, and settings panels. These correspond conceptually to backend observability and control domains: alerts/metrics, defensive blocks/rules, operational controls, logs, and configuration.
15. GUI integration caveat
No backend HTTP API, WebSocket server, IPC bridge, or frontend service client is present in the supplied tree. The GUI should therefore be diagrammed as a separate presentation layer with an unspecified future/inferred control-and-observability interface to the C++ service, rather than as a confirmed runtime client of a concrete API.
16. Deployment view
The core SPINE process runs on Linux alongside Netfilter/libnetfilter_queue and potentially libpcap. It interfaces with live network traffic and firewall/rule infrastructure, and may connect to a database. The React GUI has its own Node/Vite development/build toolchain and produces static frontend assets; its production hosting and connection mechanism are not defined in this repository.
Main entry points: componentsCommunicator.h Component Coordinator · configuration.h Configuration · netfilterCapture.h Netfilter Capture · IPacketCapture.h Capture Interface
Components 24
SPINE Runtime
C++ application composition and coordination
- SPINE Entry Point · Initializes the Linux-native IDS process
src/main.cpp - Configuration · Shared component and capture settings
src/configuration.h - Component Coordinator · Coordination boundary for backend components
src/componentsCommunicator.h - Component Contract · Common abstraction for major backend components
src/IComponent.h
Traffic Pipeline
Packet acquisition, normalization, and enforcement path
- Capture Interface · Pluggable packet-source boundary
src/network_stack/include/IPacketCapture.h - Netfilter Capture · Intercepts packets from libnetfilter_queue
src/network_stack/include/netfilterCapture.h - libpcap Capture · Alternative packet acquisition implementation
src/network_stack/include/libpcapCapture.h - Packet Builder · Converts captured data into the packet model
src/network_stack/include/packetBuilder.h - Protocol Layers · Ethernet, ARP, IP, ICMP, TCP, and UDP parsing
src/network_stack/network_layers - Packets Queue · Queues normalized packets for downstream consumers
src/network_stack/include/packetsQueue.h - Packet Sender · Reinjects, forwards, or applies packet verdict output
src/network_stack/include/packetSender.h
Detection & Response
Threat analysis and host-policy response
- Detection Component · Consumes packets and coordinates threat detection
src/attacks_detection_component/include/attackDetectionComponent.h - Packet Analyzer · General packet analysis and detection flow
src/attacks_detection_component/include/packetAnalyzer.h - Attack Detectors · ARP spoofing, flooding, ping flood, and SYN flood detection
src/attacks_detection_component/include/attackDetection.h - Defense Component · Acts on detected threats
src/defense_component/include/defenseComponent.h - Rules Manager · Applies host network rules and mitigation policy
src/defense_component/include/networkRulesManager.h
Operations Data
Logging and persistence boundaries
- Logging Component · Operational and security-event log consumer
src/logging_component/include/loggingComponent.h - Database Component · Storage boundary for backend data
src/database_component/include/DBComponent.h - Database Manager · Manages database access behind the component
src/database_component/include/DBManager.h
Frontend
Standalone React/Vite presentation application
- React UI · Standalone dashboard and control application
spine-gui/src/App.jsx - Control Panels · Dashboard, blocks, defense controls, logs, and settings
spine-gui/src/components - Future Service Bridge · No API, WebSocket, or IPC adapter is present in the repository
Other components
- Linux Network Stack · Netfilter queues, firewall rules, and live traffic
- Database · Database technology is unspecified
Connections 31
- SPINE Entry Point → Configuration: loads
- SPINE Entry Point → Component Coordinator: starts
- Component Coordinator → Component Contract: coordinates components via
- Configuration → Capture Interface: configures
- Configuration → Detection Component: configures
- Configuration → Defense Component: configures
- Linux Network Stack → Netfilter Capture: queues intercepted traffic
- Linux Network Stack → libpcap Capture: exposes live traffic
- Capture Interface → Netfilter Capture: implemented by
- Capture Interface → libpcap Capture: implemented by
- Netfilter Capture → Packet Builder: raw packets
- libpcap Capture → Packet Builder: raw packets
- Packet Builder → Protocol Layers: parses headers
- Protocol Layers → Packets Queue: normalized packets
- Packets Queue → Detection Component: packets
- Detection Component → Packet Analyzer: analyzes
- Packet Analyzer → Attack Detectors: evaluates threats
- Attack Detectors → Component Coordinator: detection events
- Component Coordinator → Defense Component: threat response
- Component Coordinator → Logging Component: security events
- Component Coordinator → Database Component: records data
- Defense Component → Rules Manager: mitigation decisions
- Rules Manager → Linux Network Stack: applies firewall rules
- Netfilter Capture → Packet Sender: verdict/output path
- Packet Sender → Linux Network Stack: reinjection or verdict
- Logging Component → Database Component: persists logs
- Database Component → Database Manager: uses
- Database Manager → Database: stores
- React UI → Control Panels: renders
- Control Panels → Future Service Bridge: requires control and observability
- Future Service Bridge → Component Coordinator: not implemented · Inferred future integration only