mirror of
https://github.com/projectdiscovery/httpx.git
synced 2024-09-11 17:46:08 +03:00
Expose cdnname in output and json
This commit is contained in:
parent
5d29e372ae
commit
6c6d3e334f
@ -6,9 +6,9 @@ import (
|
||||
)
|
||||
|
||||
// CdnCheck verifies if the given ip is part of Cdn ranges
|
||||
func (h *HTTPX) CdnCheck(ip string) (bool, error) {
|
||||
func (h *HTTPX) CdnCheck(ip string) (bool, string, error) {
|
||||
if h.cdn == nil {
|
||||
return false, fmt.Errorf("cdn client not configured")
|
||||
return false, "", fmt.Errorf("cdn client not configured")
|
||||
}
|
||||
|
||||
return h.cdn.Check(net.ParseIP((ip)))
|
||||
|
2
go.mod
2
go.mod
@ -13,7 +13,7 @@ require (
|
||||
github.com/microcosm-cc/bluemonday v1.0.17
|
||||
github.com/miekg/dns v1.1.43 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/projectdiscovery/cdncheck v0.0.2
|
||||
github.com/projectdiscovery/cdncheck v0.0.3-0.20220115001641-2550ce07bde6
|
||||
github.com/projectdiscovery/clistats v0.0.8
|
||||
github.com/projectdiscovery/cryptoutil v0.0.0-20210805184155-b5d2512f9345
|
||||
github.com/projectdiscovery/fastdialer v0.0.14-0.20211117222717-6599e7bc586e
|
||||
|
2
go.sum
2
go.sum
@ -105,6 +105,8 @@ github.com/projectdiscovery/blackrock v0.0.0-20210415162320-b38689ae3a2e h1:7bwa
|
||||
github.com/projectdiscovery/blackrock v0.0.0-20210415162320-b38689ae3a2e/go.mod h1:/IsapnEYiWG+yEDPXp0e8NWj3npzB9Ccy9lXEUJwMZs=
|
||||
github.com/projectdiscovery/cdncheck v0.0.2 h1:ZAaezMvVioC/8fC8iilylGT4FBBryzQdXHow+lHnPOE=
|
||||
github.com/projectdiscovery/cdncheck v0.0.2/go.mod h1:+vB8400d1Kxq5aDoi/XkVcdvpiqQjSrYJ8bRfUDdymQ=
|
||||
github.com/projectdiscovery/cdncheck v0.0.3-0.20220115001641-2550ce07bde6 h1:pUr8UiK2fPhMmk8qk0ijXH5IaJAtHY47+BODmx62SlU=
|
||||
github.com/projectdiscovery/cdncheck v0.0.3-0.20220115001641-2550ce07bde6/go.mod h1:+vB8400d1Kxq5aDoi/XkVcdvpiqQjSrYJ8bRfUDdymQ=
|
||||
github.com/projectdiscovery/clistats v0.0.8 h1:tjmWb15mqsPf/yrQXVHLe2ThZX/5+mgKSfZBKWWLh20=
|
||||
github.com/projectdiscovery/clistats v0.0.8/go.mod h1:lV6jUHAv2bYWqrQstqW8iVIydKJhWlVaLl3Xo9ioVGg=
|
||||
github.com/projectdiscovery/cryptoutil v0.0.0-20210805184155-b5d2512f9345 h1:jT6f/cdOpLkp9GAfRrxk57BUjYfIrR8E+AjMv5H5U4U=
|
||||
|
@ -1154,9 +1154,9 @@ retry:
|
||||
builder.WriteString(fmt.Sprintf(" [%s]", cnames[0]))
|
||||
}
|
||||
|
||||
isCDN, err := hp.CdnCheck(ip)
|
||||
isCDN, cdnName, err := hp.CdnCheck(ip)
|
||||
if scanopts.OutputCDN && isCDN && err == nil {
|
||||
builder.WriteString(" [cdn]")
|
||||
builder.WriteString(fmt.Sprintf(" [%s]", cdnName))
|
||||
}
|
||||
|
||||
if scanopts.OutputResponseTime {
|
||||
@ -1339,6 +1339,7 @@ retry:
|
||||
A: ips,
|
||||
CNAMEs: cnames,
|
||||
CDN: isCDN,
|
||||
CDNName: cdnName,
|
||||
ResponseTime: resp.Duration.String(),
|
||||
Technologies: technologies,
|
||||
FinalURL: finalURL,
|
||||
@ -1391,6 +1392,7 @@ type Result struct {
|
||||
Pipeline bool `json:"pipeline,omitempty" csv:"pipeline"`
|
||||
HTTP2 bool `json:"http2,omitempty" csv:"http2"`
|
||||
CDN bool `json:"cdn,omitempty" csv:"cdn"`
|
||||
CDNName string `json:"cdn-name,omitempty" csv:"cdn-name"`
|
||||
ResponseTime string `json:"response-time,omitempty" csv:"response-time"`
|
||||
Technologies []string `json:"technologies,omitempty" csv:"technologies"`
|
||||
Chain []httpx.ChainItem `json:"chain,omitempty" csv:"chain"`
|
||||
@ -1489,7 +1491,7 @@ func (r *Runner) skipCDNPort(host string, port string) bool {
|
||||
// pick the first ip as target
|
||||
hostIP := dnsData.A[0]
|
||||
|
||||
isCdnIP, err := r.hp.CdnCheck(hostIP)
|
||||
isCdnIP, _, err := r.hp.CdnCheck(hostIP)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user