diff --git a/.gitignore b/.gitignore index 8edae64..0fd9fc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .venv build/ dist/ -__pycache__/ \ No newline at end of file +__pycache__/ +venv \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index c96344f..6a0861f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "configurations": [ { "name": "Python: 当前文件", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${file}", "console": "integratedTerminal", @@ -14,7 +14,7 @@ }, { "name": "Python: FastAPI", - "type": "python", + "type": "debugpy", "request": "launch", "module": "uvicorn", "args": [ diff --git a/README.md b/README.md index 3a4cbba..5485756 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,82 @@ # captcha_solver_web -这是一个简单的验证码识别服务器,默认监听 127.0.0.1:8000 - -## 接口 -Endpoint: /captcha -Method: POST -Content-Type: application/json -Body Example: -```json -{ - "img": "iVBORw0KGgoAAAANSUhEUgAAAUAAAABICAIAAAAI1rskAAAIQ0lEQVR4nOzde1BTZ94H8OckJ9wvuQiBAGpAJSiaKniheK+83l63KrWd6W7XVu1029LRtZ29jLu61nVvnXa666wzdcd21kvHVXfrrtbWtlbdKkqlaqEC5X6JQAiEkECAXHfgpDEcwqVtYvLMfD9/Pc95fsn8mMzXnJzznJGtLTUTAKCTINANAMB3hwADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADF2EA3AIFntVkLS69+VVtiMOljImMXZObOzZgf6KZgXBjP/x+4TPtpq7FyeJFIGDZv4qZQNtLpdBQ1njRbDPx3IYKMhGUJ0VMJIRVt/23uKuOtK6VzlLK5fvob4Pv4vOz6zw/u1OpbPQ/Onpb1WsGfFROSAtcXjMuQAP/h4gqbvd9r3YZZe2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CIo7ABlhrjCjAABCfstQCgGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQagGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQag2P8CAAD//zkBfy8qu4vrAAAAAElFTkSuQmCC" -} + +[README](README.md) | [中文文档](README_zh_CN.md) + +A simple HTTP server for solving captchas. +You can download the Windows version from the [release page](https://github.com/AlpsMonaco/captcha_solver_web/releases). +For Linux/Mac OS, you'll need to have `python` installed to run or package the server yourself. + +## API Reference + +### Endpoint + +- URL: `/captcha` +- Method: `POST` +- Content-Type: `application/json` + +### Request Body + +| Parameter | Description | +| --------- | ----------------------------------- | +| img | Base64-encoded captcha image string | + +### Example + +For a captcha image, encode it in base64 and call the API: +![captcha](w8.png "captcha") + +```bash +curl http://127.0.0.1:8000/captcha -XPOST -H "Content-Type: application/json" \ +--data '{"img": "iVBORw0KGgoAAAANSUhEUgAAAUAAAABICAIAAAAI1rskAAAIQ0lEQVR4nOzde1BTZ94H8OckJ9wvuQiBAGpAJSiaKniheK+83l63KrWd6W7XVu1029LRtZ29jLu61nVvnXa666wzdcd21kvHVXfrrtbWtlbdKkqlaqEC5X6JQAiEkECAXHfgpDEcwqVtYvLMfD9/Pc95fsn8mMzXnJzznJGtLTUTAKCTINANAMB3hwADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADF2EA3AIFntVkLS69+VVtiMOljImMXZObOzZgf6KZgXBjP/x+4TPtpq7FyeJFIGDZv4qZQNtLpdBQ1njRbDPx3IYKMhGUJ0VMJIRVt/23uKuOtK6VzlLK5fvob4Pv4vOz6zw/u1OpbPQ/Onpb1WsGfFROSAtcXjMuQAP/h4gqbvd9r3YZZe2YkrGgxfn34xjavBRnyZfnqVwkhr19a22s18lalkSkv5L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BgAIohwAAUQ4ABKIYAA1AMAQagGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQag2P8CAAD//zkBfy8qu4vrAAAAAElFTkSuQmCC"}' +``` + +**Response**: + +```bash +>> {"result":"w8"} +``` + +## Project Setup + +For Windows users,you could simply run the binary from [release page](https://github.com/AlpsMonaco/captcha_solver_web/releases). + +```powershell +.\captcha_resolver.exe --host 127.0.0.1 --port 8000 +``` + +### Initialize + +#### Windows + +```powershell +python -m venv venv +call venv\Scripts\activate +pip install -r requirements.txt ``` -参数说明: -img: base64编码后的二进制图片数据 - -返回: -```json -{ - "result":"w8" -} + +#### Linux/Mac OS + +```bash +python -m venv venv +source venv/bin/activate +pip install -r requirements.txt +``` + +### Run the Server + +#### Windows + +```powershell +python -m uvicorn app:app --host 127.0.0.1 --port 8000 +``` + +#### Linux/Mac OS + +```bash +python -m uvicorn app:app --host 127.0.0.1 --port 8000 ``` -## 附录 -您可以访问 127.0.0.1:8000/docs -访问接口文档并测试 +## Credits +- [ddddocr](https://github.com/sml2h3/ddddocr) +- [uvicorn](https://github.com/encode/uvicorn) diff --git a/README_zh_CN.md b/README_zh_CN.md new file mode 100644 index 0000000..b36d3e4 --- /dev/null +++ b/README_zh_CN.md @@ -0,0 +1,80 @@ +# captcha_solver_web + +一个简单的验证码识别 HTTP 服务器。 +你可以从[release page](https://github.com/AlpsMonaco/captcha_solver_web/releases) 下载 Windows 版本。 +对于 Linux/Mac OS 系统,需要安装 python 运行或自行打包。 + +## API 参考 + +### 接口 + +- 路径: `/captcha` +- 请求方法: `POST` +- 内容类型: `application/json` + +### Request Body + +| 参数 | 描述 | +| ---- | ----------------------- | +| img | Base64 编码的验证码图片 | + +### 示例 + +对于如下的验证码图片,先将其编码为 base64 后调用 API。 +![captcha](w8.png "captcha") + +```bash +curl http://127.0.0.1:8000/captcha -XPOST -H "Content-Type: application/json" \ +--data '{"img": "iVBORw0KGgoAAAANSUhEUgAAAUAAAABICAIAAAAI1rskAA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OyFOnLz5e/NPhx4UC0fO5x8Thio+/PlDUcHJ4gTx66rM52L4T7DRtTY/tWmfs6Rql5sDOt85d+/fuLfsk0dIH2BqM12hnuUppdnx02vDjD0/+IffsUVbKeq8vfFj5pO86BH9Jjk/568t/i4mMHangpU075dIEpSIV6Q1aY/xMXZS6mXdEEpGUm/oUN5ZGpKTHL+YVKGJVMxJW+LRJ8Jcs1dzT+8/mzV0lFNy/JCliRYvUS9/Z9a4yMfW9K6cL8r2chUGQGO0UmnP05kvubZVCAbt57kFFbIZ7VW9ueqtws91h5aYiYdiW+YfiopT+7Bl8r6unq0ZT1WfpmxA7oVXfUtFQXlh6ddmcRzav2Rro1mA0YwfY1N9+5GZBp/leiDB8/aw9wx/N/6r14/+U7nc47eGimHz1q5OlWf5sGPzlnk7zm8O7KhrK7Hbbo4vzN6/emiBLDHRTMIaxAzz4/GBfQ+edxJj0yBDv+9r15ia9WTNRrA5hI/zQJDwgJrPR7nCIo7ABlhrjCjAABCfstQCgGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQagGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQag2P8CAAD//zkBfy8qu4vrAAAAAElFTkSuQmCC"}' +``` + +**返回结果:**: + +```bash +>> {"result":"w8"} +``` + +## 项目设置 + +windows用户可以直接从[release page](https://github.com/AlpsMonaco/captcha_solver_web/releases)下载预编译好的二进制,然后直接运行。 + +```powershell +.\captcha_resolver.exe --host 127.0.0.1 --port 8000 +``` + +### 初始化 + +#### Windows + +```powershell +python -m venv venv +call venv\Scripts\activate +pip install -r requirements.txt +``` + +#### Linux/Mac OS + +```bash +python -m venv venv +source venv/bin/activate +pip install -r requirements.txt +``` + +### 运行服务器 + +#### Windows + +```powershell +python -m uvicorn app:app --host 127.0.0.1 --port 8000 +``` + +#### Linux/Mac OS + +```bash +python -m uvicorn app:app --host 127.0.0.1 --port 8000 +``` + +## Credits + +- [ddddocr](https://github.com/sml2h3/ddddocr) +- [uvicorn](https://github.com/encode/uvicorn) diff --git a/app.py b/app.py index 31dfaf9..eb457ab 100644 --- a/app.py +++ b/app.py @@ -4,6 +4,7 @@ import ddddocr import base64 import uvicorn +import argparse app = FastAPI() app.add_middleware( @@ -31,4 +32,8 @@ async def get_captcha(req: GetCaptchaRequest): if __name__ == "__main__": - uvicorn.run(app="app:app") + parser = argparse.ArgumentParser("captcha resolver") + parser.add_argument("--host", help="host", default="127.0.0.1") + parser.add_argument("--port", help="port", default="8000") + args = parser.parse_args() + uvicorn.run(app="app:app", host=args.host, port=int(args.port)) diff --git a/app.spec b/app.spec index c97858f..9f13170 100644 --- a/app.spec +++ b/app.spec @@ -8,7 +8,7 @@ a = Analysis( ['app.py'], pathex=[], binaries=[], - datas=[('D:\github.com\captcha_solver_web\.venv\Lib\site-packages\ddddocr\common.onnx','ddddocr')], + datas=[('venv/Lib/site-packages/ddddocr/common.onnx','ddddocr'),('venv/Lib/site-packages/ddddocr/common_old.onnx','ddddocr')], hiddenimports=[ 'uvicorn.logging', 'uvicorn.loops', @@ -40,7 +40,7 @@ exe = EXE( a.zipfiles, a.datas, [], - name='app', + name='captcha_resolver', debug=False, bootloader_ignore_signals=False, strip=False, diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..72533cd --- /dev/null +++ b/requirements.txt @@ -0,0 +1,32 @@ +altgraph==0.17.4 +annotated-types==0.7.0 +anyio==4.6.0 +click==8.1.7 +colorama==0.4.6 +coloredlogs==15.0.1 +ddddocr==1.5.5 +fastapi==0.115.0 +flatbuffers==24.3.25 +h11==0.14.0 +humanfriendly==10.0 +idna==3.10 +mpmath==1.3.0 +numpy==2.1.1 +onnxruntime==1.19.2 +opencv-python-headless==4.10.0.84 +packaging==24.1 +pefile==2024.8.26 +pillow==10.4.0 +protobuf==5.28.2 +pydantic==2.9.2 +pydantic_core==2.23.4 +pyinstaller==6.10.0 +pyinstaller-hooks-contrib==2024.8 +pyreadline3==3.5.4 +pywin32-ctypes==0.2.3 +setuptools==75.1.0 +sniffio==1.3.1 +starlette==0.38.6 +sympy==1.13.3 +typing_extensions==4.12.2 +uvicorn==0.30.6 diff --git a/w8.png b/w8.png new file mode 100644 index 0000000..7f8bb38 Binary files /dev/null and b/w8.png differ