{"id":19675298,"url":"https://github.com/snowflyt/suda-gateway-login","last_synced_at":"2025-08-18T11:09:53.714Z","repository":{"id":249223175,"uuid":"830810856","full_name":"Snowflyt/suda-gateway-login","owner":"Snowflyt","description":"一个简单的 Bash/PowerShell 脚本，用于通过命令行直接登录苏州大学网关（校园网），适用于 Windows、macOS 与 Linux。","archived":false,"fork":false,"pushed_at":"2024-11-27T04:10:31.000Z","size":7,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-30T22:40:01.279Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Snowflyt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-07-19T03:49:13.000Z","updated_at":"2025-03-14T01:35:30.000Z","dependencies_parsed_at":"2024-11-11T17:25:06.060Z","dependency_job_id":"dd8d0c33-c3f9-4f9f-958b-3a9d2e3cd38f","html_url":"https://github.com/Snowflyt/suda-gateway-login","commit_stats":null,"previous_names":["snowflyt/suda-gateway-login"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Snowflyt/suda-gateway-login","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflyt%2Fsuda-gateway-login","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflyt%2Fsuda-gateway-login/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflyt%2Fsuda-gateway-login/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflyt%2Fsuda-gateway-login/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Snowflyt","download_url":"https://codeload.github.com/Snowflyt/suda-gateway-login/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflyt%2Fsuda-gateway-login/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270982194,"owners_count":24679447,"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-08-18T02:00:08.743Z","response_time":89,"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-11-11T17:23:01.614Z","updated_at":"2025-08-18T11:09:53.686Z","avatar_url":"https://github.com/Snowflyt.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# suda-gateway-login\n\n一个简单的 Bash/PowerShell 脚本，用于通过命令行直接登录苏州大学网关（校园网），适用于 Windows、macOS 与 Linux。\n\n## 使用说明\n\n### 对于 macOS/Linux 用户\n\n仓库提供了 [login.sh](./login.sh) 用于登录苏州大学网关，它的使用方法如下：\n\n```bash\nbash login.sh \u003cusername\u003e \u003cpassword\u003e [\u003cip\u003e]\n```\n\n其中 `\u003cip\u003e` 是可选参数，可用于指定用于登录网关的 IPv4 地址（假如你电脑上接了多根网线的话，比如一台 Linux 服务器）。如不指定 `\u003cip\u003e`，则默认使用 `hostname -I` (Linux) 或 `ipconfig` (macOS) 命令获取的第一个 IPv4 地址。\n\n使用示例如下：\n\n```bash\nbash login.sh 2030123456 123456\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e 如果你使用中国移动/中国联通/中国电信提供的校园网服务，也可使用本脚本登陆，只需在用户名后加上相应的后缀即可——中国移动使用的后缀为 `@zgyd`；中国联通使用 `@cucc`；中国电信使用 `@ctc`. 例如，一个中国移动校园网用户的用户名可能是 `20241234567@zgyd`。\n\n仓库也提供了 [login_all.sh](./login_all.sh)，它会提取 `hostname -I` (Linux) 或 `ipconfig` (macOS) 命令获取的所有 IPv4 地址，然后依次尝试登录网关。使用方法如下：\n\n```bash\nbash login_all.sh \u003cusername\u003e \u003cpassword\u003e\n```\n\n为了方便使用，你可以下载 [login.sh](./login.sh) 或 [login_all.sh](./login_all.sh) 到你的电脑上，并复制到 `/usr/local/bin` 或 `/usr/bin` 目录下，然后给予执行权限：\n\n```bash\nsudo curl -o /usr/local/bin/login_suda_gateway https://raw.githubusercontent.com/Snowflyt/suda-gateway-login/main/login_all.sh\nsudo chmod +x /usr/local/bin/login_suda_gateway\n```\n\n然后你就可以直接在命令行中使用 `login_suda_gateway` 命令了：\n\n```bash\nlogin_suda_gateway \u003cusername\u003e \u003cpassword\u003e\n```\n\n### 对于 Windows 用户\n\n\u003e 感谢 [@acceleractor](https://github.com/acceleractor) 贡献的 Windows 版本 PowerShell 脚本。\n\n仓库提供了 [login.ps1](./login.ps1) 用于登录苏州大学网关，它的使用方法如下：\n\n```powershell\npowershell -ExecutionPolicy Bypass -File \"./login.ps1\" \u003cusername\u003e \u003cpassword\u003e\n```\n\n可以将该命令写进 bat 用 Cmd 执行，或者直接使用 PowerShell 执行 ps1 脚本。\n\nWindows 版本提取 IP 是通过所有启用的网络适配器并匹配“无线局域网适配器“字段搜索无线网卡的 IP，如果是笔记本用户并且只有一个网卡应该能正确读取到 IP，如果是使用网线的用户可以更改 `wlanAdapter` 变量中的 `$_.Name -like` 为其他适配器的字段。\n\n## 这有啥用？\n\n如果你使用一个带图形界面的操作系统，登录校园网不是什么难事——你可以直接打开浏览器，输入用户名和密码登录。但是如果你使用的是一个只有命令行界面的操作系统（比如你们实验室的 Linux 服务器），那么登录校园网就不那么方便了，这就是这个脚本的存在意义。\n\n另外你苏带的校园网经常踢人，尤其是计时收费组，你也可以把这个脚本写到一个定时任务里（比如 Cron），让它每隔一段时间自动登录一次，避免被踢，省去时不时重新登录校园网的麻烦。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowflyt%2Fsuda-gateway-login","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowflyt%2Fsuda-gateway-login","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowflyt%2Fsuda-gateway-login/lists"}