Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation


这是一个用于给你的Botzone升用户等级的自动化辅助项目,它通过反复创建游戏桌来给你的经验+2。

目录结构

automation/
  web_loop_automation.py          # 网页自动化入口
  automation_config.example.yaml  # 配置示例
  automation_requirements.txt     # 自动化脚本依赖

char_recognizer/
  model.pt                        # 验证码识别模型
  requirements.txt                # 识别器运行依赖
  pyproject.toml
  svg_char_recognizer/            # 识别器运行时接口

环境要求

  • Python 3.11 或更高版本
  • Chromium,由 Playwright 安装

安装

安装自动化脚本依赖:

cd automation
pip install -r automation_requirements.txt
python -m playwright install chromium

安装验证码识别器依赖:

cd ..\char_recognizer
pip install -r requirements.txt

配置

复制示例配置:

cd ..\automation
Copy-Item automation_config.example.yaml automation_config.yaml

根据实际页面修改 automation_config.yaml 中的地址、循环次数、等待时间和 CSS 选择器。

默认模型路径为:

../char_recognizer/model.pt

运行

在 automation/ 目录执行:

python web_loop_automation.py --config automation_config.yaml

临时覆盖循环次数:

python web_loop_automation.py --config automation_config.yaml --iterations 10

默认会打开可见 Chromium,便于观察页面状态和手动登录。

识别器接口

基本用法:

from svg_char_recognizer import load_model

recognizer = load_model("model.pt")
prediction = recognizer.predict("captcha.svg")
print(prediction.char, prediction.confidence, prediction.is_low_confidence)

识别结果包含:

  • char:预测字符
  • confidence:模型置信度
  • is_low_confidence:是否低于置信度阈值

实现原理

自动化脚本通过 Playwright 控制 Chromium,按配置中的 CSS 选择器进入目标页面、检测弹窗、定位验证码图片和输入框。

当弹窗中出现 SVG 验证码时,脚本会在当前浏览器会话中读取图片内容,保存为临时 SVG 文件,再调用 char_recognizer 加载 model.pt 进行分类。如果识别置信度低于配置阈值,脚本会停止并输出错误,避免继续执行错误操作。

字符识别器会将 SVG 渲染为图像,再转换为模型输入张量。模型输出 62 个类别的概率分布,最终映射为 A-Z、a-z 或 0-9 中的一个字符。

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages