HIWIFI的API
1.获取uuid
GET:http://www.4006024680.com/cgi-bin/turbo/proxy/router_info
取json.data.uuid
2.获取local_token
GET: http://www.4006024680.com/local-ssh/api?method=get
取json.data
3.打开SSH
GET: http://www.4006024680.com/local-ssh/api?method=valid&data=`[cloud_token]`
4.关闭SSH
GET: http://www.4006024680.com/local-ssh/api?method=stop
5.检查SSH
GET: http://www.4006024680.com/local-ssh/api?method=check_connected
cloud_token 的计算
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| const local_token = '';
const uuid = '';
let local_token_msg = CryptoJS.enc.Base64.parse(local_token).toString(CryptoJS.enc.Latin1);
let [mac_address, ssh, timestamp] = local_token_msg.split(',');
timestap = parseInt(timestamp)+1;
let cloud_token_msg = [mac_address, ssh, timestamp].join(',');
let cloud_token = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(cloud_token_msg,CryptoJS.SHA1(uuid)));
|