You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
6.0 KiB
173 lines
6.0 KiB
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"fmt"
|
|
"net/http"
|
|
"strings"
|
|
"sync"
|
|
)
|
|
|
|
type LoginResponse struct {
|
|
Data struct {
|
|
AccessToken string `json:"access_token"`
|
|
TokenType string `json:"token_type"`
|
|
Token string `json:"token"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
type ClaimResponse struct {
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
func dailyClaim3DOS(email, password string) string {
|
|
client := &http.Client{}
|
|
loginURL := "https://api.dashboard.3dos.io/api/auth/login"
|
|
loginPayload := map[string]string{
|
|
"email": email,
|
|
"password": password,
|
|
}
|
|
loginPayloadJSON, _ := json.Marshal(loginPayload)
|
|
|
|
loginReq, _ := http.NewRequest("POST", loginURL, bytes.NewBuffer(loginPayloadJSON))
|
|
loginReq.Header.Set("Accept", "application/json, text/plain, */*")
|
|
loginReq.Header.Set("Accept-Encoding", "gzip, deflate, br, zstd")
|
|
loginReq.Header.Set("Accept-Language", "zh-CN,zh;q=0.9")
|
|
loginReq.Header.Set("Content-Type", "application/json")
|
|
loginReq.Header.Set("Origin", "https://dashboard.3dos.io")
|
|
loginReq.Header.Set("Priority", "u=1, i")
|
|
loginReq.Header.Set("Referer", "https://dashboard.3dos.io/")
|
|
loginReq.Header.Set("Sec-CH-UA", `"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"`)
|
|
loginReq.Header.Set("Sec-CH-UA-Mobile", "?0")
|
|
loginReq.Header.Set("Sec-CH-UA-Platform", `"Windows"`)
|
|
loginReq.Header.Set("Sec-Fetch-Dest", "empty")
|
|
loginReq.Header.Set("Sec-Fetch-Mode", "cors")
|
|
loginReq.Header.Set("Sec-Fetch-Site", "same-site")
|
|
loginReq.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36")
|
|
|
|
loginResp, err := client.Do(loginReq)
|
|
if err != nil {
|
|
return fmt.Sprintf("%s: 登录请求失败", email)
|
|
}
|
|
defer loginResp.Body.Close()
|
|
|
|
if loginResp.StatusCode != 200 {
|
|
return fmt.Sprintf("%s: 登录失败", email)
|
|
}
|
|
|
|
var loginData LoginResponse
|
|
json.NewDecoder(loginResp.Body).Decode(&loginData)
|
|
|
|
token := loginData.Data.AccessToken
|
|
if token == "" {
|
|
token = loginData.Data.Token
|
|
}
|
|
tokenType := loginData.Data.TokenType
|
|
|
|
if token == "" || tokenType == "" {
|
|
return fmt.Sprintf("%s: 登录响应中未找到 Token 或 Token 类型", email)
|
|
}
|
|
|
|
authorizationHeader := fmt.Sprintf("%s %s", tokenType, token)
|
|
|
|
optionsURL := "https://api.dashboard.3dos.io/api/claim-reward"
|
|
optionsReq, _ := http.NewRequest("OPTIONS", optionsURL, nil)
|
|
optionsReq.Header.Set("Accept", "*/*")
|
|
optionsReq.Header.Set("Accept-Encoding", "gzip, deflate, br, zstd")
|
|
optionsReq.Header.Set("Accept-Language", "zh-CN,zh;q=0.9")
|
|
optionsReq.Header.Set("Access-Control-Request-Headers", "authorization,cache-control,content-type,expires,pragma")
|
|
optionsReq.Header.Set("Access-Control-Request-Method", "POST")
|
|
optionsReq.Header.Set("Origin", "https://dashboard.3dos.io")
|
|
optionsReq.Header.Set("Priority", "u=1, i")
|
|
optionsReq.Header.Set("Referer", "https://dashboard.3dos.io/")
|
|
optionsReq.Header.Set("Sec-Fetch-Dest", "empty")
|
|
optionsReq.Header.Set("Sec-Fetch-Mode", "cors")
|
|
optionsReq.Header.Set("Sec-Fetch-Site", "same-site")
|
|
optionsReq.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36")
|
|
|
|
optionsResp, err := client.Do(optionsReq)
|
|
if err != nil {
|
|
return fmt.Sprintf("%s: OPTIONS 请求失败", email)
|
|
}
|
|
defer optionsResp.Body.Close()
|
|
|
|
claimURL := "https://api.dashboard.3dos.io/api/claim-reward"
|
|
claimPayload := map[string]string{
|
|
"id": "daily-reward-api",
|
|
}
|
|
claimPayloadJSON, _ := json.Marshal(claimPayload)
|
|
|
|
claimReq, _ := http.NewRequest("POST", claimURL, bytes.NewBuffer(claimPayloadJSON))
|
|
claimReq.Header.Set("Accept", "application/json, text/plain, */*")
|
|
claimReq.Header.Set("Authorization", authorizationHeader)
|
|
claimReq.Header.Set("Cache-Control", "no-cache")
|
|
claimReq.Header.Set("Content-Type", "application/json")
|
|
claimReq.Header.Set("Expires", "0")
|
|
claimReq.Header.Set("Origin", "https://dashboard.3dos.io")
|
|
claimReq.Header.Set("Pragma", "no-cache")
|
|
claimReq.Header.Set("Priority", "u=1, i")
|
|
claimReq.Header.Set("Referer", "https://dashboard.3dos.io/")
|
|
claimReq.Header.Set("Sec-CH-UA", `"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"`)
|
|
claimReq.Header.Set("Sec-CH-UA-Mobile", "?0")
|
|
claimReq.Header.Set("Sec-CH-UA-Platform", `"Windows"`)
|
|
claimReq.Header.Set("Sec-Fetch-Dest", "empty")
|
|
claimReq.Header.Set("Sec-Fetch-Mode", "cors")
|
|
claimReq.Header.Set("Sec-Fetch-Site", "same-site")
|
|
claimReq.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36")
|
|
|
|
claimResp, err := client.Do(claimReq)
|
|
if err != nil {
|
|
return fmt.Sprintf("%s: claim-reward 请求失败", email)
|
|
}
|
|
defer claimResp.Body.Close()
|
|
|
|
var claimData ClaimResponse
|
|
json.NewDecoder(claimResp.Body).Decode(&claimData)
|
|
|
|
if claimResp.StatusCode != 200 && claimResp.StatusCode != 429 {
|
|
return fmt.Sprintf("%s: claim 报错: %s, 状态码%d", email, claimData.Message, claimResp.StatusCode)
|
|
}
|
|
|
|
return fmt.Sprintf("%s: %s", email, claimData.Message)
|
|
}
|
|
|
|
func main() {
|
|
fmt.Println("开始执行...")
|
|
|
|
accountList := []string{
|
|
"jack0210_@hotmail.com|||aaaAAA111!!!",
|
|
"yujieccyj01@hotmail.com|||aaaAAA111!!!",
|
|
"yujieccyj02@hotmail.com|||aaaAAA111!!!",
|
|
"yujieccyj03@hotmail.com|||aaaAAA111!!!",
|
|
"yujieccyj04@hotmail.com|||aaaAAA111!!!",
|
|
"yujieccyj05@hotmail.com|||aaaaAA111!!!",
|
|
"yujieccyj06@hotmail.com|||aaaAAA111!!!",
|
|
"yujieccyj07@hotmail.com|||aaaAAA111!!!",
|
|
"yujieccyj08@hotmail.com|||aaaAAA111!!!",
|
|
"yujieccyj09@hotmail.com|||aaaAAA111!!!",
|
|
"yujieccyj10@hotmail.com|||aaaAAA111!!!",
|
|
}
|
|
|
|
var wg sync.WaitGroup
|
|
results := make(chan string, len(accountList))
|
|
|
|
for _, account := range accountList {
|
|
if account == "" {
|
|
continue
|
|
}
|
|
wg.Add(1)
|
|
go func(acc string) {
|
|
defer wg.Done()
|
|
email, password := strings.Split(acc, "|||")[0], strings.Split(acc, "|||")[1]
|
|
results <- dailyClaim3DOS(email, password)
|
|
}(account)
|
|
}
|
|
|
|
wg.Wait()
|
|
close(results)
|
|
|
|
for result := range results {
|
|
fmt.Println(result)
|
|
}
|
|
}
|
|
|