|
@@ -0,0 +1,125 @@
|
|
|
+package common
|
|
|
+
|
|
|
+import (
|
|
|
+ "bytes"
|
|
|
+ "encoding/json"
|
|
|
+ "git.listensoft.net/tool/jspkit/common/lxhttp"
|
|
|
+ "git.listensoft.net/tool/jspkit/logger"
|
|
|
+ "io"
|
|
|
+ "net/http"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
+
|
|
|
+ "github.com/ysmood/leakless/pkg/utils"
|
|
|
+)
|
|
|
+
|
|
|
+func GetMobileCaptcha(mobile string) string {
|
|
|
+ client := &http.Client{
|
|
|
+ Timeout: 60 * time.Second,
|
|
|
+ }
|
|
|
+ defer client.CloseIdleConnections()
|
|
|
+ resp, err := client.Post("https://public.listensoft.net/api/getTaxSms", "application/json", strings.NewReader(`{"mobile":"`+mobile+`"}`))
|
|
|
+ if err != nil {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ body, err := io.ReadAll(resp.Body)
|
|
|
+ if err != nil {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ logger.Info("获取到的手机验证码: " + string(body))
|
|
|
+ return string(body)
|
|
|
+}
|
|
|
+
|
|
|
+type GsnvYzm struct {
|
|
|
+ ID uint `json:"id"`
|
|
|
+ Code string `json:"code"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func GetGsnbMobileCaptcha(mobile string, taxNo string) []GsnvYzm {
|
|
|
+ utils.Sleep(60)
|
|
|
+ client := &http.Client{
|
|
|
+ Timeout: 60 * time.Second,
|
|
|
+ }
|
|
|
+ defer client.CloseIdleConnections()
|
|
|
+ resp, err := client.Post("https://public.listensoft.net/api/getGsSms", "application/json", strings.NewReader(`{"mobile":"`+mobile+`","taxNo":"`+taxNo+`"}`))
|
|
|
+ if err != nil {
|
|
|
+ return []GsnvYzm{}
|
|
|
+ }
|
|
|
+ body, err := io.ReadAll(resp.Body)
|
|
|
+ if err != nil {
|
|
|
+ return []GsnvYzm{}
|
|
|
+ }
|
|
|
+ list := []GsnvYzm{}
|
|
|
+ json.Unmarshal(body, &list)
|
|
|
+ return list
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func UploadGsnbMobileCaptcha(id uint, taxNo string) {
|
|
|
+ utils.Sleep(60)
|
|
|
+ client := &http.Client{
|
|
|
+ Timeout: 60 * time.Second,
|
|
|
+ }
|
|
|
+ defer client.CloseIdleConnections()
|
|
|
+ param := map[string]interface{}{
|
|
|
+ "id": id,
|
|
|
+ "taxNo": taxNo,
|
|
|
+ }
|
|
|
+ bys, _ := json.Marshal(param)
|
|
|
+ client.Post("https://public.listensoft.net/api/uploadGsSms", "application/json", bytes.NewReader(bys))
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func GetMobileCaptchaForArea(mobile, area string) string {
|
|
|
+ resp, err := http.Post("https://public.listensoft.net/api/getTaxSms", "application/json", strings.NewReader(`{"mobile":"`+mobile+`","area": "`+area+`"}`))
|
|
|
+ if err != nil {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ body, err := io.ReadAll(resp.Body)
|
|
|
+ if err != nil {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ logger.Info("获取到的手机验证码: " + string(body))
|
|
|
+ return string(body)
|
|
|
+}
|
|
|
+
|
|
|
+func GetMobileCaptchaForJiangSu(mobile string) (string, error) {
|
|
|
+ c := lxhttp.NewHttpClient()
|
|
|
+ req, err := http.NewRequest("POST", "https://public.listensoft.net/api/getTaxSms", strings.NewReader(`{"mobile":"`+mobile+`"}`))
|
|
|
+ if err != nil {
|
|
|
+ logger.Info(err)
|
|
|
+ return "", err
|
|
|
+ }
|
|
|
+ req.Header.Set("Content-Type", "application/json")
|
|
|
+ resp, err := c.Do(req)
|
|
|
+ if err != nil {
|
|
|
+ logger.Info(err)
|
|
|
+ return "", err
|
|
|
+ }
|
|
|
+ body, err := io.ReadAll(resp.Body)
|
|
|
+ if err != nil {
|
|
|
+ return "", err
|
|
|
+ }
|
|
|
+ logger.Info("获取到的手机验证码: " + string(body))
|
|
|
+ return string(body), nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|