This commit is contained in:
Nite07 2024-12-13 21:04:42 +08:00
parent d34ae73997
commit d4ed8594b7

View File

@ -3,7 +3,6 @@ package ccs
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"strings"
"time" "time"
"github.com/Danny-Dasilva/CycleTLS/cycletls" "github.com/Danny-Dasilva/CycleTLS/cycletls"
@ -146,14 +145,9 @@ func RequestWithWAFSession(method string, URL string, wafSession Session, option
options = &cycletls.Options{} options = &cycletls.Options{}
} }
headers := map[string]string{} headers := map[string]string{}
cookies := []string{}
for _, cookie := range wafSession.Cookies {
cookies = append(cookies, cookie.Name+"="+cookie.Value)
}
for key, value := range wafSession.Headers { for key, value := range wafSession.Headers {
headers[key] = value headers[key] = value
} }
headers["Cookie"] = strings.Join(cookies, "; ")
options.Ja3 = "772,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,23-27-65037-43-51-45-16-11-13-17513-5-18-65281-0-10-35,25497-29-23-24,0" options.Ja3 = "772,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,23-27-65037-43-51-45-16-11-13-17513-5-18-65281-0-10-35,25497-29-23-24,0"
options.UserAgent = headers["user-agent"] options.UserAgent = headers["user-agent"]
@ -165,6 +159,16 @@ func RequestWithWAFSession(method string, URL string, wafSession Session, option
options.Headers[key] = value options.Headers[key] = value
} }
if options.Cookies == nil {
options.Cookies = []cycletls.Cookie{}
}
for _, cookie := range wafSession.Cookies {
options.Cookies = append(options.Cookies, cycletls.Cookie{
Name: cookie.Name,
Value: cookie.Value,
})
}
resp, err := cycletlsClient.Do(URL, *options, method) resp, err := cycletlsClient.Do(URL, *options, method)
if err != nil { if err != nil {
return resp, err return resp, err