How shadow1ng/fscan works
Project Type & Purpose
• Fscan 2.0 is a network security scanning tool designed for internal network reconnaissance, port scanning, vulnerability detection (including high-risk exploits like MS17-010), web fingerprinting, and even penetration testing (e.g., SSH and Redis exploitation).
• The README underlines features like host discovery, port scanning, service brute-forcing, and vulnerability exploitation. It also highlights a heavy emphasis on modularity using a reflection-based plugin system for extensibility.
Analyzing the File Structure
• Top-Level Directories:
• Common: Contains utility packages such as configuration (Config.go), flag parsing (Flag.go), logging (Log.go), and other helper functions used by the whole system.
• Core: Implements the main scanning functionalities (ICMP-based host discovery, port scanning, and module registry) and holds logic that coordinates scanning operations.
• Plugins: This directory holds files for each supported protocol or scanning module (e.g., for ActiveMQ, Cassandra, FTP, SSH, etc.). These plugins are loaded dynamically using a reflection mechanism, emphasizing the plugin/extensibility design.
• WebScan: A specific module set for web-based scanning with components for information scanning, fingerprint extraction, protocol buffers for HTTP scanning, and associated POC files.
• TestDocker: Provides Dockerfiles and configuration for spinning up test environments for each service that Fscan supports. This allows isolated testing and validation.
• Files:
• main.go: The entry point for the application that ties together configuration, scanning initialization, and runtime control.
• go.mod and go.sum: Define and maintain dependency management.
• Documentation (Docs directory) and README indicate additional explanation on usage, plugin development, and module functionality.
Key Components and Their Relationships
– Command-Line Interface & Configuration:
• The entry point (main.go) uses utilities in the Common package to parse command-line inputs and configurations.
– Core Scanning Engine:
• In the Core directory, routines for ICMP, port scanning, and host analysis are implemented.
• The registry (Registry.go) is central for coordinating which scanning modules and plugins to activate.
– Plugin Framework:
• The Plugins directory houses individual Go source files for scanning various services. These are designed for hot-plugging using a reflection-based mechanism, meaning each plugin conforms to a common interface.
• The Core scanning engine dynamically loads and calls these plugins based on user parameters and scan mode.
– WebScan Module:
• A specialized set of functionalities meant for scanning and assessing web applications. It includes its own libraries (WebScan/lib) and POC definitions (WebScan/pocs) to deal with vulnerabilities.
– Test & Deployment Components:
• The TestDocker directory contains configurations and scripts (e.g., Dockerfiles) to deploy service instances for testing scanning functions in a controlled environment.
Architectural Patterns and Design Principles
• Modularity: Clearly separated modules (Common, Core, Plugins, WebScan) enhance maintainability and scalability.
• Plugin/Extensibility: The use of reflection and a plugin-based architecture allows for quick addition of new scanning capabilities without significant changes to the core engine.
• Separation of Concerns: Core functionalities (scanning logic, configuration parsing) are decoupled from plugins (specific exploitation and scanning details) and from WebScan (web vulnerability scanning).
• Concurrency: The README emphasizes improved thread management and concurrent execution, suggesting that the engine handles multi-threaded scan operations effectively.