fscanx

repository·master·Indexed 18 days ago

https://github.com/killmonday/fscanx

A high-performance network scanning and information gathering tool for external asset reconnaissance and internal network scanning via proxies. It includes the Fingers engine for web target fingerprint identification supporting multiple libraries (fingers, fingerprinthub, wappalyzer, ehole, goby), an nmap-scanner for concurrent service identification, and utilities for validating, testing, and transforming fingerprint data.

Tokens
33.4K
Snippets
119
Records
149
Agent score
57%

What's inside fscanx

  1. Overview of fscan capabilities

    master

    fscan is an automated internal network scanning tool designed for comprehensive vulnerability scanning. It provides a wide range of features including:

    • Information Gathering: Host discovery (ICMP) and port scanning.
    • Brute Force: Support for various services (SSH, SMB, RDP) and databases (MySQL, MSSQL, Redis, PostgreSQL, Oracle).
    • System & Vulnerability Scanning: NetBIOS detection, Domain Controller identification, network interface retrieval, and high-risk vulnerability scanning (e.g., MS17-010).
    • Web Detection: Web title detection, web fingerprinting (CMS, OA frameworks), and web vulnerability scanning (supports Xray POCs).
    • Exploitation: Redis public key/scheduled task writing, SSH command execution, and MS17-010 exploitation (shellcode injection, user addition).
    • Output: Results can be saved to files.
  2. Overview of the fingers fingerprint engine

    master
    The fingers repository provides a Go implementation for managing and executing various fingerprint rule libraries. Because different rule libraries use different syntaxes, fingers acts as a management layer that supports multiple rule engines. It allows for different input structures while enforcing a unified output structure, enabling the merging of results from multiple engines to maximize fingerprint identification capabilities. It currently serves as the fingerprint engine for tools like spray and gogo.
  3. Understand grdp capabilities and limitations

    master

    grdp is a pure Golang implementation of the Microsoft RDP (Remote Desktop Protocol).

    Critical Limitation: It is a client-side authorization only implementation. It is designed to handle the authentication handshake and protocol requirements from the client perspective.

    Current Feature Status:

    • Supported:
      • Standard RDP Authentication
      • SSL Authentication
      • NTLMv2 Authentication
      • Windows Clipboard
    • In Progress / Unfinished:
      • RDP Client (UI)
      • VNC Client
  4. Understand the Fingerprint Library Syntax

    master

    The fingerprint library is used to identify services via TCP or HTTP protocols. Fingerprints are defined in YAML files located at v2/templates/http/* (for HTTP) and v2/templates/tcpfingers.yaml (for TCP).

    Each fingerprint consists of a name, an optional protocol (defaults to http), and one or more rule blocks. A fingerprint is considered a match if at least one rule within its regexps block matches. All fingerprint matching is case-insensitive.

    - name: example_service
      protocol: http
      rule:
        - regexps:
            body:
              - "some string"
  5. Use fscanx via SOCKS proxies

    master

    The tool is optimized for use as a "heavy artillery" (炮) through proxy tunnels. It supports performing port detection, protocol brute-forcing, and POC scanning through SOCKS proxies, allowing you to scan internal network assets from a remote position.

    This makes fscanx suitable for both public asset information gathering and internal network reconnaissance via established tunnels.

  6. How SOCKS5 UDP proxying is implemented

    master

    Because the Go standard library net/proxy does not support UDP for SOCKS5, this project implements custom SOCKS5 UDP proxying logic in mylib\proxy and mylib\socks.

    When using common.WrapperTcpWithTimeout with the network parameter set to "udp", the returned connection is an instance of *socks.UDPConnSocks5. To read from this connection, you must use the ReadFrom method instead of the standard Read method used for TCP.

    // Example of handling both TCP and custom SOCKS5 UDP connections
    if tConn, ok := conn.(*net.TCPConn); ok {
    	for {
    		count, err := tConn.Read(buf)
    		if err != nil {
    			break
    		}
    		result = append(result, buf[0:count]...)
    		if count < size {
    			break
    		}
    	}
    } else if uConn, ok := conn.(*socks.UDPConnSocks5); ok {
    	for {
    		count, _, err := uConn.ReadFrom(buf)
    		if err != nil {
    			break
    		}
    		result = append(result, buf[0:count]...)
    		if count < size {
    			break
    		}
    	}
    }
  7. Understand the Framework data structure

    master

    The Framework struct is the standard output format for fingerprint detection. It provides mapping to CPE standards and supports several metadata features:

    • Name: The fingerprint name.
    • From/Froms: Tracks the source(s) of the fingerprint. When merging fingerprints, multiple sources are recorded in the Froms map.
    • Tags: Custom string tags.
    • IsFocus: A boolean flag for high-priority fingerprints.
    • Attributes: Contains NVD-compatible WFN (Wolfram Function Language) attributes such as Vendor, Product, Version, Part, etc.

    Output Format: Calling .String() on a Framework produces a compact string like: tomcat:8.5.81:(goby fingers fingerprinthub).

    type Framework struct {
        Name        string        `json:"name"`
        From        From          `json:"-"` 
        Froms       map[From]bool `json:"froms,omitempty"`
        Tags        []string      `json:"tags,omitempty"`
        IsFocus     bool          `json:"is_focus,omitempty"`
        *Attributes `json:"attributes,omitempty"`
    }
    
    type Attributes struct {
        Part      string `json:"part" yaml:"part"`
        Vendor    string `json:"vendor" yaml:"vendor"`
        Product   string `json:"product" yaml:"product"`
        Version   string `json:"version,omitempty" yaml:"version,omitempty"`
        // ... other fields like Update, Edition, etc.
    }
  8. Understand Alias Mapping and Normalization

    master

    The alias system solves the problem of inconsistent naming across different fingerprinting libraries. It maps various engine-specific names to a single, normalized identity with fixed Vendor and Product fields (useful for CPE support).

    Key Alias Configuration Fields:

    • name: The normalized name shown to the user.
    • vendor / product: Used to construct CPE identifiers.
    • label: Comma-separated categories (e.g., web,server,proxy).
    • priority: Importance/confidence level (0-5).
    • target: Test URLs or IP:Port addresses for validation.
    • alias: A map where keys are engine names and values are the names used by those engines to represent the normalized product.
    • block: A list of engines to ignore if they produce a specific fingerprint, used to mitigate false positives.

    Example Configuration (nginx):

    - name: nginx
      vendor: nginx
      product: nginx
      label: web,server,proxy
      priority: 2
      target:
        - https://nginx.org
      alias:
        fingers: [nginx]
        wappalyzer: [Nginx]
  9. How the fingers engine works

    master

    The fingers engine is a high-performance, multi-source fingerprint aggregation engine.

    Key Concepts:

    • Aggregation: It combines results from fingers, wappalyzer, fingerprinthub, ehole, and goby into a single unified output.
    • Matching Logic: A fingerprint match occurs if any single rule within its configuration matches. Rules can use regex, string inclusion, or hashes (MD5/MMH3).
    • Active vs. Passive (level):
      • level: 0: Passive matching (analyzing existing response data).
      • level: 1: Active matching (the engine will send send_data to the target to trigger a response).
    • Performance: Uses caching, pre-compiled regex, and priority algorithms to achieve sub-100ms identification per site.
    • Output Formats: Supports CPE, URI, FSB, and WFN formats.
  10. Configure scanning depth with the -level flag

    master

    The -level flag (values 1-9) controls the scanning depth by determining how many probes are used. Higher levels provide more detailed service identification but take longer.

    | 级别 | 描述 | 探针数量 | 适用场景 |
    |------|------|----------|----------|
    | 1 | 快速扫描 | 基础探针 | 快速发现常见服务 |
    | 3 | 标准扫描 | 常用探针 | 平衡速度与准确性 |
    | 6 | 深度扫描 | 大部分探针 | 详细服务识别 |
    | 9 | 完全扫描 | 所有探针 | 最全面的识别 |
  11. Implement a Custom Engine

    master

    To register a custom fingerprinting engine, your implementation must satisfy the EngineImpl interface. This allows you to extend the Engine with new detection logic.

    Required Interface:

    type EngineImpl interface {
    	Name() string
    	Compile() error
    	Len() int
    	Capability() common.EngineCapability
    	WebMatch(content []byte) common.Frameworks
    	ServiceMatch(host string, port int, level int, sender common.ServiceSender, callback common.ServiceCallback) *common.ServiceResult
    }

    Capability Declaration: Each engine must declare its capabilities via Capability(), specifying whether it supports SupportWeb or SupportService identification.

    Registration: Use the Register method on an existing Engine instance to add your custom implementation.

    // Registering a custom engine
    func RegisterCustomEngine(engine *fingers.Engine) error {
        customEngine, err := NewCustomEngine()
        if err != nil {
           return err
        }
        engine.Register(customEngine)
        return nil
    }
  12. Supported fingerprint libraries in fingers

    master

    The fingers engine implements multiple fingerprint libraries to allow a single scan to match against several different rule sets simultaneously. The supported libraries include:

    • fingers (Native): The primary library with the most features, including multiple configuration methods, version matching, 404/favicon/WAF/CDN/Supply Chain identification, active fingerprinting, and high-performance optimizations (caching, regex pre-compilation, default ports, and priority algorithms).
    • wappalyzer: An implementation of the Wappalyzer fingerprint library (forked from projectdiscovery/wappalyzergo). It unifies output results into a frameworks format. Rules are synchronized via weekly GitHub Actions.
    • fingerprinthub: A Go implementation of the rules from FingerprintHub. This repository performs rule synchronization via weekly GitHub Actions.
    • ehole: A Go implementation of the rules from EHole. This repository performs rule synchronization via weekly GitHub Actions.
    • goby: A Go implementation of rules reverse-engineered from the goby community tool.