最新京东云路由免拆机root解决方案
// 从Cookie提取sessionid(需要先登录 路由器后台)
const sessionid = document.cookie
.split('; ')
.find(row => row.startsWith('sessionid='))
?.split('=')[1] || '';
const apiUrl = '/jdcapi';
async function enableTelnet() {
if (!sessionid) {
console.error("未找到 sessionid,请先登录路由器后台!");
return;}
console.log("检测到 Session ID:", sessionid);
try {
// 第一步:修改 Telnet 标志位
console.log("正在执行第1步:开启系统 Telnet 标志位...");
const step1Res = await fetch(apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "call",
"params": [
sessionid,
"jdcapi.static",
"set_iptv_info",
{
"enable": "1",
"vlan_enable": "1",
"vid": "99; factory_hm info telnet 1;",
"priority": "0",
"port": "1"
}
]
})
});
console.log('第1步结果:', await step1Res.json());
// 稍微等待一下,确保上一步生效
await new Promise(r => setTimeout(r, 1000));
// 第二步:启动 Telnet 服务
console.log("正在执行第2步:启动 Telnetd 服务...");
const step2Res = await fetch(apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 2,
"method": "call",
"params": [
sessionid,
"jdcapi.static",
"set_iptv_info",
{
"enable": "1",
"vlan_enable": "1",
"vid": "99; telnetd -F -l /bin/login;",
"priority": "0",
"port": "1"
}
]
})
});
console.log('第2步结果:', await step2Res.json());
console.log("执行完成!请尝试 telnet 连接 路由器。");
} catch (e) {
console.error('操作异常 (如果是第2步请求超时,通常意味着 telnetd 启动成功):', e);}
}
enableTelnet();