cf-scanner

command module
v1.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 32 Imported by: 0

README

cf-scanner

اموزش فارسی

English Tutorial

Русский учебник

Cloudflare scanner

This scanner can be used with any CDN, provided you have the necessary requirements, such as an IP list or domain list for scanning. By default, it is configured to target Cloudflare. Please review the JSON configuration document below.

[!CAUTION] Need help to update cloudfalare-domains.txt.

IRAN

اسکن akamai برای سایفون

توضیح عملکرد اسکنر بر اساس کانفیگ پیش‌فرض
  1. از آی‌پی مقصد پینگ گرفته می‌شود. اگر پاسخ دریافت شود و مقدار تأخیر کمتر از MaxPing باشد، اسکنر به مرحله بعد می‌رود. در غیر این صورت خروجی قرمز می‌شود.

  2. اتصال TCP به آی‌پی برقرار می‌شود. اگر اتصال موفق باشد، مرحله بعد اجرا می‌شود. اگر در بازه زمانی MaxLatency اتصال برقرار نشود، خروجی قرمز خواهد بود.

  3. فرآیند TLS Handshake انجام می‌شود. در صورت موفقیت، اسکنر به مرحله بعد می‌رود. اگر این فرآیند در مدت MaxLatency کامل نشود، خروجی قرمز می‌شود.

  4. اولین درخواست HTTP ارسال می‌شود. اگر پاسخ دریافت شود و تأخیر کمتر از MaxLatency باشد، مرحله بعد اجرا می‌شود. در غیر این صورت خروجی قرمز خواهد بود.

  5. کد وضعیت (Status Code) بررسی می‌شود تا یکی از مقادیر 200 یا 204 باشد. سپس هدر Server بررسی می‌شود تا مقدار آن cloudflare باشد (مطابق تنظیمات ResponseStatusCode و ResponseHeader).

  6. اگر Jitter غیرفعال باشد و مرحله ۵ با موفقیت انجام شده باشد، خروجی سبز نمایش داده می‌شود.

  7. اگر Jitter فعال باشد، به تعداد Samples درخواست HTTP با فاصله زمانی Interval ارسال می‌شود. تأخیر هر درخواست اندازه‌گیری و مقدار جیتر محاسبه می‌شود.

    • اگر مقدار جیتر کمتر از حد مجاز باشد، خروجی سبز می‌شود.
    • اگر مقدار جیتر بیشتر از حد مجاز باشد، خروجی زرد می‌شود.
    • اگر هنگام محاسبه جیتر اتصال قطع شود یا پاسخی دریافت نشود، خروجی قرمز شده و در انتهای خروجی عبارت jammed درج می‌شود.

Notes

  • To fetch the latest ipv4.txt, delete the existing file. It will be automatically downloaded from the cf-tools latest release. If the download fails, it will gracefully fall back to ipv4_old.txt.

features

  • HTTP/1.1 + HTTP/2 + HTTP/3
  • Ping + Latency + Jitter + Download speed test
  • UTLS
  • Noise for HTTP/3
  • UDP scan
  • CSV format result
  • Padding

Build

To build, run the following commands in the project directory:

go mod tidy
go build -ldflags "-w -s"

Sort result.txt file

  • Windows:
    • Powershell: Get-Content result.txt | Sort-Object { ($_ -split '\s+')[2] } | Out-File sorted_result.txt
    • CMD: powershell "Get-Content result.txt | Sort-Object { ($_ -split '\s+')[2] } | Out-File sorted_result.txt"
    • NuShell powershell "Get-Content result.txt | Sort-Object { ($_ -split '\\s+')[2] } | Out-File sorted_result.txt"
  • Linux:
    • Bash: sort -k3,3 -n result.txt > sorted_result.txt

Configuration Parameters

  • NOTE❕: Both HTTP/2 and HTTP/1.1 are supported, with protocol selection based on ALPN. If ALPN is explicitly set to "h2", HTTP/2 will be used—provided the server supports it. By default, ALPN is set to "h2", "http/1.1", allowing HTTP/2 when available; otherwise, the connection falls back to HTTP/1.1.
  • WARNING⚠️: When UTLS is enabled, ALPN is forcibly set to "h2", "http/1.1" and cannot be overridden via the configuration file.
  • WARNING⚠️: If DownloadTest is enabled, use only one Goroutine; running multiple will yield inaccurate results.

[!CAUTION] Avoid using your own domain for scanning activities, as CDN providers may interpret the traffic as DDoS or port scanning behavior and block your domain.

