mirror of
https://github.com/vzakharchenko/huawei-hilink
synced 2024-11-15 18:13:30 +00:00
fixed
This commit is contained in:
parent
a40facd10d
commit
abd0ad0aea
62
README.md
62
README.md
@ -45,24 +45,6 @@ add argument **--password="YOUR_PASSWORD"** to command line.
|
||||
huawei-hilink sendSMS --phone=+11111111111 --message="Test message" --password="YOUR_PASSWORD"
|
||||
```
|
||||
|
||||
## supported encrypt/decrypt hilink api
|
||||
[Login API](https://github.com/vzakharchenko/huawei-hilink/blob/fa3d36e4df622999c674f39342bb196500208d8b/src/startSession.ts#L57):
|
||||
- http://${MODEM_API}/api/webserver/token
|
||||
- http://${MODEM_API}/api/user/challenge_login
|
||||
- http://${MODEM_API}/api/user/authentication_login
|
||||
Encrypted API:
|
||||
- http://${MODEM_API}/api/sms/sms-list-phone
|
||||
- http://${MODEM_API}/api/sms/sms-count-contact
|
||||
- http://${MODEM_API}/api/sms/sms-count-contact
|
||||
- http://${MODEM_API}/api/sms/delete-sms
|
||||
- http://${MODEM_API}/api/sms/send-sms
|
||||
- http://${MODEM_API}/api/sms/sms-list-contact
|
||||
- http://${MODEM_API}/api/dialup/mobile-dataswitch
|
||||
- http://${MODEM_API}/api/net/reconnect
|
||||
|
||||
example how to encrypt/decrypt API
|
||||
```
|
||||
```
|
||||
## How to use
|
||||
|
||||
### Help
|
||||
@ -463,3 +445,47 @@ Result:
|
||||
```json
|
||||
{"response":{"ConnectionStatus":"901","WifiConnectionStatus":{},"SignalStrength":{},"SignalIcon":"3","CurrentNetworkType":"19","CurrentServiceDomain":"3","RoamingStatus":"0","BatteryStatus":{},"BatteryLevel":{},"BatteryPercent":{},"simlockStatus":"0","PrimaryDns":"195.38.164.15","SecondaryDns":"195.38.164.16","wififrequence":"0","flymode":"0","PrimaryIPv6Dns":{},"SecondaryIPv6Dns":{},"CurrentWifiUser":{},"TotalWifiUser":{},"currenttotalwifiuser":"0","ServiceStatus":"2","SimStatus":"1","WifiStatus":{},"CurrentNetworkTypeEx":"101","maxsignal":"5","wifiindooronly":"0","classify":"hilink","usbup":"0","wifiswitchstatus":"0","WifiStatusExCustom":"0","hvdcp_online":"0","speedLimitStatus":"0","poorSignalStatus":"0"}}
|
||||
```
|
||||
|
||||
|
||||
## supported encrypt/decrypt hilink api
|
||||
[Login API](https://github.com/vzakharchenko/huawei-hilink/blob/fa3d36e4df622999c674f39342bb196500208d8b/src/startSession.ts#L57):
|
||||
- http://${MODEM_API}/api/webserver/token
|
||||
- http://${MODEM_API}/api/user/challenge_login
|
||||
- http://${MODEM_API}/api/user/authentication_login
|
||||
Encrypted/Decrypted API:
|
||||
- http://${MODEM_API}/api/sms/sms-list-phone
|
||||
- http://${MODEM_API}/api/sms/sms-list-contact
|
||||
Only Encrypted API:
|
||||
- http://${MODEM_API}/api/sms/sms-count-contact
|
||||
- http://${MODEM_API}/api/sms/delete-sms
|
||||
- http://${MODEM_API}/api/sms/send-sms
|
||||
- http://${MODEM_API}/api/dialup/mobile-dataswitch
|
||||
- http://${MODEM_API}/api/net/reconnect
|
||||
|
||||
example how to encrypt/decrypt API
|
||||
```
|
||||
const scram = huawei.CryptoJS.SCRAM();
|
||||
const smsNonce = scram.nonce().toString();
|
||||
const smsSalt = scram.nonce().toString();
|
||||
const nonceStr = smsNonce + smsSalt;
|
||||
const encrpt_nonce = await huawei.doRSAEncrypt(sessionData0, nonceStr);
|
||||
const data = await huawei.doRSAEncrypt(sessionData, `<?xml version="1.0" encoding="UTF-8"?><request><phone>${phone}</phone><pageindex>${pageindex}</pageindex><readcount>20</readcount><nonce>${encrpt_nonce}</nonce></request>`);
|
||||
const resp = await restCalls.sendDataRaw(`http://${sessionData0.url}/api/sms/sms-list-phone`, 'POST', data, await getSessionHeaders(sessionData.url));
|
||||
huawei.publicSession.token2 = resp.headers.__requestverificationtoken;
|
||||
const pwdret = await parser.parseStringPromise((resp.data));
|
||||
const decodedResponseText = huawei.dataDecrypt(scram, smsNonce, smsSalt, nonceStr, pwdret);
|
||||
```
|
||||
|
||||
example only encrypt API
|
||||
```
|
||||
const scram = huawei.CryptoJS.SCRAM();
|
||||
const smsNonce = scram.nonce().toString();
|
||||
const smsSalt = scram.nonce().toString();
|
||||
const nonceStr = smsNonce + smsSalt;
|
||||
const encrpt_nonce = await huawei.doRSAEncrypt(sessionData, nonceStr);
|
||||
const data = await huawei.doRSAEncrypt(sessionData, `<?xml version="1.0" encoding="UTF-8"?><request><Index>-1</Index><Phones><Phone>${(phones)}</Phone></Phones><Sca></Sca><Content>${message}</Content><Length>${message.length}</Length><Reserved>1</Reserved><Date>2021-10-27 00:12:24</Date><nonce>${encrpt_nonce}</nonce></request>`);
|
||||
const resp = await restCalls.sendDataRaw(`http://${sessionData.url}/api/sms/send-sms`, 'POST', data, await getSessionHeaders(sessionData.url));
|
||||
huawei.publicSession.token2 = resp.headers.__requestverificationtoken;
|
||||
const responseText = resp.data;
|
||||
```
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "huawei-hilink",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"description": "huawei-hilink client",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -13,6 +13,7 @@
|
||||
"disableData": "node index.js mobileData --mode=off --url=192.168.89.1 --password=testPassword",
|
||||
"reconnected": "node index.js mobileData --mode=reconnect --url=192.168.89.1 --password=testPassword",
|
||||
"monitoring": "node index.js monitoring --url=192.168.89.1 --password=testPassword",
|
||||
"messages": "node index.js messages --url=192.168.89.1 --deleteAfter=true --password=testPassword",
|
||||
"lint": "eslint src --ext .ts src",
|
||||
"build": "tsc --build",
|
||||
"lint:fix": "eslint --fix src --ext .ts"
|
||||
|
Loading…
Reference in New Issue
Block a user