feat: add geetest support
All checks were successful
release-tag / release (push) Successful in 2m4s
All checks were successful
release-tag / release (push) Successful in 2m4s
This commit is contained in:
parent
a9cf77ca52
commit
848be2b32b
@ -253,6 +253,36 @@ func (a *antigateV2Api) createTask(request struct {
|
||||
}
|
||||
satiTask.(*sati.FunCaptchaTask).Proxy = proxy
|
||||
}
|
||||
case "geetesttask", "geetesttaskproxyless":
|
||||
var task struct {
|
||||
WebsiteURL string `json:"websiteURL"`
|
||||
SiteKey string `json:"gt"`
|
||||
Challenge string `json:"challenge"`
|
||||
ApiServer *string `json:"geetestApiServerSubdomain"`
|
||||
Version *int `json:"version"`
|
||||
}
|
||||
mapstructure.Decode(request.Task, &task)
|
||||
if task.Version != nil && *task.Version != 3 {
|
||||
a.ctx.Logger.WithFields(logrus.Fields{
|
||||
"version": *task.Version,
|
||||
"handler": a.Name(),
|
||||
}).Warn("attempt to solve geetest with bad version")
|
||||
return errorTaskNotSupported
|
||||
}
|
||||
|
||||
satiTask = &sati.GeeTest3Task{
|
||||
SiteKey: task.SiteKey,
|
||||
Challenge: task.Challenge,
|
||||
ApiServer: task.ApiServer,
|
||||
PageUrl: task.WebsiteURL,
|
||||
}
|
||||
if taskType == "geetesttask" {
|
||||
proxy := collectAntiGateV2Proxy(request.Task)
|
||||
if proxy == nil {
|
||||
return errorProxyConnectRefused
|
||||
}
|
||||
satiTask.(*sati.GeeTest3Task).Proxy = proxy
|
||||
}
|
||||
default:
|
||||
return errorTaskNotSupported
|
||||
}
|
||||
|
@ -177,7 +177,8 @@ func (a *capSolverApi) createTask(request struct {
|
||||
|
||||
var satiTask sati.AnyTask
|
||||
|
||||
switch strings.ToLower(taskType) {
|
||||
taskType = strings.ToLower(taskType)
|
||||
switch taskType {
|
||||
case "anticloudflaretask":
|
||||
var task struct {
|
||||
WebsiteURL string `json:"websiteURL"`
|
||||
@ -237,6 +238,34 @@ func (a *capSolverApi) createTask(request struct {
|
||||
}
|
||||
satiTask.(*sati.FunCaptchaTask).Proxy = proxy
|
||||
}
|
||||
case "geetesttask", "geetesttaskproxyless":
|
||||
var task struct {
|
||||
WebsiteURL string `json:"websiteURL"`
|
||||
SiteKey string `json:"gt"`
|
||||
Challenge string `json:"challenge"`
|
||||
CaptchaId *string `json:"captchaId"`
|
||||
ApiServer *string `json:"geetestApiServerSubdomain"`
|
||||
}
|
||||
mapstructure.Decode(request.Task, &task)
|
||||
if task.CaptchaId != nil {
|
||||
a.ctx.Logger.WithField("handler", a.Name()).
|
||||
Warn("attempt to solve geetest v4")
|
||||
return csErrorTaskNotSupported
|
||||
}
|
||||
|
||||
satiTask = &sati.GeeTest3Task{
|
||||
SiteKey: task.SiteKey,
|
||||
Challenge: task.Challenge,
|
||||
ApiServer: task.ApiServer,
|
||||
PageUrl: task.WebsiteURL,
|
||||
}
|
||||
if taskType == "geetesttask" {
|
||||
proxy := collectCapSolverProxy(request.Task)
|
||||
if proxy == nil {
|
||||
return csErrorInvalidTaskData
|
||||
}
|
||||
satiTask.(*sati.GeeTest3Task).Proxy = proxy
|
||||
}
|
||||
default:
|
||||
return csErrorTaskNotSupported
|
||||
}
|
||||
|
@ -203,6 +203,23 @@ func (a *ruCaptchaApi) endpointIn(params url.Values) ruCaptchaResponse {
|
||||
Data: data,
|
||||
Proxy: extractRuCaptchaProxy(params),
|
||||
})
|
||||
case "geetest":
|
||||
task := &sati.GeeTest3Task{
|
||||
Proxy: extractRuCaptchaProxy(params),
|
||||
SiteKey: params.Get("gt"),
|
||||
PageUrl: params.Get("pageurl"),
|
||||
Challenge: params.Get("challenge"),
|
||||
}
|
||||
if task.SiteKey == "" || task.PageUrl == "" || task.Challenge == "" {
|
||||
return &simpleResponse{0, "ERROR_BAD_PARAMETERS"}
|
||||
}
|
||||
|
||||
if params.Has("api_server") {
|
||||
apiServer := params.Get("api_server")
|
||||
task.ApiServer = &apiServer
|
||||
}
|
||||
|
||||
id = a.ctx.Registry.CreateTask(task)
|
||||
default:
|
||||
return &simpleResponse{0, "ERROR_ZERO_CAPTCHA_FILESIZE"}
|
||||
}
|
||||
@ -228,6 +245,14 @@ func (a *ruCaptchaApi) convertTaskResult(task *Task) string {
|
||||
return result.Token
|
||||
case *sati.FunCaptchaResult:
|
||||
return result.Token
|
||||
case *sati.GeeTest3Result:
|
||||
data, _ := json.Marshal(&struct {
|
||||
Challenge string `json:"geetest_challenge"`
|
||||
Validate string `json:"geetest_validate"`
|
||||
Seccode string `json:"geetest_seccode"`
|
||||
}{result.Challenge, result.Validate, result.Seccode})
|
||||
|
||||
return string(data)
|
||||
}
|
||||
|
||||
a.ctx.Logger.WithFields(logrus.Fields{
|
||||
|
2
go.mod
2
go.mod
@ -2,7 +2,7 @@ module git.sati.ac/sati.ac/bridge
|
||||
|
||||
go 1.20
|
||||
|
||||
require git.sati.ac/sati.ac/sati-go v0.0.0-20230725102846-8e6b00348696
|
||||
require git.sati.ac/sati.ac/sati-go v0.0.0-20230801043632-286e5aa6e5c9
|
||||
|
||||
require (
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
|
2
go.sum
2
go.sum
@ -8,6 +8,8 @@ git.sati.ac/sati.ac/sati-go v0.0.0-20230713145537-57719018ca00 h1:emjsk5AubG3EiC
|
||||
git.sati.ac/sati.ac/sati-go v0.0.0-20230713145537-57719018ca00/go.mod h1:dsLvwV5+2YUjWRAuTYFf/EMvoH/twUu/NWA0t5Yl3pQ=
|
||||
git.sati.ac/sati.ac/sati-go v0.0.0-20230725102846-8e6b00348696 h1:ld33XeJOBd1skmlVz/TQrcuZPaTIuBt+J1n52oRfPAo=
|
||||
git.sati.ac/sati.ac/sati-go v0.0.0-20230725102846-8e6b00348696/go.mod h1:dsLvwV5+2YUjWRAuTYFf/EMvoH/twUu/NWA0t5Yl3pQ=
|
||||
git.sati.ac/sati.ac/sati-go v0.0.0-20230801043632-286e5aa6e5c9 h1:8BOOkuFUf3l9vJYc0bt+eWN7VAEZAVhbdiCBhdWtL0A=
|
||||
git.sati.ac/sati.ac/sati-go v0.0.0-20230801043632-286e5aa6e5c9/go.mod h1:dsLvwV5+2YUjWRAuTYFf/EMvoH/twUu/NWA0t5Yl3pQ=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
|
||||
|
Loading…
x
Reference in New Issue
Block a user