# shadow1ng/fscan architecture

> Architecture diagram of the GitHub repository shadow1ng/fscan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shadow1ng/fscan
- Repository: https://github.com/shadow1ng/fscan

## Overview

##### 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.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Input and Configuration"
        MA("Main Application"):::app
        CU("Configuration & Utility"):::config
    end
  
    subgraph "Processing"
        CORE("Core Scanning Engine"):::core
        PLUG("Plugin Manager"):::plugin
        WEBSCAN("WebScan Module"):::web
    end
  
    TD("Test/Deployment Environment"):::test
  
    MA -->|"Initializes"| CU
    CU -->|"Parses&Configures"| CORE
    CORE -->|"DelegatesScan"| PLUG
    CORE -->|"DelegatesWebScan"| WEBSCAN
    PLUG -->|"ScanResults"| CORE
    WEBSCAN -->|"ScanResults"| CORE
    CORE -->|"DeploysTests"| TD
  
    click MA "https://github.com/shadow1ng/fscan/blob/main//main.go"
    click CU "https://github.com/shadow1ng/fscan/tree/main//Common"
    click CORE "https://github.com/shadow1ng/fscan/tree/main//Core"
    click PLUG "https://github.com/shadow1ng/fscan/tree/main//Plugins"
    click WEBSCAN "https://github.com/shadow1ng/fscan/tree/main//WebScan"
    click TD "https://github.com/shadow1ng/fscan/tree/main//TestDocker"
  
    classDef app fill:#f4d03f,stroke:#333,stroke-width:2px;
    classDef config fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef core fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef plugin fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef web fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef test fill:#FFB6C1,stroke:#000,stroke-width:2px;
```
