RealiTLScanner Documentation

repository·main·Indexed 26 days ago

https://github.com/xtls/realitlscanner

A tool for scanning IP addresses, CIDRs, domains, or crawled URLs to identify TLS configurations and 'Reality' TLS characteristics. It supports CSV output with optional Geo IP data via MaxMind GeoLite2/GeoIP2 databases and can be deployed via Go 1.21+ or Docker.

Tokens
1.5K
Snippets
3
Records
17
Agent score
87%

What's inside RealiTLScanner

  1. Build and run RealiTLScanner using Docker

    main

    You can use Docker to run the scanner without needing Go installed on your host machine. First, build the container image, then run it with your desired arguments.

    # Build container
    docker build -t realitlscanner .
    
    # Show help
    docker run --rm realitlscanner
    
    # Scan a specific IP
    docker run --rm realitlscanner -addr 1.1.1.1
  2. Use RealiTLScanner CLI flags

    main

    The RealiTLScanner CLI allows you to specify targets, ports, concurrency, and output formats.

    Note: It is recommended to run this tool locally, as running the scanner in the cloud may cause the VPS to be flagged.

  3. Perform TLS scans with ScanTLS

    main

    The ScanTLS function performs a TLS handshake against a target host to determine if it meets specific 'Reality' criteria (TLS 1.3 and h2 ALPN).

    If the target is considered 'feasible' (TLS 1.3, h2, and valid domain/issuer information), a comma-separated string containing the scan results is sent to the out channel. If the target is not feasible, the result is logged at the Debug level and nothing is sent to the channel.

    Feasibility Criteria:

    • TLS version must be tls.VersionTLS13.
    • Negotiated ALPN must be h2.
    • Peer certificate Common Name must not be empty.
    • Peer certificate Issuer Organization must not be empty.

    Output Format (CSV): When feasible, the following fields are sent to the out channel: IP, Origin, TLS Version, ALPN, Curve ID, Cert Length (with cert count), Signature Algorithm, Public Key Algorithm, Domain, "Issuers", GeoCode

    func ScanTLS(host Host, out chan<- string, geo *Geo)
  4. Write strings to an io.Writer via a channel

    main
    Use OutWriter(writer io.Writer) chan<- string to create a write-only channel that asynchronously writes incoming strings to the provided io.Writer. This is useful for non-blocking logging or result saving.
  5. Initialize GeoIP lookup with NewGeo

    main
    Use NewGeo() to create a new Geo instance for resolving geographic information from IP addresses. This function attempts to open a Country.mmdb file in the current working directory. If the file is missing or cannot be opened, the Geo instance will be returned without a reader, and subsequent lookups will return "N/A".
  6. Resolve a domain to an IP address

    main
    Use LookupIP(addr string) to resolve a domain or hostname to a net.IP. It returns the first valid IP found that matches the project's IP version requirements (IPv4 or IPv6 if enableIPv6 is true).
  7. Iterate over a single address in infinite mode

    main

    Use IterateAddr(addr string) to scan a single target. If the provided addr is an IP or a domain, the function automatically enables "infinite mode".

    In infinite mode, the function starts with the initial IP and then alternates between scanning the next lower IP and the next higher IP indefinitely. If the address is a CIDR, it behaves like Iterate and expands the range.

  8. Iterate over targets from an io.Reader

    main

    Use Iterate(reader io.Reader) to process a stream of targets (IPs, CIDRs, or domains) from any source implementing io.Reader. It returns a receive-only channel of Host objects.

    Supported formats per line:

    • IP Address: e.g., 192.168.1.1
    • IP CIDR: e.g., 192.168.1.0/24. The function expands the CIDR and emits each individual IP.
    • Domain Name: e.g., example.com. Domains are validated via regex and returned with a nil IP.

    Note: IPv6 support depends on the enableIPv6 variable.