// Generated by curl-to-Go: https://mholt.github.io/curl-to-go package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"math/rand"
"net/http"
"os"
"strings"
"time"
)
//https://shoujihao.xxx.cn/area/%E4%B8%AD%E5%B1%B1/
// curl -H "Host: guanjia.xxxx.com" -H "Cookie: obpcSession=xxxx" -H "accept: application/json, text/plain, */*" -H "content-type: application/json" -H "origin: https://guanjia.xxxx.com" -H "accept-language: zh-CN,zh-Hans;q=0.9" -H "user-agent: Mozilla/5.0 (iPhone; ) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 CN" -H "referer: https://guanjia.xxx.com/reIntercexxx" --data-binary "{\"unsId\":\"\",\"segment\":\"\"}" --compressed "https://guanjia.xxxx.com/java_api/wish/xxxx"
type Payload struct {
UnsID string `json:"unsId"`
Segment string `json:"segment"`
}
func main() {
f, err := os.Open("n.txt")
if err != nil {
os.Exit(1)
}
defer f.Close()
data, _ := ioutil.ReadAll(f)
arr := strings.Split(string(data), "\n")
mp := make(map[string]bool)
for _, v := range arr {
v := strings.TrimRight(v, "号段(移动)")
v = strings.TrimRight(v, "号段(联通)")
v = strings.TrimRight(v, "号段(电信)")
if v == "" {
continue
}
fmt.Println(" v is :", v)
//time.Sleep(time.Duration(rand.Intn(300)) * time.Millisecond)
v = v[0:5]
mp[v] = true
}
for k, _ := range mp {
sendData(Payload{Segment: k})
time.Sleep(time.Duration(rand.Intn(300)) * time.Millisecond)
}
//sendData(Payload{Segment: v})
}
func sendData(data Payload) {
payloadBytes, err := json.Marshal(data)
if err != nil {
// handle err
fmt.Printf("error marshalling payload error: %v \n", err)
}
body := bytes.NewReader(payloadBytes)
req, err := http.NewRequest("POST", "https://guanjia.xxxx.com/java_api/wish/reIntercexxx", body)
if err != nil {
// handle err
log.Printf(" http send err %v", err)
return
}
req.Host = "xxxx.com"
req.Header.Set("Cookie", "obpcSession=xxxx")
req.Header.Set("Accept", "application/json, text/plain, */*")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Origin", "https://guanjia.xxxx.com")
req.Header.Set("Accept-Language", "zh-CN,zh-Hans;q=0.9")
req.Header.Set("User-Agent", "WIFI Language/zh_CN")
req.Header.Set("Referer", "https://guanjia.xxxx.com/xxxx")
resp, err := http.DefaultClient.Do(req)
if err != nil {
// handle err
log.Printf("err :", err)
}
fmt.Printf("add %v succeeded code: %v rsp :%v\n", data.Segment, resp.Status, resp.Body)
defer resp.Body.Close()
}
本文链接:https://iokde.com/post/ban-.html,参与评论 »
--EOF--
发表于 2023-03-17 18:53:27。
本站使用「署名 4.0 国际」创作共享协议,转载请注明作者及原网址。tools更多说明 »
提醒:本文最后更新于 444 天前,文中所描述的信息可能已发生改变,请谨慎使用。
Comments