2023-08-18 08:55:46 +02:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"dddd/common/http"
|
|
|
|
"dddd/structs"
|
|
|
|
"dddd/utils"
|
|
|
|
"fmt"
|
2024-01-02 14:50:55 +01:00
|
|
|
"github.com/projectdiscovery/gologger"
|
2023-08-18 08:55:46 +02:00
|
|
|
"github.com/projectdiscovery/httpx"
|
|
|
|
"net/url"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
func HostBindCheck() {
|
2024-01-15 08:19:45 +01:00
|
|
|
gologger.Info().Msg("域名绑定资产发现")
|
2024-01-02 14:50:55 +01:00
|
|
|
|
2023-08-18 08:55:46 +02:00
|
|
|
var urls []string
|
|
|
|
for rootURL, _ := range structs.GlobalURLMap {
|
|
|
|
URL, err := url.Parse(rootURL)
|
|
|
|
if err != nil {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
if strings.Contains(URL.Host, ":") {
|
|
|
|
tmp := strings.Split(URL.Host, ":")
|
|
|
|
if len(tmp) != 2 {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
ip, port := tmp[0], tmp[1]
|
|
|
|
if !utils.IsIPv4(ip) {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
domains, ok := structs.GlobalIPDomainMap[ip]
|
|
|
|
if !ok {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
for _, domain := range domains {
|
|
|
|
urls = append(urls, fmt.Sprintf("%v://%v:%v", URL.Scheme, domain, port))
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ip := URL.Host
|
|
|
|
if !utils.IsIPv4(ip) {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
domains, ok := structs.GlobalIPDomainMap[ip]
|
|
|
|
if !ok {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
for _, domain := range domains {
|
|
|
|
urls = append(urls, fmt.Sprintf("%v://%v", URL.Scheme, domain))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
urls = utils.RemoveDuplicateElement(urls)
|
|
|
|
|
2023-09-04 11:08:49 +02:00
|
|
|
httpx.DirBrute(urls, http.HostBindHTTPxCallBack,
|
|
|
|
structs.GlobalConfig.HTTPProxy,
|
|
|
|
structs.GlobalConfig.WebThreads,
|
|
|
|
structs.GlobalConfig.WebTimeout)
|
2024-01-02 14:50:55 +01:00
|
|
|
gologger.AuditTimeLogger("域名绑定资产发现结束")
|
2023-08-18 08:55:46 +02:00
|
|
|
}
|