Skip to content

Commit

Permalink
added new captcha methods (#22)
Browse files Browse the repository at this point in the history
* added new captcha methods

* added user-agent

---------

Co-authored-by: Victor <[email protected]>
  • Loading branch information
PBadicean and kratzky authored Oct 24, 2023
1 parent 17226ba commit 65a6591
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 1 deletion.
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ The easiest way to quickly integrate [2Captcha] into your code to automate solvi
- [CloudflareTurnstile](#cloudflare-turnstile)
- [Lemin Cropped Captcha](#lemin-cropped-captcha)
- [GeeTestV4](#geetestv4)
- [CyberSiARA](#cyber-siara)
- [DataDome](#data-dome)
- [MTCaptcha](#mtcaptcha)
- [Other methods](#other-methods)
- [send / getResult](#send--getresult)
- [balance](#balance)
Expand Down Expand Up @@ -356,6 +359,38 @@ cap := api2captcha.CloudflareTurnstile{
}
```

### CyberSiARA
Use this method to solve CyberSiARA and obtain a token to bypass the protection.
```go
cap := api2captcha.CyberSiARA{
MasterUrlId: "12333-3123123",
Url: "https://test.com",
UserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36",
}
```

### DataDome
Use this method to solve DataDome and obtain a token to bypass the protection.
To solve the DataDome captcha, you must use a proxy.
```go
cap := api2captcha.DataDome{
Url: "https://test.com",
CaptchaUrl: "https://test.com/captcha/",
Proxytype: "http",
Proxy: "proxyuser:[email protected]:3128",
UserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36",
}
```

### MTCaptcha
Use this method to solve MTCaptcha and obtain a token to bypass the protection.
```go
cap := api2captcha.MTCaptcha{
Url: "https://service.mtcaptcha.com/mtcv1/demo/index.html",
SiteKey: "MTPublic-DemoKey9M",
}
```

### Amazon WAF
Use this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat mitigation for Amazon AWS. Returns JSON with the token.

Expand All @@ -367,7 +402,6 @@ cap := api2captcha.AmazonWAF {
Context: "9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ1Jydeaja94iAS49ljb",
ChallengeScript: "https://41bcdd4fb3cb.610cd090.us-east-1.token.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/challenge.js"
CaptchaScript: "https://41bcdd4fb3cb.610cd090.us-east-1.captcha.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/captcha.js"

}
```

Expand Down
76 changes: 76 additions & 0 deletions api2captcha.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,25 @@ type (
SiteKey string
Url string
}

CyberSiARA struct {
MasterUrlId string
Url string
UserAgent string
}

DataDome struct {
Url string
CaptchaUrl string
Proxytype string
Proxy string
UserAgent string
}

MTCaptcha struct {
SiteKey string
Url string
}
)

var (
Expand Down Expand Up @@ -870,3 +889,60 @@ func (c *CloudflareTurnstile) ToRequest() Request {

return req
}

func (c *CyberSiARA) ToRequest() Request {
req := Request{
Params: map[string]string{"method": "cybersiara"},
}

if c.MasterUrlId != "" {
req.Params["master_url_id"] = c.MasterUrlId
}
if c.Url != "" {
req.Params["pageurl"] = c.Url
}
if c.UserAgent != "" {
req.Params["userAgent"] = c.UserAgent
}

return req
}

func (c *DataDome) ToRequest() Request {
req := Request{
Params: map[string]string{"method": "datadome"},
}

if c.CaptchaUrl != "" {
req.Params["captcha_url"] = c.CaptchaUrl
}
if c.Url != "" {
req.Params["pageurl"] = c.Url
}
if c.Proxytype != "" {
req.Params["proxytype"] = c.Proxytype
}
if c.Proxy != "" {
req.Params["proxy"] = c.Proxy
}
if c.UserAgent != "" {
req.Params["userAgent"] = c.UserAgent
}

return req
}

func (c *MTCaptcha) ToRequest() Request {
req := Request{
Params: map[string]string{"method": "mt_captcha"},
}

if c.SiteKey != "" {
req.Params["sitekey"] = c.SiteKey
}
if c.Url != "" {
req.Params["pageurl"] = c.Url
}

return req
}

0 comments on commit 65a6591

Please sign in to comment.