Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wibus-wee/huaweiroutereverseapi
Reverse API of Huawei router management panel
https://github.com/wibus-wee/huaweiroutereverseapi
Last synced: about 1 month ago
JSON representation
Reverse API of Huawei router management panel
- Host: GitHub
- URL: https://github.com/wibus-wee/huaweiroutereverseapi
- Owner: wibus-wee
- License: mit
- Created: 2024-01-28T06:45:29.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-29T23:28:18.000Z (11 months ago)
- Last Synced: 2024-10-24T03:52:26.597Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 164 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HuaweiRouteReverseAPI
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![bundle][bundle-src]][bundle-href]
[![JSDocs][jsdocs-src]][jsdocs-href]
[![License][license-src]][license-href]Reverse API of Huawei router management panel
๐งช Working in Progress## Technical Details
### Login
Before logging in, the client initiates a request to `/api/system/user_login_nonce`. The request body includes the `csrf`. If `csrf` is not included or is incorrect, the response will contain `Menu.csrf_err`. In this case, the client needs to obtain the `csrf_token` and `csrf_param` from the response body and make the request again.
Subsequently, the client makes a request to `/api/system/user_login_proof`. In this request, the response will include a `Set-Cookie` header containing a `SessionID_R3`. This `SessionID_R3` must be included in the headers of subsequent requests; otherwise, no content will be returned.
> [!WARNING]
> It has been observed that these requests always include `csrf_token` and `csrf_param`. In the event of encountering `Menu.csrf_err`, proceed by obtaining the `csrf_token` and `csrf_param` from the response body and making the request again.
>
> Additionally, after each request, it is necessary to save the latest `csrf_token` and `csrf_param`.The following example is valid (assuming `SessionID_R3` is valid):
```shell
curl 'http://192.168.3.1/api/system/heartbeat' --cookie 'SessionID_R3=xxxxxx'
# Response: {"interval":"5000"}
```The following is invalid:
```shell
curl 'http://192.168.3.1/api/system/heartbeat'
# No Response
```### Terrible `ErrReason`
Just by looking at `ErrReason`, would you think it represents the "error reason"? No, this is Huawei's "error," and it's a very misleading one. Under normal circumstances, **it returns "Success"**, which is highly counterintuitive.
```json
{
// ...
"ErrReason": "Success"
// ...
}
```The interfaces affected by this "error" include:
- `ntwk/WanDetect.ts`
- `ntwk/WANDiagnose.ts`## References
- [mx-space/api-client](https://github.com/mx-space/api-client)
## License
[MIT](./LICENSE) License ยฉ 2023-PRESENT [wibus-wee](https://github.com/wibus-wee)
[npm-version-src]: https://img.shields.io/npm/v/huawei-route-reverse-api?style=flat&colorA=080f12&colorB=1fa669
[npm-version-href]: https://npmjs.com/package/huawei-route-reverse-api
[npm-downloads-src]: https://img.shields.io/npm/dm/huawei-route-reverse-api?style=flat&colorA=080f12&colorB=1fa669
[npm-downloads-href]: https://npmjs.com/package/huawei-route-reverse-api
[bundle-src]: https://img.shields.io/bundlephobia/minzip/huawei-route-reverse-api?style=flat&colorA=080f12&colorB=1fa669&label=minzip
[bundle-href]: https://bundlephobia.com/result?p=huawei-route-reverse-api
[license-src]: https://img.shields.io/github/license/wibus-wee/HuaweiRouteReverseAPI.svg?style=flat&colorA=080f12&colorB=1fa669
[license-href]: https://github.com/wibus-wee/HuaweiRouteReverseAPI/blob/main/LICENSE
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
[jsdocs-href]: https://www.jsdocs.io/package/huawei-route-reverse-api