{"id":23486819,"url":"https://github.com/do1e/p-dot-nju-login","last_synced_at":"2025-10-07T04:45:07.570Z","repository":{"id":158841185,"uuid":"544067809","full_name":"Do1e/p-dot-nju-login","owner":"Do1e","description":"使用命令行登录南京大学校园网(p.nju.edu.cn)，统一身份验证方式","archived":false,"fork":false,"pushed_at":"2024-07-16T15:47:07.000Z","size":63,"stargazers_count":27,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T01:35:37.731Z","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":"2022-10-01T15:00:22.000Z","updated_at":"2025-04-12T07:02:36.000Z","dependencies_parsed_at":"2024-07-16T19:14:38.296Z","dependency_job_id":"a978b550-35b7-48f8-b372-44e0729017c8","html_url":"https://github.com/Do1e/p-dot-nju-login","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Do1e/p-dot-nju-login","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Do1e%2Fp-dot-nju-login","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Do1e%2Fp-dot-nju-login/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Do1e%2Fp-dot-nju-login/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Do1e%2Fp-dot-nju-login/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Do1e","download_url":"https://codeload.github.com/Do1e/p-dot-nju-login/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Do1e%2Fp-dot-nju-login/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278722724,"owners_count":26034461,"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-10-07T02:00:06.786Z","response_time":59,"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":["nanjing-university","nju"],"created_at":"2024-12-24T22:17:23.143Z","updated_at":"2025-10-07T04:45:07.543Z","avatar_url":"https://github.com/Do1e.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 使用命令行登录南京大学校园网(p.nju.edu.cn)\n\n使用`curl`命令可以简洁实现：\n\n```bash\n# 登录\ncurl https://p.nju.edu.cn/api/portal/v1/login -X POST -d '{\"username\":\"学号\", \"password\":\"密码\"}'\n# 登出\ncurl https://p.nju.edu.cn/api/portal/v1/logout -X POST -d '{}'\n```\n\n## 使用方法\n* 本项目使用Python3编写，需要安装requests、pandas、[NJUlogin](https://github.com/Do1e/NJUlogin)库。\n  ```bash\n  pip install -r requirements.txt\n  ```\n* 登录\n  ```bash\n  python3 main.py -i\n  ```\n  会在终端打印统一身份验证的二维码，使用手机扫码登录即可。(未测试字体，若出问题请尝试更换终端字体，如`MesloLGS NF`、`Fira Code`)\n* 登出\n  ```bash\n  python3 main.py -o\n  ```\n* 无感认证管理：\n  * 启用当前设备的无感认证：\n    ```bash\n    python3 main.py -a 笔记本电脑\n    ```\n  * 启用其他设备的无感认证，当前只能做Linux下以超级用户身份运行。\n    原理是将Linux下的mac地址更改到与另一个设备相同，开启无感认证后恢复为原来的mac地址，有一定概率出现bug。\n    需要指定当前设备连接校园网的网卡，如`wlo1`(使用`ifconfig`查看)，并指定另一个设备的MAC地址，可以连接到Windows笔记本的热点并在设置里面查看，其他方法也可自行查找。\n    ```bash\n    python3 main.py -a 树莓派 -m ab:cd:ef:01:23:45 -n wlo1\n    ```\n  * 删除设备的无感认证，需要指定设备id，使用`python3 main.py -p`查看。\n    ```bash\n    python3 main.py -d 166541052xxxxx\n    ```\n* 也可以使用`-h`参数查看更多功能\n  ```bash\n  python3 main.py -h\n  ```\n\n## 模块介绍\n欢迎用于其他登录场景，使用请注明出处。\n\u003c/br\u003e\n* `config.py`：配置文件，包含超时、url等\n* `logout.py`：登出函数\n* `printInfo.py`：打印信息：余额、在线设备、无感认证设备\n* `quickLogin.py`：管理无感认证设备\n* `isLogin.py`：通过与testURL连接判断是否处于登录状态\n\n* `withnet`：设置需要修改的项之后，将此bash脚本放入环境变量的路径中即可实现临时登录并执行命令，执行完成后自动退出\n  ```bash\n  withnet ping www.baidu.com -c 5\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo1e%2Fp-dot-nju-login","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdo1e%2Fp-dot-nju-login","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo1e%2Fp-dot-nju-login/lists"}