{
 "LogErr": true,
 "CSV": false, // CSV format result.
 "RandomScan": true,
 "Interface": null,
 "Hostname": "cp.cloudflare.com", // The target hostname or domain to scan. Use "{ip}" to use ip as hostname.
 "Ports": [], // If empty, defaults to port 443 for HTTPS and 80 for HTTP.
 "Path": "/", // The path to append to the hostname.
 "Headers": { // Additional HTTP headers.
    "User-Agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:151.0) Gecko/20100101 Firefox/151.0"],
 },
 "ResponseHeader": { // Headers that an HTTP response must include.
    "Server": "cloudflare"
 },
 "ResponseStatusCode": [200, 204], // Acceptable status codes.
 "Padding": true, // Enable padding in HTTP requests by adding random text as cookies. This helps eliminate fixed-size requests.
 "PaddingSize": "1-100", // Padding size range.
 "Ping": {
   "Enable": true, // Enable ping IP.
   "MaxPing": 300, // Maximum acceptable ping time (in milliseconds).
   "Privileged": true, // SetPrivileged sets the type of ping pinger will send. false means pinger will send an "unprivileged" UDP ping. true means pinger will send a "privileged" raw ICMP ping. Setting to true requires that it be run with super-user privileges.
   "Size": "24-64" // Pinger packet size
 },
 "Goroutines": 16, // Number of concurrent goroutines for scanning.
 "Maxlatency": 1000, // Maximum acceptable latency (in milliseconds).
 "Jitter": {
   "Enable": true, // Enable jitter calculation.
   "MaxJitter": 50.0, // Maximum acceptable jitter.
   "Samples": 5, // Number of samples to calculate average jitter.
   "Interval": 200 // Delay (in ms) between consecutive jitter samples.
 },
 "IpVersion": 4, // IP version (`4` or `6`).
 "IplistPath": "ipv4.txt", // Path to the file containing a list of IP addresses (e.g., `ipv4.txt`).
 "IgnoreRange": [], // List of IP ranges to ignore. (e.g., `["172.0.0.0/8", "104.0.0.0/8"]`).
 "AllowRange": [], // List of IP ranges to allow. (e.g., `["192.0.0.0/8", "8.14.0.0/16"]`).
 "TLS": {
   "Enable": true,
   "SNI": "cp.cloudflare.com", // The SNI value to use during the TLS handshake. Use "{ip}" to use ip as SNI. Set null to disable SNI.
   "Insecure": false, // Certificate validation.
   "Alpn": ["h2", "http/1.1"], // List of supported ALPN (Application-Layer Protocol Negotiation) protocols.
   "Utls": {
    "Enable": true, // Enable UTLS fingerprint.
    "Fingerprint": "chrome", // Supported fingerprints are firefox, edge, chrome, 360 and ios.
    "TcpTimeout": 1000,
    "TcpRetry": 1
   }
 },
 "HTTP/3": false, // Enable HTTP version 3.
 "Noise": {
    "Enable": false, // Enable UDP noise injection for HTTP/3.
    "Packets": [
      {
         "Type": "rand", // Noise payload type. `str`, `base64`, `hex` and `rand` types are supported.
         "Payload": "1-10", // Noise payload
         "Sleep": "20-50" // Delay in milliseconds after sending noise.
      },
      {
         "Type": "rand",
         "Payload": "1-50",
         "Sleep": "20-50"
      }
    ]
 },
 "DomainScan": {
    "Enable": false, // Enable domain scanning.
    "DomainAsSNI": false, // Use selected domain as SNI.
    "DomainAsHost": false, // Use selected domain as Host.
    "Shuffle": true, // Shuffle domains list for random scanning.
    "SkipIPV6": true, // Skip IPv6 as result of resolving domain.
    "DomainListPath": "cloudfalare-domains.txt" // Path to the file containing a list of domains
 },
 "DownloadTest": {
    "Enable": false, // Enable the download speed test.
    "SeparateConnection": false, // Open new connection for download speed test. Enable for H3.
    "Url": "https://speed.cloudflare.com/__down?bytes=10000000", // Target URL for download.
    "SNI": "cp.cloudflare.com", // The SNI value to use during the TLS handshake for DownloadTest.
    "TargetBytes": 5000000, // Expected data in bytes; if not met, report as JAMMED.
    "Timeout": 5000 // Timeout duration in milliseconds before aborting the download.
 }
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL