ip查询
(page int)
| 166 | |
| 167 | // ip查询 |
| 168 | func (s *SecurityTrails) GetIp(page int) { |
| 169 | if page == 1 { |
| 170 | s.result = Result{} |
| 171 | } |
| 172 | uri := "https://securitytrails.com/app/api/v1/list_new/ip/" + s.Domain + "?page=" + strconv.Itoa(page) |
| 173 | uri = fmt.Sprintf("https://securitytrails.com/_next/data/%s/list/ip/%s.json?page=%d&ip=%s", s.buildId, s.Domain, page, s.Domain) |
| 174 | resp, err := s.httpReq(uri) |
| 175 | if err != nil { |
| 176 | log.Println("[!] GetIp 1 Error: ", err) |
| 177 | return |
| 178 | |
| 179 | } |
| 180 | ip := SameServerResponse{} |
| 181 | err = json.Unmarshal(resp, &ip) |
| 182 | if err != nil { |
| 183 | log.Println("[!] GetIp 2 Error: ", err) |
| 184 | return |
| 185 | } |
| 186 | for _, r := range ip.Pageprops.Serverresponse.Data.Records { |
| 187 | s.result[r.Hostname] = s.Domain |
| 188 | } |
| 189 | if page >= s.MaxPage { |
| 190 | return |
| 191 | } |
| 192 | if ip.Pageprops.Serverresponse.Data.Total != len(s.result) { |
| 193 | s.GetIp(page + 1) |
| 194 | } |
| 195 | } |
| 196 | func (s *SecurityTrails) httpReq(uri string) ([]byte, error) { |
| 197 | s.hostIp = "151.139.240.16" |
| 198 | uri = strings.ReplaceAll(uri, "securitytrails.com", s.hostIp) |