How alphasoc/flightsim works
Project Type and Purpose
• This is a command-line utility written in Go that simulates malicious network traffic. Its purpose is to generate realistic attack traffic (DNS tunneling, DGA, C2 communications, SSH transfers, and more) so security teams can evaluate how well they detect or block these network events.
• The README clearly describes it as a tool for simulating various types of “suspicious” or malicious network activities.
Analyzing the File Structure
• The project is organized under a top-level “v2” directory that contains the main application code.
• The “cmd” directory contains subcommands (“get” and “run”) that serve as entry points for different functionalities.
• The “simulator” directory houses the individual simulation modules, each representing different network traffic patterns (e.g., dga.go, irc.go, miner.go, tunnel-dns.go, etc.).
• There’s a “utils” directory with helper functions for networking, randomization, and marshaling, which likely provide shared logic across modules.
• Other parts like “wisdom” seem to encapsulate output logic or additional processing.
• Presence of configuration files like .goreleaser.yml and go module files indicate standard Go project layout.
Key Components
a. CLI/Command Interface:
• "cmd" package with subcommands “get” and “run” that accept user input and flags.
b. Main Orchestrator:
• The main entry point (v2/main.go) that bootstraps the application and routes command-line arguments to the proper module.
c. Simulation Modules:
• Each module inside “simulator” (for example: dga, c2, ssh-exfil, ssh-transfer, tunnel-dns, etc.) should be depicted as separate components or nodes. You might want to group them under a larger "Simulator" block to show their unified purpose.
d. Utility/Shared Libraries:
• A component for “utils” that provides shared functionality (network connection management, randomness, marshaling).
e. External Interactions:
• Interactions with external services/APIs such as the AlphaSOC API for fetching destination addresses (as used in the “get” command and possibly within simulation modules).
• For simulations that mimic network protocols, indicate connections to external servers (like IRC, SSH servers, SMTP servers, etc.), though these would be simulated and not actual long-lived services.
Architectural Patterns or Design Principles
• The design follows a modular, command-based architecture where individual functionalities (different types of network traffic simulation) are encapsulated as modules.
• Separation of concerns: CLI commands are separated from simulation logic and shared utilities.
• Extensibility: new simulation modules can be added without affecting the overall architecture (a potential plug-in style among the simulator modules).