功能 • 安装 • 用法 • 加入 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[] match host with specified cdn provider (cloudfront, fastly, google, leaseweb)
-mcloud, -match-cloud string[] match host with specified cloud provider (aws, google, oracle)
-mwaf, -match-waf string[] match host with specified waf provider (cloudflare, incapsula, sucuri, akamai)
FILTER:
-fcdn, -filter-cdn string[] filter host with specified cdn provider (cloudfront, fastly, google, leaseweb)
-fcloud, -filter-cloud string[] filter host with specified cloud provider (aws, google, oracle)
-fwaf, -filter-waf string[] filter host with specified waf provider (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 maximum number of retries for dns resolution (must be at least 1) (default 2)
UPDATE:
-up, -update update cdncheck to latest version
-duc, -disable-update-check disable automatic cdncheck update check
provider.yaml 文件包含 CDN、WAF 和 Cloud 提供商的列表。该列表包含 URL、ASN 和 CIDR,随后会使用 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 或 Cloud)对应的部分。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",
...
}
一个辅助库,用于检查给定 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)
}
}
cdncheck 由 projectdiscovery 团队用 ❤️ 打造,并在 MIT License 许可下分发。