更新随机卡号和卡密生成逻辑,调整请求参数,修改请求地址,优化并发处理

This commit is contained in:
danial
2025-06-17 00:12:12 +08:00
parent c800439fa7
commit 2b092c43f6

40
main.go
View File

@@ -29,21 +29,19 @@ func SortMap(m map[string]string) []string {
}
func GenRandomCardNo() string {
return ""
// cardNo := "X"
// for i := 0; i < 15; i++ {
// cardNo += strconv.Itoa(rand.Intn(10))
// }
// return cardNo
cardNo := "250306"
for i := 0; i < 10; i++ {
cardNo += strconv.Itoa(rand.Intn(10))
}
return cardNo
}
func GenRandomCardPass() string {
cardPass := "X"
for i := 0; i < 15; i++ {
cardPass := "350610"
for i := 0; i < 10; i++ {
cardPass += strconv.Itoa(rand.Intn(10))
}
return cardPass
// return cardPass
}
func genSign(data models.Data) string {
@@ -77,49 +75,43 @@ func genSign(data models.Data) string {
func randomRequest(count int, stop chan int, group *sync.WaitGroup, client *http.Client) {
defer func() {
time.Sleep(time.Second * 2)
<-stop
group.Done()
if err := recover(); err != nil {
fmt.Println(err)
}
}()
fmt.Println("正在发送请求次数", count)
fmt.Println("正在发送请求次数", count, time.Now().Format("2006-01-02 15:04:05"))
id, _ := gonanoid.New()
formData := models.Data{
ExValue: models.ExValue{
Data: GenRandomCardPass(),
FaceType: "100",
FaceType: "10",
CardNo: GenRandomCardNo(),
RecoveryType: "8",
RecoveryType: "2",
},
OrderNo: id,
OrderPeriod: strconv.Itoa(rand.Intn(24)),
OrderPrice: "100",
ProductCode: "8546",
OrderPrice: "10",
ProductCode: "666",
Ip: "127.0.0.1",
NotifyUrl: "https://baidu.com",
NotifyUrl: "https://shop.kkknametrans.buzz/shop/notify",
PayKey: "kkkkc9kit6bimggos5kk0c90",
TimeStamp: strconv.FormatInt(time.Now().Unix(), 10),
Sign: "",
}
formData.Sign = genSign(formData)
res, _ := client.PostForm("http://121.37.253.228:12309/gateway/scan", formData.Url())
res, _ := client.PostForm("http://175.27.239.142:12309/gateway/scan", formData.Url())
result, _ := io.ReadAll(res.Body)
fmt.Println(string(result))
}
//func GenAccount() {
// client := http.Client{}
// client.Post("http://121.37.253.228:12401/")
//}
func main() {
group := sync.WaitGroup{}
startTime := time.Now()
stop := make(chan int, 10)
stop := make(chan int, 50)
client := http.Client{}
for i := 1; i < int(math.Pow10(2)); i++ {
for i := 1; i < int(math.Pow10(3)); i++ {
group.Add(1)
stop <- 1
go randomRequest(i, stop, &group, &client)