Lua在windows下的安装及环境配置实用指南
2026-09-05
2026-09-11 0
团队讨论cdncheck时,我会先把用途说清楚:用于检测给定 IP 地址的各种技术的实用程序。对日常自动化任务来说,输入边界、依赖和失败处理如果不清楚就很难稳定复用往往决定它能否落地,不能只用安装成功来判断。短测时我会用一项范围明确的真实任务完成最小试跑,并保留配置时间、输出质量、异常信息和维护痕迹的结果,方便团队复盘。编辑判断上,愿意先做小范围验证并复查原始文档的团队可以优先研究它;其他团队不必为了热门标签勉强接入。
cdn检查
Features • Installation • Usage • Join Discord
cdncheck 是一个用于识别与 dns/ip 网络地址相关的技术的工具。
特点
安装
cdncheck 需要 go1.19 才能成功安装。运行以下命令安装最新版本:
go install -v github.com/projectdiscovery/cdncheck/cmd/cdncheck@latest
用途
cdncheck -h
这将显示该工具的帮助。这是它支持的所有交换机。
Usage:
./cdncheck [flags]
Flags:
INPUT:
-i, -input string[] list of ip / dns to process
DETECTION:
-cdn display only cdn in cli output
-cloud display only cloud in cli output
-waf display only waf in cli output
MATCHER:
-mcdn, -match-cdn string[] 将主机与指定的 CDN 提供商(cloudfront、fastly、google、leaseweb)匹配
-mcloud, -match-cloud string[] 将主机与指定的云提供商(aws、google、oracle)匹配
-mwaf, -match-waf string[] 将主机与指定的 waf 提供商(cloudflare、incapsula、sucuri、akamai)匹配
FILTER:
-fcdn, -filter-cdn string[] 使用指定的 CDN 提供商(cloudfront、fastly、google、leaseweb)过滤主机
-fcloud, -filter-cloud string[] 使用指定的云提供商(aws、google、oracle)过滤主机
-fwaf, -filter-waf string[] 使用指定的 waf 提供商(cloudflare、incapsula、sucuri、akamai)过滤主机
OUTPUT:
-resp display technology name in cli output
-o, -output string write output in plain format to file
-v, -verbose display verbose output
-j, -jsonl write output in json(line) format
-nc, -no-color disable colors in cli output
-version display version of the project
-silent only display results in output
CONFIG:
-r, -resolver string[] list of resolvers to use (file or comma separated)
-e, -exclude exclude detected ip from output
-retry int dns解析的最大重试次数(必须至少为1)(默认为2)
UPDATE:
-up, -update update cdncheck to latest version
-duc, -disable-update-check disable automatic cdncheck update check
如何添加新的提供商?
provider.yaml 文件包含 CDN、WAF 和 云 提供商的列表。该列表包含 URLs、ASNs 和 CIDRs,然后使用 generate-index 程序将其编译成最终的 sources_data.json 文件。
provider.yaml 文件示例 -
cdn:
# asn contains the ASN numbers for providers
asn:
leaseweb:
- AS60626
# urls contains a list of URLs for CDN providers
urls:
cloudfront:
- https://d7uri8nf7uskq.cloudfront.net/tools/list-cloudfront-ips
fastly:
- https://api.fastly.com/public-ip-list
# cidr contains the CIDR ranges for providers
cidr:
akamai:
- "23.235.32.0/20"
- "43.249.72.0/22"
- "103.244.50.0/24"
- "103.245.222.0/23"
- "103.245.224.0/24"
- "104.156.80.0/20"
可以从 URL、ASN 或静态 CIDR 列表中抓取的新提供程序可以通过以下简单步骤添加到 provider.yaml 文件中:
cmd/generate-index/provider.yaml 文件的 GitHub 存储库。cmd/generate-index 目录。provider.yaml 文件并找到要添加的提供商类型的部分(CDN、WAF 或云)。provider.yaml 文件中的相应部分。其他提供商
基于 CNAME 和 Wappalyzer 的添加可以在 other.go 文件中完成。只需将值添加到变量中即可。
// cdnCnameDomains contains a map of CNAME to domains to cdns
var cdnCnameDomains = map[string]string{
"cloudfront.net": "amazon",
"amazonaws.com": "amazon",
...
}
// cdnWappalyzerTechnologies contains a map of wappalyzer technologies to cdns
var cdnWappalyzerTechnologies = map[string]string{
"imperva": "imperva",
"incapsula": "incapsula",
...
}
cdncheck 作为库
检查给定 IP 是否在 Cloud / CDN / WAF 上运行的帮助程序库。
导入github.com/projectdiscovery/cdncheck即可使用该库。下面是一个基本示例:
package main
import (
"fmt"
"net"
"github.com/projectdiscovery/cdncheck"
)
func main() {
client := cdncheck.New()
ip := net.ParseIP("173.245.48.12")
// checks if an IP is contained in the cdn denylist
matched, val, err := client.CheckCDN(ip)
if err != nil {
panic(err)
}
if matched {
fmt.Printf("%v is a %v\n", ip, val)
} else {
fmt.Printf("%v is not a CDN\n", ip)
}
// checks if an IP is contained in the cloud denylist
matched, val, err = client.CheckCloud(ip)
if err != nil {
panic(err)
}
if matched {
fmt.Printf("%v is a %v\n", ip, val)
} else {
fmt.Printf("%v is not a Cloud\n", ip)
}
// checks if an IP is contained in the waf denylist
matched, val, err = client.CheckWAF(ip)
if err != nil {
panic(err)
}
if matched {
fmt.Printf("%v WAF is %v\n", ip, val)
} else {
fmt.Printf("%v is not a WAF\n", ip)
}
}