How efforg/rayhunter works
Main Components
• Daemon/Server (bin): This is the central executable that runs on the device. It handles:
– Starting the service and managing device interactions (e.g., capturing diagnostics, pcap logs, qmdl logs)
– Serving the Web UI by exposing a web server (note the static files under bin/static with HTML, CSS, JavaScript)
– Managing backend operations such as analysis, statistics, and configuration (files like config.rs, analysis.rs, server.rs, daemon.rs)
• Core Analysis & Utility Library (lib): Contains modular subcomponents that include:
– Various analysis modules (under lib/src/analysis/ like analyzer.rs, connection_redirect_downgrade.rs, etc.)
– Diagnostic tools (diag.rs, diag_device.rs)
– Parsers for file formats (pcap.rs, qmdl.rs, gsmtap_parser.rs)
– Utility functions shared with other binaries.
• Telecommunication Parser (telcom-parser): A dedicated crate for parsing ASN.1 specifications related to LTE/telecom protocols
– This includes definitions for EUTRA and PC5 protocols and supports the protocol-specific parsing logic.
• Ancillary Utilities:
– Rootshell: A small utility meant to spawn a root shell so that capture files and other system-critical files can be managed safely.
– Serial: Likely responsible for serial communication with the device (for instance, interfacing with the diag interface).
– Tools: A collection of scripts (e.g., asn1grep, nasparse, install-dev.sh) to aid in installation, debugging, and development.
Relationships and Interactions
• The primary daemon (from the “bin” crate) acts as the orchestrator. It uses the core library (from “lib”) for heavy lifting like analyzing diagnostic data.
• The web server, embedded within the daemon, serves the static UI assets. It provides endpoints for starting/stopping data captures and retrieving analysis results.
• The telcom-parser crate is used by the analysis modules when dealing with LTE RRC messages and ASN.1 definitions.
• The Serial module is likely used to communicate with the hardware’s diag interface, feeding raw data into the analysis pipeline.
• Rootshell is a supporting component used for performing privileged actions (e.g., cleanup of capture files) on the device.
• External interactions include:
• Communication over WiFi/USB (using adb forwarding) that allows a laptop or phone to interact with the web UI.
• Interaction with hardware (the Orbic device) via diagnostic channels.
Architectural Patterns and Design Principles
• Modular and multi-crate design: The project is clearly divided into separate Rust crates (bin, lib, rootshell, serial, telcom-parser, tools) to encapsulate functionality.
• Clear separation of concerns: The daemon handles runtime operations and the UI, while lib encapsulates core analysis logic and telcom-parser handles telecom-specific parsing.
• Extensibility: The use of modular analysis components (each analysis file in lib/src/analysis/) allows for easier expansion and testing.
• Deployment orientation: Installation scripts in “dist” and “tools” show that the project targets embedded deployments, with specific instructions for different platforms (Linux, macOS, Windows).