-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
163 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 github.com/axiaoxin-com | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package chaojiying_test | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
"github.com/axiaoxin-com/chaojiying" | ||
) | ||
|
||
// 使用单账号的方式示例 | ||
func Example_oneAccount() { | ||
// 加载验证码图片 | ||
pic, err := os.Open("./example/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) | ||
|
||
// Output: | ||
// 破解结果: myeee | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package chaojiying_test | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
"github.com/axiaoxin-com/chaojiying" | ||
) | ||
|
||
// 使用随机选择账号的方式示例 | ||
func Example_randAccount() { | ||
// 从json文件中加载所有可用账号 | ||
// json格式: [{"user":"xx", "pass":"yy"}] | ||
// 破解验证码时随机选择其中一个可用账号进行调用 | ||
|
||
// 加载账号json信息 | ||
jsonFilename := "../personal-data/chaojiying_accounts.json" | ||
accounts, err := chaojiying.LoadAccountsFromJSONFile(jsonFilename) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// 加载验证码图片 | ||
pic, err := os.Open("./example/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) | ||
|
||
// Output: | ||
// 破解结果: myeee | ||
} |