MCPcopy Create free account
hub / github.com/code-scan/Goal / GetSubDomain

Method GetSubDomain

Gsensor/SecurityTrailsSensor.go:104–142  ·  view source on GitHub ↗

子域名查询

(page int)

Source from the content-addressed store, hash-verified

102
103// 子域名查询
104func (s *SecurityTrails) GetSubDomain(page int) {
105 if page == 1 {
106 s.result = Result{}
107 }
108 uri := "https://securitytrails.com/app/api/v1/list_new/hostname/" + s.Domain + "?page=" + strconv.Itoa(page)
109 uri = fmt.Sprintf("https://securitytrails.com/_next/data/%s/list/apex_domain/%s.json?domain=%s&page=%d", s.buildId, s.Domain, s.Domain, page)
110 resp, err := s.httpReq(uri)
111
112 if err != nil {
113 log.Println("[!] ", s.GetInfo(), " GetSubDomain 1 Error: ", err)
114 return
115 }
116 hostName := SubDomainRespsonse{}
117 err = json.Unmarshal(resp, &hostName)
118 if err != nil {
119 log.Println(string(resp))
120 log.Println("[!] ", s.GetInfo(), " GetSubDomain 2 Error: ", err)
121 return
122
123 }
124 for _, r := range hostName.Pageprops.Apexdomaindata.Data.Records {
125 if s.Resolver != true {
126 s.result[r.Hostname] = "未解析"
127 continue
128 }
129 ips := Gnet.GetHostIp(r.Hostname, "8.8.8.8:53")
130 if len(ips) > 0 {
131 s.result[r.Hostname] = ips[0]
132 } else {
133 s.result[r.Hostname] = "未解析"
134 }
135 }
136 if page >= s.MaxPage {
137 return
138 }
139 if hostName.Pageprops.Apexdomaindata.Data.Total != len(s.result) {
140 s.GetSubDomain(page + 1)
141 }
142}
143
144// 历史记录查询
145func (s *SecurityTrails) GetHistory() {

Callers 1

GetResultMethod · 0.95

Calls 3

httpReqMethod · 0.95
GetInfoMethod · 0.95
GetHostIpFunction · 0.92

Tested by

no test coverage detected