{"id":23486826,"url":"https://github.com/do1e/fill_in_captcha","last_synced_at":"2025-07-02T06:06:00.957Z","repository":{"id":158841136,"uuid":"601017707","full_name":"Do1e/fill_in_captcha","owner":"Do1e","description":"南大统一身份认证自动填充验证码","archived":false,"fork":false,"pushed_at":"2024-11-27T11:31:21.000Z","size":17442,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T09:14:46.920Z","etag":null,"topics":["nanjing-university","nju"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Do1e.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-13T07:29:45.000Z","updated_at":"2024-11-27T11:31:25.000Z","dependencies_parsed_at":"2025-04-14T07:20:05.316Z","dependency_job_id":null,"html_url":"https://github.com/Do1e/fill_in_captcha","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Do1e/fill_in_captcha","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Do1e%2Ffill_in_captcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Do1e%2Ffill_in_captcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Do1e%2Ffill_in_captcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Do1e%2Ffill_in_captcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Do1e","download_url":"https://codeload.github.com/Do1e/fill_in_captcha/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Do1e%2Ffill_in_captcha/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263083591,"owners_count":23411163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nanjing-university","nju"],"created_at":"2024-12-24T22:17:24.623Z","updated_at":"2025-07-02T06:06:00.930Z","avatar_url":"https://github.com/Do1e.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 南大统一身份认证自动填充验证码\n\n![效果](img/效果.gif)\n\n识别服务器代码 [server.py](server.py) [@Do1e](https://github.com/Do1e)\n\nTampermonkey脚本 [send_captcha.js](send_captcha.js) [@Bubbleioa](https://github.com/Bubbleioa)\n\n## 无域名和SSL证书使用（不建议）\n\n注：如果你的服务器已经安装了证书，可在 [server.py L25](server.py#L25) 中修改`certfile`和`keyfile`的值为你的证书路径，或者删除这两个参数使用nginx等反向代理，即可不用配置证书。\n\n### 服务器\n\n1. 下载 [mkcert](https://github.com/FiloSottile/mkcert/releases)\n2. 打开终端运行 `./mkcert -install`，安装根证书\n3. 运行 `./mkcert xxx.xxx.xxx.xxx`，生成SSL证书，其中`xxx.xxx.xxx.xxx`为你的服务器IP地址。此时得到`xxx.xxx.xxx.xxx.pem`和`xxx.xxx.xxx.xxx-key.pem`两个文件，填入 [server.py L25](server.py#L25) 中的`certfile`和`keyfile`参数。\n4. 运行 `./mkcert -CAROOT` 查看根证书路径，找到该路径下的`rootCA.pem`文件，后缀改为`.crt`。\n5. 运行[server.py](server.py)，Windows下 `pythonw server.py`，Linux下 `nohup python server.py \u0026`，即可实现后台运行。\n\nLinux下也可使用`systemd`实现开机自启动，创建`/etc/systemd/system/read_captcha.service`文件，内容如下：\n\n```ini\n[Unit]\nDescription=readcaptcha\nAfter=network.target\n\n[Service]\nType=idle\nUser=root\nRestart=on-failure\nRestartSec=60s\nWorkingDirectory=/path/to/read_captcha\nExecStart=python sever.py\n\n[Install]\nWantedBy=multi-user.target\n```\n\n运行`systemctl enable read_captcha`即可实现开机自启动，`systemctl start read_captcha`启动服务。\n\n### 客户端\n\n1. 双击安装之前保存的根证书 `rootCA.crt` 至可信任根证书颁发机构。\n2. 在浏览器中访问 `https://xxx.xxx.xxx.xxx`，若提示不安全，说明证书配置失败；\n   ![证书配置失败](img/证书配置失败.png)\n3. 若正确提示 `Welcome to the Captcha Server! Post your captcha to /api`，说明证书配置成功。\n   ![证书配置成功](img/证书配置成功.png)\n4. 修改 [send_captcha.js L20](send_captcha.js#L20) 中的 `url` 变量为你的服务器地址，并在 Tampermonkey 中安装。\n5. 此时访问 [统一身份认证](https://authserver.nju.edu.cn/authserver/login) ，即可自动填充验证码。\n\n## 有域名和SSL证书使用\n\n### 服务器\n\n1. 在服务器上安装nginx，配置SSL证书。\n2. 使用docker运行，可自定义端口：\n\n```bash\ndocker run -d --restart=always --name readcaptcha \\\n    -e PORT=12345 \\\n    -p 127.0.0.1:12345:12345 \\\n    do1e/readcaptcha:latest\n```\n3. nginx配置示例：\n\n```nginx\nserver {\n    listen 443 ssl;\n    listen [::]:443 ssl;\n    server_name example.com;\n    access_log /var/log/nginx/readcaptcha.access.log;\n    error_log /var/log/nginx/readcaptcha.error.log;\n    location / {\n        proxy_pass http://127.0.0.1:12345;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Real-PORT $remote_port;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    }\n}\n```\n\n### 客户端\n\n1. 修改 [send_captcha.js L20](send_captcha.js#L20) 中的 `url` 变量为你的服务器地址，并在 Tampermonkey 中安装。\n2. 此时访问 [统一身份认证](https://authserver.nju.edu.cn/authserver/login) ，即可自动填充验证码。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo1e%2Ffill_in_captcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdo1e%2Ffill_in_captcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo1e%2Ffill_in_captcha/lists"}