{"id":17684946,"url":"https://github.com/spencerwooo/bitsrun-rs","last_synced_at":"2025-05-07T02:27:10.567Z","repository":{"id":208034651,"uuid":"719942712","full_name":"spencerwooo/bitsrun-rs","owner":"spencerwooo","description":"🌐 A headless login / logout CLI for 10.0.0.55 at BIT, now in Rust. 北京理工大学 10.0.0.55 校园网登录登出的 Rust 实现","archived":false,"fork":false,"pushed_at":"2024-04-26T08:55:32.000Z","size":147,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-27T09:04:49.569Z","etag":null,"topics":["beijing-institute-of-technology","bit","srun","srun-client","srun-login"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/bitsrun","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spencerwooo.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},"funding":{"custom":["https://afdian.net/a/spencerwoo","https://spencerwoo.com/sponsor"]}},"created_at":"2023-11-17T08:31:32.000Z","updated_at":"2024-04-27T09:04:49.569Z","dependencies_parsed_at":"2024-10-24T13:02:18.123Z","dependency_job_id":"645b5fbb-66d5-437e-9108-93222e3265c8","html_url":"https://github.com/spencerwooo/bitsrun-rs","commit_stats":{"total_commits":59,"total_committers":1,"mean_commits":59.0,"dds":0.0,"last_synced_commit":"2d5ee29f155efeef986aa31ed5e03439f6071899"},"previous_names":["spencerwooo/bitsrun-rs"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencerwooo%2Fbitsrun-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencerwooo%2Fbitsrun-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencerwooo%2Fbitsrun-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencerwooo%2Fbitsrun-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spencerwooo","download_url":"https://codeload.github.com/spencerwooo/bitsrun-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246419600,"owners_count":20774111,"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":["beijing-institute-of-technology","bit","srun","srun-client","srun-login"],"created_at":"2024-10-24T10:25:54.559Z","updated_at":"2025-03-31T23:30:55.842Z","avatar_url":"https://github.com/spencerwooo.png","language":"Rust","funding_links":["https://afdian.net/a/spencerwoo","https://spencerwoo.com/sponsor"],"categories":[],"sub_categories":[],"readme":"# bitsrun\n\n[![GitHub Workflow Status (CI)](https://img.shields.io/github/actions/workflow/status/spencerwooo/bitsrun-rs/ci.yml?logo=github\u0026label=ci\u0026labelColor=%23223227)](https://github.com/spencerwooo/bitsrun-rs/actions/workflows/ci.yml)\n[![GitHub Workflow Status (Release)](https://img.shields.io/github/actions/workflow/status/spencerwooo/bitsrun-rs/release.yml?logo=github\u0026label=release\u0026labelColor=%23223227)](https://github.com/spencerwooo/bitsrun-rs/actions/workflows/release.yml)\n[![GitHub release](https://img.shields.io/github/v/release/spencerwooo/bitsrun-rs?logo=github\u0026labelColor=%23223227)](https://github.com/spencerwooo/bitsrun-rs/releases/latest)\n[![Crates.io](https://img.shields.io/crates/d/bitsrun?logo=rust\u0026labelColor=%23223227\u0026color=%23dec867)](https://crates.io/crates/bitsrun)\n\n🌐 A headless login and logout CLI for gateway (10.0.0.55) at BIT, now in Rust.\n\n![CleanShot 2023-12-04 at 16 47 26@2x](https://github.com/spencerwooo/bitsrun-rs/assets/32114380/23343ba1-961c-41aa-b4b6-c09da93fb699)\n\n## Install\n\n#### One-line install (Linux / macOS, recommended)\n\n- `curl -fsSL https://cdn.jsdelivr.net/gh/spencerwooo/bitsrun-rs@main/install.sh | sh -`\n\n#### Ubuntu / Debian (recommended for `systemd` support)\n\n- Download the latest `.deb` package from [Releases](https://github.com/spencerwooo/bitsrun-rs/releases/latest).\n- `sudo apt install \u003c/path/to/file\u003e.deb`\n\n**If `bitsrun.service` systemd service required:**\n\n- Edit `/lib/systemd/system/bitsrun.service` to specify absolute config path\n- Then start service with `sudo systemctl start bitsrun`\n\n#### Cargo\n\n- `cargo install bitsrun`\n\n#### Download binary\n\n- Download the latest binary from [Releases](https://github.com/spencerwooo/bitsrun-rs/releases/latest).\n- Uncompress file: `tar -xvf \u003cfile\u003e.tar.gz`\n- Move binary to `$PATH`, such as: `mv \u003cfile\u003e/bitsrun ~/.local/bin/`\n\n## Usage\n\nTo log into or out of the campus network, simply:\n\n```console\n$ bitsrun login -u \u003cusername\u003e -p \u003cpassword\u003e\nbitsrun: \u003cip\u003e (\u003cusername\u003e) logged in\n\n$ bitsrun logout -u \u003cusername\u003e\nbitsrun: \u003cip\u003e logged out\n```\n\nTo check device login status:\n\n```console\n$ bitsrun status\nbitsrun: \u003cip\u003e (\u003cusername\u003e) is online\n┌────────────────┬───────────────┬───────────────┬─────────┐\n│ Traffic Used   │ Online Time   │ User Balance  │ Wallet  │\n├────────────────┼───────────────┼───────────────┼─────────┤\n│ 188.10 GiB     │ 2 months      │ 10.00         │ 0.00    │\n└────────────────┴───────────────┴───────────────┴─────────┘\n```\n\nTo keep the session alive, use `bitsrun keep-alive`:\n\n```console\n$ bitsrun keep-alive\n INFO  bitsrun::daemon \u003e starting daemon (\u003cusername\u003e) with polling interval=3600s\n INFO  bitsrun::daemon \u003e \u003cip\u003e (\u003cusername\u003e): login success,\n ...\n ^C INFO  bitsrun::daemon \u003e \u003cusername\u003e: gracefully exiting\n```\n\n\u003e [!NOTE]\n\u003e Use available system service managers to run `bitsrun keep-alive` as a daemon. (e.g., `systemd` for Linux, `launchd` for macOS, and Windows Service for Windows).\n\n## Available commands\n\n```console\n$ bitsrun --help\nA headless login and logout CLI for 10.0.0.55 at BIT\n\nUsage: bitsrun [OPTIONS] [COMMAND]\n\nCommands:\n  login         Login to the campus network\n  logout        Logout from the campus network\n  status        Check device login status\n  config-paths  List all possible config file paths\n  keep-alive    Poll the server with login requests to keep the session alive\n  help          Print this message or the help of the given subcommand(s)\n\nOptions:\n  -v, --verbose  Verbose output\n  -h, --help     Print help\n  -V, --version  Print version\n```\n\n\u003e [!TIP]\n\u003e Use environment variable `NO_COLOR=true` to disable colored output.\n\n## Config and credentials\n\nTo save your credentials and configurations, create config file `bit-user.json` under an available config path as:\n\n```json\n{\n  \"username\": \"\u003cusername\u003e\",\n  \"password\": \"\u003cpassword\u003e\",\n  \"dm\": true,\n  \"poll_interval\": 3600\n}\n```\n\n- **`dm` is for specifying whether the current device is a dumb terminal, and requires logging out through the alternative endpoint. Set to `true` (no quotes!) if the device you are working with is a dumb terminal.**\n- `poll_interval` is an optional field for specifying the interval (in seconds) of polling login requests. Default is `3600` seconds (1 hour). Used by `bitsrun keep-alive` only.\n\nAvailable config file paths can be listed with:\n\n```console\n$ bitsrun config-paths\nbitsrun: list of possible config paths\n┌──────────┬─────────────────────────────────────────────────────────────┐\n│ Priority │ Possible Config Path                                        │\n├──────────┼─────────────────────────────────────────────────────────────┤\n│ 1        │ /Users/spencerwoo/.config/bit-user.json                     │\n│ 2        │ /Users/spencerwoo/.config/bitsrun/bit-user.json             │\n│ 3        │ /Users/spencerwoo/Library/Preferences/bitsrun/bit-user.json │\n│ 4        │ bit-user.json                                               │\n└──────────┴─────────────────────────────────────────────────────────────┘\n```\n\n\u003e [!NOTE]\n\u003e The config file location is OS-dependent. Run the command to check the accepted locations on your system.\n\n**Set permissions of this file to `600` on Linux and macOS, or `bitsrun` will refuse to read it.**\n\n```console\n$ chmod 600 \u003cpath/to/bit-user.json\u003e\n```\n\n## Related\n\n- [`zu1k/srun`](https://github.com/zu1k/srun) - Srun authentication system login tools. (Rust)\n- [`Mmx233/BitSrunLoginGo`](https://github.com/Mmx233/BitSrunLoginGo) - 深澜校园网登录脚本 Go 语言版 (Go)\n- [`vouv/srun`](https://github.com/vouv/srun) - An efficient client for BIT campus network. (Go)\n- [`BITNP/bitsrun`](https://github.com/BITNP/bitsrun) - A headless login / logout script for 10.0.0.55 at BIT. (Python)\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspencerwooo%2Fbitsrun-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspencerwooo%2Fbitsrun-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspencerwooo%2Fbitsrun-rs/lists"}