验证码破解平台超级鹰 Golang 版 SDK
调用 Processing
方法,传入账号密码和验证码图片返回识别结构结构体
初始化客户端时设置可用账号列表,调用 Cr4ck
方法传入图片直接返回结果。
Cr4ck
随机选择出一个可用的账号进行调用,不可用账号将被跳过。
调用 GetScore
方法,传入账号信息查询可用题分
go get -u github.com/axiaoxin-com/chaojiying
https://godoc.org/github.com/axiaoxin-com/chaojiying
// 使用单账号的方式示例
package main
import (
"fmt"
"log"
"os"
"github.com/axiaoxin-com/chaojiying"
)
func main() {
// 加载验证码图片
pic, err := os.Open("./pin.png")
if err != nil {
log.Println(err)
}
defer pic.Close()
// 创建客户端
cli, err := chaojiying.New(nil)
if err != nil {
log.Println(err)
}
// 从环境变量获取账号信息
user := os.Getenv("user")
pass := os.Getenv("pass")
// 指定账号破解验证码
resp, err := cli.Processing(user, pass, pic)
if err != nil {
log.Println(err)
}
fmt.Println("破解结果:", resp.PicStr)
}
// 使用随机选择账号的方式示例
// 从json文件中加载所有可用账号
// json格式: [{"user":"xx", "pass":"yy"}]
// 破解验证码时随机选择其中一个可用账号进行调用
package main
import (
"fmt"
"log"
"os"
"github.com/axiaoxin-com/chaojiying"
)
func main() {
// 加载账号json信息
jsonFilename := "../../personal-data/chaojiying_accounts.json"
accounts, err := chaojiying.LoadAccountsFromJSONFile(jsonFilename)
if err != nil {
log.Fatal(err)
}
// 加载验证码图片
pic, err := os.Open("./pin.png")
if err != nil {
log.Fatal(err)
}
defer pic.Close()
// 创建多账号客户端
cli, err := chaojiying.New(accounts)
if err != nil {
log.Fatal(err)
}
// 随机账号破解
pinCode, err := cli.Cr4ck(pic)
if err != nil {
log.Fatal(err)
}
fmt.Println("破解结果:", pinCode)
}
package main
import (
"bytes"
"encoding/base64"
"fmt"
"image/png"
"log"
"github.com/axiaoxin-com/chaojiying"
)
func main() {
// 加载账号json信息
jsonFilename := "./accounts.json"
accounts, err := chaojiying.LoadAccountsFromJSONFile(jsonFilename)
if err != nil {
log.Fatal(err)
}
src := "data:image/png;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NcRC6A8n/vtDK+aGm1Sv2FuEC4l5UEH6BBR1C3Jx+iJNfTao42BdqAn3tOXCvI/I/mqcgoQYolDVO6T4nSaIRI9NPlPidY3V+/eF52YlWmzt0LEKogetBxqDKkhzhKn2OHxQsfky9uObFG6Wv2ul4BVEYgw0GHxkva8gOu/pGxNVQ44leE5MawpdZ+h4E8p/LlJJdZw6fyxC4+RYF1kQDmcSTlufDfKR9Z1EN1z56QkiDXM5+CpQ8+Z7HyWI7Z1rzlfBlwPfe9Zbls/ZN36sgny25H6U9SiC4KBjFiDnhM4zwWVHEmMvdE6MDx2rIDHI+alBNeh2uOyGEOqTI8ZWEA5jQ3Ls8XFQVRX8BxZDC9OmPWGyAAAAAElFTkSuQmCC"
data, err := base64.StdEncoding.DecodeString(src[22:]) // 去掉前缀 data:image/png;base64,
if err != nil {
// 处理错误
}
im, err := png.Decode(bytes.NewReader(data))
if err != nil {
panic("Bad png")
}
// 创建缓冲区
buff := new(bytes.Buffer)
// 将 im 编码到缓冲区
err = png.Encode(buff, im)
if err != nil {
fmt.Println("failed to create buffer", err)
}
// 将缓冲区转换为 reader
pic := bytes.NewReader(buff.Bytes())
cli, err := chaojiying.New(accounts)
if err != nil {
log.Fatal(err)
}
pinCode, err := cli.Cr4ck(pic)
if err != nil {
log.Fatal(err)
}
fmt.Println("破解结果:", pinCode)
}