# bitsrun
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Pre-commit](https://github.com/BITNP/bitsrun/actions/workflows/ci.yml/badge.svg)](https://github.com/BITNP/bitsrun/actions/workflows/ci.yml)
[![PyPI Publish](https://github.com/BITNP/bitsrun/actions/workflows/python-publish.yml/badge.svg)](https://github.com/BITNP/bitsrun/actions/workflows/python-publish.yml)
[![PyPI](https://img.shields.io/pypi/v/bitsrun)](https://pypi.org/project/bitsrun/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bitsrun)](https://pypi.org/project/bitsrun/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/bitsrun?color=orange)](https://pypi.org/project/bitsrun/)
A headless login / logout script for 10.0.0.55 at BIT.
| :sparkles: | Blazingly™ Fast Rust re-implementation of `bitsrun` available at [spencerwooo/bitsrun](https://github.com/spencerwooo/bitsrun-rs), if you require or prefer a single compiled executable (or 🦀 Rust). |
| - |:-|
## Install
You need at least **Python 3.8**. We recommend installing with `pipx`.
```shell
python3 -m pip install --user pipx
python3 -m pipx ensurepath
```
After which, install `bitsrun` with `pipx`.
```shell
pipx install bitsrun
```
Alternatively, you can download a self-contained executable from [GitHub Releases](https://github.com/BITNP/bitsrun/releases/latest) if you are working from an environment that does not have internet access.
## Usage
### CLI
Check login status of your device.
![bitsrun status](https://github.com/BITNP/bitsrun/assets/32114380/e877d6a9-120a-444a-b580-0a0fcac857ce)
```text
Usage: bitsrun status [OPTIONS]
Check current network login status.
Options:
--json / --no-json Output in JSON format.
--help Show this message and exit.
```
> **Note**: this is the output of `bitsrun status --help`.
Login or logout with your username and password.
![bitsrun login](https://github.com/BITNP/bitsrun/assets/32114380/4ca8cd64-580b-4ab8-824f-0049f41f78bb)
```text
Usage: bitsrun login/logout [OPTIONS]
Log into or out of the BIT network.
Options:
-u, --username TEXT Your username.
-p, --password TEXT Your password.
-v, --verbose Verbosely echo API response.
--help Show this message and exit.
```
> **Note**: this is the output of `bitsrun login/logout --help`.
### Credentials config
Create new file named `bit-user.json`:
```json
{
"username": "xxxx",
"password": "xxxx"
}
```
This file should be put under the following directory:
- Windows: `%APPDATA%\bitsrun`
- macOS and Linux: `~/.config/bitsrun` (Following the XDG spec)
**On unix, set the file permission to `600`, i.e., only read/writeable by the owner:**
```shell
chmod 600 path/to/bit-user.json
```
Now you can simply call:
```shell
bitsrun login
bitsrun logout
```
Besides, a system-wide configuration file is supported, and the location also depends on your platform.
To list all possible paths for your system (including those only for backward compatibility), call:
```shell
bitsrun config-paths
```
### Raycast script (macOS)
![raycast screenshot](https://user-images.githubusercontent.com/32114380/213919582-eff6d58f-1bd2-47b2-a5da-46dc6e2eaffa.png)
Import the two Raycast scripts from [`./scripts`](./scripts/) and setup your config file in `~/.config/bit-user.json`. The script uses `/usr/bin/python3` by default, so you either need to install `bitsrun` with this Python interpreter or setup your own Python interpreter path in the script.
## Developing
Create virtual environment and install deps:
```shell
python -m venv venv
source venv/bin/activate
pip install -e .
```
Running CLI entry:
```shell
python src/bitsrun/cli.py
```
Build:
```shell
pip install setuptools build
python -m build
```
## Credits and related
- [Aloxaf/10_0_0_55_login](https://github.com/Aloxaf/10_0_0_55_login) - BIT 10.0.0.55 的登入与登出的 Python 实现 (This project's predecessor, archived)
- [spencerwooo/bitsrun-rs](https://github.com/spencerwooo/bitsrun-rs) - A Rust implementation of `bitsrun`. (Rust)
- [zu1k/srun](https://github.com/zu1k/srun) - Srun authentication system login tools. (Rust)
- [Mmx233/BitSrunLoginGo](https://github.com/Mmx233/BitSrunLoginGo) - 深澜校园网登录脚本 Go 语言版 (Go)
- [vouv/srun](https://github.com/vouv/srun) - An efficient client for BIT campus network. (Go)
## License
[WTFPL License](LICENSE)
Raw data
{
"_id": null,
"home_page": null,
"name": "bitsrun",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "bit, srun, srun-login, srun-client, beijing-institute-of-technology",
"author": null,
"author_email": "spencerwooo <spencer.woo@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/e4/4a/830a3e27caf33b8b07041588e79eafb15373584c755a7c50baa3e233568c/bitsrun-3.7.1.tar.gz",
"platform": null,
"description": "# bitsrun\n\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Pre-commit](https://github.com/BITNP/bitsrun/actions/workflows/ci.yml/badge.svg)](https://github.com/BITNP/bitsrun/actions/workflows/ci.yml)\n[![PyPI Publish](https://github.com/BITNP/bitsrun/actions/workflows/python-publish.yml/badge.svg)](https://github.com/BITNP/bitsrun/actions/workflows/python-publish.yml)\n[![PyPI](https://img.shields.io/pypi/v/bitsrun)](https://pypi.org/project/bitsrun/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bitsrun)](https://pypi.org/project/bitsrun/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/bitsrun?color=orange)](https://pypi.org/project/bitsrun/)\n\nA headless login / logout script for 10.0.0.55 at BIT.\n\n| :sparkles: | Blazingly\u2122 Fast Rust re-implementation of `bitsrun` available at [spencerwooo/bitsrun](https://github.com/spencerwooo/bitsrun-rs), if you require or prefer a single compiled executable (or \ud83e\udd80 Rust). |\n| - |:-|\n\n## Install\n\nYou need at least **Python 3.8**. We recommend installing with `pipx`.\n\n```shell\npython3 -m pip install --user pipx\npython3 -m pipx ensurepath\n```\n\nAfter which, install `bitsrun` with `pipx`.\n\n```shell\npipx install bitsrun\n```\n\nAlternatively, you can download a self-contained executable from [GitHub Releases](https://github.com/BITNP/bitsrun/releases/latest) if you are working from an environment that does not have internet access.\n\n## Usage\n\n### CLI\n\nCheck login status of your device.\n\n![bitsrun status](https://github.com/BITNP/bitsrun/assets/32114380/e877d6a9-120a-444a-b580-0a0fcac857ce)\n\n```text\nUsage: bitsrun status [OPTIONS]\n\n Check current network login status.\n\nOptions:\n --json / --no-json Output in JSON format.\n --help Show this message and exit.\n```\n\n> **Note**: this is the output of `bitsrun status --help`.\n\nLogin or logout with your username and password.\n\n![bitsrun login](https://github.com/BITNP/bitsrun/assets/32114380/4ca8cd64-580b-4ab8-824f-0049f41f78bb)\n\n```text\nUsage: bitsrun login/logout [OPTIONS]\n\n Log into or out of the BIT network.\n\nOptions:\n -u, --username TEXT Your username.\n -p, --password TEXT Your password.\n -v, --verbose Verbosely echo API response.\n --help Show this message and exit.\n```\n\n> **Note**: this is the output of `bitsrun login/logout --help`.\n\n### Credentials config\n\nCreate new file named `bit-user.json`:\n\n```json\n{\n \"username\": \"xxxx\",\n \"password\": \"xxxx\"\n}\n```\n\nThis file should be put under the following directory:\n\n- Windows: `%APPDATA%\\bitsrun`\n- macOS and Linux: `~/.config/bitsrun` (Following the XDG spec)\n\n**On unix, set the file permission to `600`, i.e., only read/writeable by the owner:**\n\n```shell\nchmod 600 path/to/bit-user.json\n```\n\nNow you can simply call:\n\n```shell\nbitsrun login\nbitsrun logout\n```\n\nBesides, a system-wide configuration file is supported, and the location also depends on your platform.\n\nTo list all possible paths for your system (including those only for backward compatibility), call:\n\n```shell\nbitsrun config-paths\n```\n\n### Raycast script (macOS)\n\n![raycast screenshot](https://user-images.githubusercontent.com/32114380/213919582-eff6d58f-1bd2-47b2-a5da-46dc6e2eaffa.png)\n\nImport the two Raycast scripts from [`./scripts`](./scripts/) and setup your config file in `~/.config/bit-user.json`. The script uses `/usr/bin/python3` by default, so you either need to install `bitsrun` with this Python interpreter or setup your own Python interpreter path in the script.\n\n## Developing\n\nCreate virtual environment and install deps:\n\n```shell\npython -m venv venv\nsource venv/bin/activate\npip install -e .\n```\n\nRunning CLI entry:\n\n```shell\npython src/bitsrun/cli.py\n```\n\nBuild:\n\n```shell\npip install setuptools build\npython -m build\n```\n\n## Credits and related\n\n- [Aloxaf/10_0_0_55_login](https://github.com/Aloxaf/10_0_0_55_login) - BIT 10.0.0.55 \u7684\u767b\u5165\u4e0e\u767b\u51fa\u7684 Python \u5b9e\u73b0 (This project's predecessor, archived)\n- [spencerwooo/bitsrun-rs](https://github.com/spencerwooo/bitsrun-rs) - A Rust implementation of `bitsrun`. (Rust)\n- [zu1k/srun](https://github.com/zu1k/srun) - Srun authentication system login tools. (Rust)\n- [Mmx233/BitSrunLoginGo](https://github.com/Mmx233/BitSrunLoginGo) - \u6df1\u6f9c\u6821\u56ed\u7f51\u767b\u5f55\u811a\u672c Go \u8bed\u8a00\u7248 (Go)\n- [vouv/srun](https://github.com/vouv/srun) - An efficient client for BIT campus network. (Go)\n\n## License\n\n[WTFPL License](LICENSE)\n",
"bugtrack_url": null,
"license": "WTFPL",
"summary": "A headless login / logout script for 10.0.0.55",
"version": "3.7.1",
"project_urls": {
"homepage": "https://github.com/BITNP/bitsrun"
},
"split_keywords": [
"bit",
" srun",
" srun-login",
" srun-client",
" beijing-institute-of-technology"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a47c32401a85bb51cc0f1fe52b4fb50ca93e8cf8244acb5da0e8a473da53438f",
"md5": "8f94b6bd28400d9fa9a80b89278ac58d",
"sha256": "19d3ee5d86bd429e6bcfa307939b6d7effc3f87e6234f009271f7e2e0c545bf9"
},
"downloads": -1,
"filename": "bitsrun-3.7.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8f94b6bd28400d9fa9a80b89278ac58d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11332,
"upload_time": "2024-04-07T06:40:18",
"upload_time_iso_8601": "2024-04-07T06:40:18.260762Z",
"url": "https://files.pythonhosted.org/packages/a4/7c/32401a85bb51cc0f1fe52b4fb50ca93e8cf8244acb5da0e8a473da53438f/bitsrun-3.7.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e44a830a3e27caf33b8b07041588e79eafb15373584c755a7c50baa3e233568c",
"md5": "8cfed3a203748cb2d71fec17769e1059",
"sha256": "1d824f9c7bf8ab4b040a21e21873e09b72d19e4994960099e0a2eafc6c8bbbf0"
},
"downloads": -1,
"filename": "bitsrun-3.7.1.tar.gz",
"has_sig": false,
"md5_digest": "8cfed3a203748cb2d71fec17769e1059",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12165,
"upload_time": "2024-04-07T06:40:20",
"upload_time_iso_8601": "2024-04-07T06:40:20.040172Z",
"url": "https://files.pythonhosted.org/packages/e4/4a/830a3e27caf33b8b07041588e79eafb15373584c755a7c50baa3e233568c/bitsrun-3.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-07 06:40:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "BITNP",
"github_project": "bitsrun",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "bitsrun"
}