{"id":16654146,"url":"https://github.com/letmefly666/buctoj","last_synced_at":"2025-09-06T06:32:33.429Z","repository":{"id":44376838,"uuid":"452141778","full_name":"LetMeFly666/BUCTOJ","owner":"LetMeFly666","description":"Python BUCTOJ，用Python实现对BUCTOJ的一些操作","archived":false,"fork":false,"pushed_at":"2024-06-19T03:15:48.000Z","size":73,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T11:56:12.343Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.org/project/BUCTOJ/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LetMeFly666.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2022-01-26T04:37:49.000Z","updated_at":"2024-06-19T03:15:23.000Z","dependencies_parsed_at":"2024-10-28T11:27:04.583Z","dependency_job_id":"587d57a5-301f-4bd3-89ce-80e753ab8077","html_url":"https://github.com/LetMeFly666/BUCTOJ","commit_stats":{"total_commits":63,"total_committers":2,"mean_commits":31.5,"dds":"0.015873015873015928","last_synced_commit":"17d1a578bbd6cd943c1249407665d63fe463ab9f"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/LetMeFly666/BUCTOJ","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FBUCTOJ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FBUCTOJ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FBUCTOJ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FBUCTOJ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LetMeFly666","download_url":"https://codeload.github.com/LetMeFly666/BUCTOJ/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FBUCTOJ/sbom","scorecard":{"id":83718,"data":{"date":"2025-08-11","repo":{"name":"github.com/LetMeFly666/BUCTOJ","commit":"cadc13535fdcf7dd512918e759e0be6e421a8bda"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/Make.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/Make.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/LetMeFly666/BUCTOJ/Make.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/Make.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/LetMeFly666/BUCTOJ/Make.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/Make.yml:21","Warn: pipCommand not pinned by hash: .github/workflows/Make.yml:22","Warn: pipCommand not pinned by hash: .github/workflows/Make.yml:23","Warn: pipCommand not pinned by hash: .github/workflows/Make.yml:24","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.3.8.1 not signed: https://api.github.com/repos/LetMeFly666/BUCTOJ/releases/161192591","Warn: release artifact v0.3.8 not signed: https://api.github.com/repos/LetMeFly666/BUCTOJ/releases/158794427","Warn: release artifact v0.3.7 not signed: https://api.github.com/repos/LetMeFly666/BUCTOJ/releases/158790981","Warn: release artifact v0.2.2 not signed: https://api.github.com/repos/LetMeFly666/BUCTOJ/releases/71661782","Warn: release artifact v0.2.1 not signed: https://api.github.com/repos/LetMeFly666/BUCTOJ/releases/71635138","Warn: release artifact v0.3.8.1 does not have provenance: https://api.github.com/repos/LetMeFly666/BUCTOJ/releases/161192591","Warn: release artifact v0.3.8 does not have provenance: https://api.github.com/repos/LetMeFly666/BUCTOJ/releases/158794427","Warn: release artifact v0.3.7 does not have provenance: https://api.github.com/repos/LetMeFly666/BUCTOJ/releases/158790981","Warn: release artifact v0.2.2 does not have provenance: https://api.github.com/repos/LetMeFly666/BUCTOJ/releases/71661782","Warn: release artifact v0.2.1 does not have provenance: https://api.github.com/repos/LetMeFly666/BUCTOJ/releases/71635138"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-15T06:28:28.171Z","repository_id":44376838,"created_at":"2025-08-15T06:28:28.171Z","updated_at":"2025-08-15T06:28:28.171Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273867386,"owners_count":25182423,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-12T09:48:50.940Z","updated_at":"2025-09-06T06:32:33.199Z","avatar_url":"https://github.com/LetMeFly666.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"BUCTOJ 用Python玩转北化OJ平台\n========================================\n\n.. .. image:: https://readthedocs.org/projects/buctoj/badge/?version=latest\n..     :target: https://buctoj.readthedocs.io/zh_CN/latest/?badge=latest\n..     :alt: 文档状态\n\n.. image:: https://readthedocs.org/projects/buctoj/badge/?version=latest\n\n将 `BUCT-OJ \u003chttps://buctcoder.com/\u003e`_ 的一些功能封装成包，从而实现通过脚本提交代码等。\n\n⚠ 仅供学习测试，不能用于特殊用途\n\n⚠ 对于拥有管理员账号的同学，应该有自觉使用管理号的觉悟，不会用来免做题目\n\n主要供BUCTOJ管理员使用\n\n主要功能\n=============\n\n模拟登录\n--------------------------\n\n\n::\n\n    from BUCTOJ import login\n    cookies = login(用户名, 密码)\n\n\n使用cookies中的session即可以账号身份进行操作\n\n若账号密码错误，则返回cookie不可用\n\n提交代码\n--------------------------\n\n\n::\n\n    from BUCTOJ import submit\n    submit(比赛的cid，要提交问题的pid，你的cookie，要提交的代码)\n\n\n\n上述方式会使用C++语言进行提交(目前仅支持C++)\n\n进入比赛的某道题目后，地址栏的url中会有cid和pid。\n\n例如 `Contest2347` 的 `A` 题，url为 `https://buctcoder.com/problem.php?cid=2347\u0026pid=0` ，因此此题目的cid为2374，pid为0\n\ncookie是登录功能所获得的cookie。\n\n通过id提交代码\n--------------------------\n\n\n::\n\n    from BUCTOJ import submitById, login\n    submit(login(账号，密码)，题目id，代码，语言)\n    # response = submit(login('LetMeFly', 'SoHandsome'), '6264', \"\"\"#include \u003cbits/stdc++.h\u003e\\n...\"\"\", 'C++')\n    # response = submit(login('LetMeFly', 'SoHandsome'), '6264', \"\"\"#include \u003cbits/stdc++.h\u003e\\n...\"\"\", '1')\n\n\n\n上述方式支持多种语言提交，可以传参languageid(对应的languageid在BUCTOJ的提交页面)，也可传参语言名。当语言名不受支持时会认为传递的参数是languageid。\n\n语言、id对照表：\n\n+-----------+------------+\n| 语言      | languageid |\n+===========+============+\n| C         | 0          |\n+-----------+------------+\n| C++       | 1          |\n+-----------+------------+\n| Java      | 3          |\n+-----------+------------+\n| Python    | 6          |\n+-----------+------------+\n| PHP       | 7          |\n+-----------+------------+\n| JavaScript| 16         |\n+-----------+------------+\n| Go        | 17         |\n+-----------+------------+\n| SQL       | 18         |\n+-----------+------------+\n\n题库中的问题提交之前地址栏中会存在问题id，例如问题“还原撕碎的字条，哄笑生气的毛毛”的id为6264( `https://buctoj.com/problem.php?id=6264` )\n\n函数返回来自BUCTOJ的response\n\n\n新建问题\n--------------------------------\n\n::\n\n    from BUCTOJ import create1problem, login\n    cookies = login(管理员用户名, 管理员密码)\n    problem_id = create1problem(cookies=cookies, title=\"题目标题\", description=\"题目描述\", input=\"输入描述\", output=\"输出描述\", sample_input=\"1\\n0\", sample_output=\"0\")\n\n上述代码会使用管理员账号创建一道新的问题，并返回新建问题的id。\n\n在BUCTOJ提供的新建题目的网页经常会出现编辑了很多之后提交失败的情况，使用此脚本提交可以先在本地编辑好之后一次提交成功。\n\n编辑问题\n--------------------------------\n\n::\n\n    from BUCTOJ import edit1problem, login\n    cookies = login(管理员用户名, 管理员密码)\n    edit1problem(cookies=cookies, problem_id=\"6080\", title=...后面参考新建问题create1problem函数)\n\n\n自动完成一个比赛\n--------------------------------\n\n::\n\n    from BUCTOJ import finish1contest\n    finish1contest(比赛cid, 你的用户名, 你的密码, 管理员用户名, 管理员密码)\n\n**前提**：\n\n1. 拥有一个管理员账号\n\n2. 每道题都有用C++通过者（非本次比赛提交也可）\n\n**功能**：\n\n若满足以上两个条件，则此函数具有以下功能：\n\n1. 每隔大约15s通过一道题\n\n2. 查重率为0\n\n若某次比赛中一些题目无人用C++通过，则程序会跳过此题继续提交下一题\n\n下载某比赛/题目的所有提交/AC代码\n--------------------------------\n\n::\n\n    from BUCTOJ import Config, login, saveAllCodes\n    cookies = login('账号', '密码')\n    saveAllCodes(baseurl='http://oj.narc.letmefly.xyz/status.php?cid=1269\u0026jresult=4', cookies=cookies)\n\n**前提**：\n\n1. 拥有一个管理员账号\n\n**功能**：\n\n若满足以上一个条件，则此函数具有以下功能：\n\n1. 获取baseurl的所有提交代码（会自动下一页）\n2. 以“{用户}-{提交编号}.java”命名保存到results文件夹下（若无则会自动创建）\n\n**TODO**：\n\n1. 根据提交语音自动生成文件后缀，而非默认的.java\n2. 支持用户自定义文件夹名，而非默认的results\n\n修改配置\n=============\n\n\n修改域名\n--------------------------\n\n脚本的默认oj域名为\"https://buctcoder.com/\"\n\n若非本域名的其他相同oj平台，则可以进行配置其他域名。\n\n假如\"https://oj.letmefly.xyz/\"也是采用的 `hustoj \u003chttps://github.com/zhblue/hustoj/\u003e`_ ，那么此脚本可能也能用来进行oj.letmefly.xyz的操纵。\n\n::\n\n    from BUCTOJ import Config\n    from BUCTOJ import login\n\n    Config.set_info(\"base_url\", \"https://oj.letmefly.xyz/\")\n    cookies = login(0, 0)\n\n当前仅支持“域名”这一个配置。\n\nTODO:\n=============\n\nBUGFIX: 脚本自动添加的头部会include上C++的 `\u003cbits/stdc++.h\u003e` 头文件，这可能导致原本能通过的代码产生编译错误（如 `int map;` 等）\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletmefly666%2Fbuctoj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fletmefly666%2Fbuctoj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletmefly666%2Fbuctoj/lists"}