starlink-client


Namestarlink-client JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/Eitol/starlink-client
SummaryA Python client for Starlink.
upload_time2025-01-31 02:14:41
maintainerNone
docs_urlNone
authorHector Oliveros
requires_python>=3.9
licenseMIT
keywords starlink client grpc satellite internet antenna
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Starlink Client Library Documentation

## Description

This library allows you to connect to the Starlink system in two ways:
- **Directly to Starlink on the local network**: This option is available if Starlink is accessible within the local network. No authentication is required to perform operations in this case.
- **Remotely via the Starlink API**: This requires authentication, and communication is done through gRPC-Web and REST.

Note: The starlink dish run a gRPC server on port 9200, but it is not exposed to the internet.
![arch.png](https://raw.githubusercontent.com/Eitol/starlink-client/refs/heads/main/docs/imgs/arch.png)


The .proto files were obtained from the antenna itself, using grpc-curl.

If you have an antenna and want to update the protos you can run
```bash
make extract_protos
```

To compile the prototypes to specific languages, connect was used

```bash
make generate
```

See: https://connectrpc.com/

## Installation

To install the library, you can use pip:

```bash
pip install starlink-client
```


## Supported Operations

- **Get Account Data**: Retrieve account information such as email, customer name, etc.
- **Get Device Location**: Obtain the location of the device. For precise real-time location, you need to be on the local network. Otherwise, you can get the H3 cell where the antenna is connected.
- **Get Network Stats**: Retrieve network statistics such as latency and current download speed.
- **Reboot the Dish**: Remotely reboot the Starlink dish.
- **Telemetry**: Retrieve telemetry data from the dish and router, including errors, warnings, etc.
- **Set Dish Config**: Set the dish configuration, such as snow melt mode, power saving mode, etc.
- **Get WiFi Status**: Get information about connected clients, SSID, etc.
- **Change WiFi Configuration**: Modify the SSID name, hide SSID, change passwords, enable bypass mode, etc.

You can use the predefined methods provided by the library for these operations or make direct calls using the `call` method with the Request and Response messages defined in the "proto" directory.

## Authentication

To extract the cookie from the browser, you need to log in from any browser and manually copy the cookie.

The cookie lasts for 15 days, but the library supports cookie refresh, which allows for longer use if the cookie is refreshed regularly. Simply use the library within 15 days, and it will save the refreshed cookie in a directory.

Note that some calls can be made via Stream instead of gRPC unary calls.

You can create the cookie json using this chrome extension:

https://chromewebstore.google.com/detail/copythiscookiebytaskmagic/mjdcjjjpadgkmpajafmpnponggdohdhl

You need to go to the Starlink web interface, log in, and then copy the cookies using the extension and save them to a file

#### Example 1: List devices
```python
from cookies_parser import parse_cookie_json
from spacex.api.device.wifi_config_pb2 import WifiConfig
from starlink_client.grpc_web_client import GrpcWebClient

if __name__ == "__main__":
    #  You can create the cookie json using this chrome extension:
    # https://chromewebstore.google.com/detail/copythiscookiebytaskmagic/mjdcjjjpadgkmpajafmpnponggdohdhl
    # You need to go to the Starlink web interface, log in,
    #  and then copy the cookies using the extension and save them to a file
    with open("cookies.json", "r") as f:
        cookie_json = f.read()
        initial_cookies = parse_cookie_json(cookie_json)

    client = GrpcWebClient(initial_cookies, "dir_cookies")

    status = client.get_wifi_status("Router-010000000000000000425511")
    print("-------------------------")
    print("ID: " + status.device_info.id)
    print("Software Version: " + status.device_info.software_version)
    print("Networks: ")
    for n in status.config.networks:
        for bss in n.basic_service_sets:
            if bss.band == WifiConfig.RF_2GHZ:
                print(f"\t2.4ghz: {bss.ssid}")
            elif bss.band in [WifiConfig.RF_5GHZ, WifiConfig.RF_5GHZ_HIGH]:
                print(f"\t5ghz:   {bss.ssid}")
    print("Clients:")
    for client in status.clients:
        if client.ip_address == "":
            continue
        print(f"\t{client.name} | {client.ip_address}")
```

Output: 
```text
ID: Router-010000000000000000499851
Software Version: 2024.05.31.mr36376
Networks: 
	2.4ghz: AURORITA 2021
	5ghz:   AURORITA 2021
Clients:
	mk tickets | 192.168.1.21
	infinix-hot-30i | 192.168.1.22
	galaxy-s24-ultra | 192.168.1.23
	 | 192.168.1.24
```


#### Example 2: Call directly to gRPC service

```python
from cookies_parser import parse_cookie_json
from spacex.api.device.device_pb2 import Request, GetStatusRequest
from starlink_client.grpc_web_client import GrpcWebClient

if __name__ == "__main__":
    #  You can create the cookie json using this chrome extension:
    # https://chromewebstore.google.com/detail/copythiscookiebytaskmagic/mjdcjjjpadgkmpajafmpnponggdohdhl
    with open("cookies.json", "r") as f:
        cookie_json = f.read()
        initial_cookies = parse_cookie_json(cookie_json)
    router_id = "Router-010000000000000000411510"
    client = GrpcWebClient(initial_cookies, "dir_cookies")
    grpc_req = Request(target_id=router_id, get_status=GetStatusRequest())
    resp = client.call(grpc_req)
    print(resp.wifi_get_status)
```

## Supported Client Libraries

The following languages are supported for client libraries:

- [x] [GO](https://github.com/Eitol/starlink-client/tree/main/libs/golang/client)
- [x] [Python](https://github.com/Eitol/starlink-client/tree/main/libs/python/starlink-client)
- [x] [Dart - Flutter](https://github.com/Eitol/starlink-client/tree/main/libs/dart)
- [ ] Javascript
- [ ] Java
- [ ] Kotlin
- [ ] Swift

### Legal

This project is not affiliated with SpaceX or Starlink. It is an independent project created by a fan of the service.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Eitol/starlink-client",
    "name": "starlink-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "starlink client grpc satellite internet antenna",
    "author": "Hector Oliveros",
    "author_email": "hector.oliveros.leon@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1c/f5/ba2bd6ac39f7a2a2a5258be82d8dcc227c6ad4f6caccd8709ba83f197d99/starlink_client-0.1.5.tar.gz",
    "platform": null,
    "description": "# Starlink Client Library Documentation\n\n## Description\n\nThis library allows you to connect to the Starlink system in two ways:\n- **Directly to Starlink on the local network**: This option is available if Starlink is accessible within the local network. No authentication is required to perform operations in this case.\n- **Remotely via the Starlink API**: This requires authentication, and communication is done through gRPC-Web and REST.\n\nNote: The starlink dish run a gRPC server on port 9200, but it is not exposed to the internet.\n![arch.png](https://raw.githubusercontent.com/Eitol/starlink-client/refs/heads/main/docs/imgs/arch.png)\n\n\nThe .proto files were obtained from the antenna itself, using grpc-curl.\n\nIf you have an antenna and want to update the protos you can run\n```bash\nmake extract_protos\n```\n\nTo compile the prototypes to specific languages, connect was used\n\n```bash\nmake generate\n```\n\nSee: https://connectrpc.com/\n\n## Installation\n\nTo install the library, you can use pip:\n\n```bash\npip install starlink-client\n```\n\n\n## Supported Operations\n\n- **Get Account Data**: Retrieve account information such as email, customer name, etc.\n- **Get Device Location**: Obtain the location of the device. For precise real-time location, you need to be on the local network. Otherwise, you can get the H3 cell where the antenna is connected.\n- **Get Network Stats**: Retrieve network statistics such as latency and current download speed.\n- **Reboot the Dish**: Remotely reboot the Starlink dish.\n- **Telemetry**: Retrieve telemetry data from the dish and router, including errors, warnings, etc.\n- **Set Dish Config**: Set the dish configuration, such as snow melt mode, power saving mode, etc.\n- **Get WiFi Status**: Get information about connected clients, SSID, etc.\n- **Change WiFi Configuration**: Modify the SSID name, hide SSID, change passwords, enable bypass mode, etc.\n\nYou can use the predefined methods provided by the library for these operations or make direct calls using the `call` method with the Request and Response messages defined in the \"proto\" directory.\n\n## Authentication\n\nTo extract the cookie from the browser, you need to log in from any browser and manually copy the cookie.\n\nThe cookie lasts for 15 days, but the library supports cookie refresh, which allows for longer use if the cookie is refreshed regularly. Simply use the library within 15 days, and it will save the refreshed cookie in a directory.\n\nNote that some calls can be made via Stream instead of gRPC unary calls.\n\nYou can create the cookie json using this chrome extension:\n\nhttps://chromewebstore.google.com/detail/copythiscookiebytaskmagic/mjdcjjjpadgkmpajafmpnponggdohdhl\n\nYou need to go to the Starlink web interface, log in, and then copy the cookies using the extension and save them to a file\n\n#### Example 1: List devices\n```python\nfrom cookies_parser import parse_cookie_json\nfrom spacex.api.device.wifi_config_pb2 import WifiConfig\nfrom starlink_client.grpc_web_client import GrpcWebClient\n\nif __name__ == \"__main__\":\n    #  You can create the cookie json using this chrome extension:\n    # https://chromewebstore.google.com/detail/copythiscookiebytaskmagic/mjdcjjjpadgkmpajafmpnponggdohdhl\n    # You need to go to the Starlink web interface, log in,\n    #  and then copy the cookies using the extension and save them to a file\n    with open(\"cookies.json\", \"r\") as f:\n        cookie_json = f.read()\n        initial_cookies = parse_cookie_json(cookie_json)\n\n    client = GrpcWebClient(initial_cookies, \"dir_cookies\")\n\n    status = client.get_wifi_status(\"Router-010000000000000000425511\")\n    print(\"-------------------------\")\n    print(\"ID: \" + status.device_info.id)\n    print(\"Software Version: \" + status.device_info.software_version)\n    print(\"Networks: \")\n    for n in status.config.networks:\n        for bss in n.basic_service_sets:\n            if bss.band == WifiConfig.RF_2GHZ:\n                print(f\"\\t2.4ghz: {bss.ssid}\")\n            elif bss.band in [WifiConfig.RF_5GHZ, WifiConfig.RF_5GHZ_HIGH]:\n                print(f\"\\t5ghz:   {bss.ssid}\")\n    print(\"Clients:\")\n    for client in status.clients:\n        if client.ip_address == \"\":\n            continue\n        print(f\"\\t{client.name} | {client.ip_address}\")\n```\n\nOutput: \n```text\nID: Router-010000000000000000499851\nSoftware Version: 2024.05.31.mr36376\nNetworks: \n\t2.4ghz: AURORITA 2021\n\t5ghz:   AURORITA 2021\nClients:\n\tmk tickets | 192.168.1.21\n\tinfinix-hot-30i | 192.168.1.22\n\tgalaxy-s24-ultra | 192.168.1.23\n\t | 192.168.1.24\n```\n\n\n#### Example 2: Call directly to gRPC service\n\n```python\nfrom cookies_parser import parse_cookie_json\nfrom spacex.api.device.device_pb2 import Request, GetStatusRequest\nfrom starlink_client.grpc_web_client import GrpcWebClient\n\nif __name__ == \"__main__\":\n    #  You can create the cookie json using this chrome extension:\n    # https://chromewebstore.google.com/detail/copythiscookiebytaskmagic/mjdcjjjpadgkmpajafmpnponggdohdhl\n    with open(\"cookies.json\", \"r\") as f:\n        cookie_json = f.read()\n        initial_cookies = parse_cookie_json(cookie_json)\n    router_id = \"Router-010000000000000000411510\"\n    client = GrpcWebClient(initial_cookies, \"dir_cookies\")\n    grpc_req = Request(target_id=router_id, get_status=GetStatusRequest())\n    resp = client.call(grpc_req)\n    print(resp.wifi_get_status)\n```\n\n## Supported Client Libraries\n\nThe following languages are supported for client libraries:\n\n- [x] [GO](https://github.com/Eitol/starlink-client/tree/main/libs/golang/client)\n- [x] [Python](https://github.com/Eitol/starlink-client/tree/main/libs/python/starlink-client)\n- [x] [Dart - Flutter](https://github.com/Eitol/starlink-client/tree/main/libs/dart)\n- [ ] Javascript\n- [ ] Java\n- [ ] Kotlin\n- [ ] Swift\n\n### Legal\n\nThis project is not affiliated with SpaceX or Starlink. It is an independent project created by a fan of the service.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python client for Starlink.",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/Eitol/starlink-client"
    },
    "split_keywords": [
        "starlink",
        "client",
        "grpc",
        "satellite",
        "internet",
        "antenna"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "367e11331880ee591d15008d734b2db7b4025e97f6edf60c32718611eba0d89d",
                "md5": "5cb3bf0a53fd025e6939eb4f2f549b7f",
                "sha256": "bc0b502891e521d477ed07ca099b2e8a93e9b4e83c3f532857f9e325168b6427"
            },
            "downloads": -1,
            "filename": "starlink_client-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5cb3bf0a53fd025e6939eb4f2f549b7f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 13032,
            "upload_time": "2025-01-31T02:14:39",
            "upload_time_iso_8601": "2025-01-31T02:14:39.612612Z",
            "url": "https://files.pythonhosted.org/packages/36/7e/11331880ee591d15008d734b2db7b4025e97f6edf60c32718611eba0d89d/starlink_client-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1cf5ba2bd6ac39f7a2a2a5258be82d8dcc227c6ad4f6caccd8709ba83f197d99",
                "md5": "a51510fd336df0972e7b6b8ff9ffa28d",
                "sha256": "107eae2200fefbc7d87f89d5799e3759af0b36726be52da83f484406aef15f2f"
            },
            "downloads": -1,
            "filename": "starlink_client-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a51510fd336df0972e7b6b8ff9ffa28d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 11869,
            "upload_time": "2025-01-31T02:14:41",
            "upload_time_iso_8601": "2025-01-31T02:14:41.518631Z",
            "url": "https://files.pythonhosted.org/packages/1c/f5/ba2bd6ac39f7a2a2a5258be82d8dcc227c6ad4f6caccd8709ba83f197d99/starlink_client-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-31 02:14:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Eitol",
    "github_project": "starlink-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "starlink-client"
}
        
Elapsed time: 1.74834s