Commit 23d43697 authored by Mrs4s's avatar Mrs4s

save captcha to local file. close #71

parent 129622dd
...@@ -166,9 +166,10 @@ func main() { ...@@ -166,9 +166,10 @@ func main() {
if !rsp.Success { if !rsp.Success {
switch rsp.Error { switch rsp.Error {
case client.NeedCaptcha: case client.NeedCaptcha:
_ = ioutil.WriteFile("captcha.jpg", rsp.CaptchaImage, 0677)
img, _, _ := image.Decode(bytes.NewReader(rsp.CaptchaImage)) img, _, _ := image.Decode(bytes.NewReader(rsp.CaptchaImage))
fmt.Println(asciiart.New("image", img).Art) fmt.Println(asciiart.New("image", img).Art)
log.Warn("请输入验证码: (Enter 提交)") log.Warn("请输入验证码 (captcha.jpg): (Enter 提交)")
text, _ := console.ReadString('\n') text, _ := console.ReadString('\n')
rsp, err = cli.SubmitCaptcha(strings.ReplaceAll(text, "\n", ""), rsp.CaptchaSign) rsp, err = cli.SubmitCaptcha(strings.ReplaceAll(text, "\n", ""), rsp.CaptchaSign)
continue continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment