1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| func genIpaddr() string { rand.Seed(time.Now().Unix()) ip := fmt.Sprintf("%d.%d.%d.%d", rand.Intn(255), rand.Intn(255), rand.Intn(255), rand.Intn(255)) return ip }
func getUrlResponse(url string) (content []byte, header http.Header, err error) { randIp := genIpaddr() SocksProxy, _ := cfg.GetValue("scan", "SocksProxy") proxy := func(_ *http.Request) (*url.URL, error) { return url.Parse(SocksProxy) }
httpTransport := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, Proxy: proxy, }
httpClient := &http.Client{ Timeout: time.Second * 15, Transport: httpTransport, }
req, err := http.NewRequest("GET", url, nil)
if err != nil { return nil, nil, err }
req.Header.Set("Connection", "keep-alive") req.Header.Set("User-Agent", fake.UserAgent()) req.Header.Set("X-Forward-For", randIp) req.Header.Set("HTTP_X_FORWARD_FOR", randIp) req.Header.Set("HTTP_CLIENT_IP", randIp) req.Header.Set("X-Real-IP", randIp) req.Header.Set("REMOTE_ADDR", randIp) req.Header.Set("Referer", Referer)
resp, err2 := Client.Do(req) if err2 != nil { return nil, nil, err } defer resp.Body.Close()
bytes, _ := ioutil.ReadAll(resp.Body) return bytes, resp.Header, nil }
|