From 28ef5a12e0b893b11cebb8ed0dcee4bec17e355b Mon Sep 17 00:00:00 2001 From: Melody Date: Tue, 27 Apr 2021 14:04:10 +0800 Subject: [PATCH] Fix ip/cname resolve bug When the url's format like: https://www.google.com:443, the domain pass to the resolver will be www.google.com:443 and can't get the right result This patch split the port at the start of the function and rewrite the domain to the right format, which makes the result of IP/Cname be right. --- internal/runner/runner.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index a598bb1..d95ffe5 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -520,6 +520,12 @@ retry: URL := fmt.Sprintf("%s://%s", protocol, domain) if port > 0 { URL = fmt.Sprintf("%s://%s:%d", protocol, domain, port) + } else { + domainParse := strings.Split(domain, ":") + domain = domainParse[0] + if len(domainParse) > 1 { + port, _ = strconv.Atoi(domainParse[1]) + } } if !scanopts.Unsafe { @@ -692,7 +698,6 @@ retry: builder.WriteString(" [http2]") } } - ip := hp.Dialer.GetDialedIP(domain) if scanopts.OutputIP { builder.WriteString(fmt.Sprintf(" [%s]", ip))