Skip to content

Instantly share code, notes, and snippets.

@zhanglianxin
Created September 30, 2025 01:47
Show Gist options
  • Select an option

  • Save zhanglianxin/b59b88cbf8d8ceb853b7a3669536c420 to your computer and use it in GitHub Desktop.

Select an option

Save zhanglianxin/b59b88cbf8d8ceb853b7a3669536c420 to your computer and use it in GitHub Desktop.
Open a temporary SSH port on the HiWiFi/Gee router (tested and effective on HiWiFi/Gee HC5861)
<?php
## Open a temporary SSH port on the HiWiFi/Gee router
## Tested and effective on HiWiFi/Gee HC5861 (aka HiWiFi 3)
// http://www.4006024680.com/local-ssh/
$contents = file_get_contents('http://192.168.199.1/local-ssh/api?method=get');
$result = json_decode($contents, true);
$local_token = $result['data'];
// http://www.4006024680.com/cgi-bin/turbo/proxy/router_info
$contents = file_get_contents('http://192.168.199.1/cgi-bin/turbo/proxy/router_info');
$result = json_decode($contents, true);
$uuid = $result['data']['uuid'];
// decode local_token
$decoded = explode(",", base64_decode($local_token), 4);
$mac = $decoded[0];
$t = $decoded[2];
// build message
$message = $mac . ",ssh," . (intval($t) + 1);
// generate key
$key = sha1($uuid, true);
// generate cloud_token
function get_hmac_sha1($message, $key)
{
$result = hash_hmac('sha1', $message, $key, true);
return base64_encode($result);
}
$cloud_token = get_hmac_sha1($message, $key);
echo 'cloud_token: ' . $cloud_token . PHP_EOL;
$queryStr = http_build_query([
'method' => 'valid',
'data' => $cloud_token,
]);
$contents = file_get_contents('http://192.168.199.1/local-ssh/api?' . $queryStr);
$result = json_decode($contents, true);
// It should be "Success: ssh port is 22"
echo $result['data'] . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment