0%

HIWIFI的SSH开启

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
// 'RDRFRTA3NjE3NTAwLHNzaCwxNTQwOTMxMzExOTk2LKrM8KmSbnrR8DzGobUdDx6097GH'
const local_token = '';
// 'af930766-ae38-528b-bcd2-d4ee07617500'
const uuid = '';

// 'D4EE07617500,ssh,1540931311996,ªÌð©\x92nzÑð<Æ¡µ\x1D\x0F\x1E´÷±\x87'
let local_token_msg = CryptoJS.enc.Base64.parse(local_token).toString(CryptoJS.enc.Latin1);

// ['D4EE07617500', 'ssh', '1540931311996']
let [mac_address, ssh, timestamp] = local_token_msg.split(',');

timestap = parseInt(timestamp)+1;

// 'D4EE07617500,ssh,1540931311997'
let cloud_token_msg = [mac_address, ssh, timestamp].join(',');

// 'tVyYDiwUvWZ4bIyFBh/EWEc3ndc='
let cloud_token = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(cloud_token_msg,CryptoJS.SHA1(uuid)));