- May 10, 2020 11:13 PM
- 教程
- 18302
小米路由器4 LAN口全千兆+5G Wifi,当时顺手买了这货,性价比蛮高。后面由于路由器升级,这货一直在吃灰。最近偶然看到它,发现网上的教程都是需要TTL线刷😂。其实不用线刷也能刷入Openwrt
,特地记录下刷机过程。
Root路由器
使用网友开源方案OpenWRTInvasion
进行Root
。
理论上此方案兼容:
- 小米路由器4
- 小米路由器4A 千兆版
- 小米路由器4A 100M版
- 小米路由器4C
- 小米路由器4Q(R4C)
- 小米路由器3Gv2
- 小米路由器3C
不同型号需要的版本号可能不同,详细情况请自行查阅OpenWRTInvasion。
先决条件
- 安装好
git
、python3
和pip3
。 - 安装好
telnet
(Mac下:brew install telnet
)。 - 路由器和电脑都已经连接上网络。
2021-01-17 19:46:02 补充,特别说明:
已经有很多网友成功,说明此教程具备操作性。如果问题在于上述软件无法正常安装,请不要联系我,请您自行搜索解决,以免不快。谢谢~
Root Shell
git clone https://github.com/acecilia/OpenWRTInvasion
cd OpenWRTInvasion
pip3 install -r requirements.txt
python3 remote_command_execution_vulnerability.py
获取stock
执行脚本后,会要求输入Route IP
和stok
。路由器地址就不解释了,stok
的获取方法很简单,访问路由器管理地址,例如http://192.168.1.1
,然后登录管理后台,再查看当前的路由器管理后台的URL,在URL中某个参数就是stok
。执行过程需要联网。
脚本执行成功后,执行:
telnet <router_ip_address>
用户是root
,不需要密码,回车即可进入。
刷入OpenWRT
注意: 此步骤刷入的固件仅支持小米路由器4
和红米AC2100
,其它机型请自行查找固件。
感谢ioiotor
大佬提供的固件:https://github.com/ioiotor/mir4-ss。可以参考原作者写的小米路由器4刷openwrt 19.07.2 教程。
我也只是使用别人做好的固件,使用过程有什么问题,请联系原作者。
由于Mac下我没有找到怎么通过telnet
直接传文件,记录一下我的解决办法:
下载release
页面大佬编译好的固件,并将openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin
和openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin
这两个文件上传到你的七牛或者别的对象存储中,方便路由器直接wget
。
参考原作者的命令:
cd /tmp
wget http://你的七牛或者别的对象存储地址/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin
wget http://你的七牛或者别的对象存储地址/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin
mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin kernel1
mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin rootfs0
nvram set flag_try_sys1_failed=1
nvram commit
reboot
重启后,打开浏览器,输入http://192.168.1.1
,用户名是root
,密码为空或password
。
进入系统
-备份/升级
页面(/cgi-bin/luci/admin/system/flash
),将带sysupgrade
的固件文件上传到刷写新固件
(取消勾选保存配置)。刷入后等待重启,刷机完成。
路由器内存够用,性能也不错,截止发稿,稳定运行两个周。再次感谢提供Root Shell
方案的相关大佬和ioiotor
大佬的固件。

已刷机成功

恭喜

你好,请问git
、python3
和pip3
。这几个包的安装有什么兼容性要求

你好,请问
git
、python3
和pip3
。这几个包的安装有什么兼容性要求
这几个中,git尽量装最新的即可。python试试3.7,不行就升级最新。这个开源库内容也一直在变。以开源库说明为准。

在交流区开放前,收到一些小伙伴邮件告诉我刷机成功的喜讯。感谢大家的支持!

你好,我前面的命令行执行都是成功的,但是telnet失败了,请问你知道原因吗?

哥们,看上去貌似没有问题,你的路由器型号是什么?试一下当前是否能ping通路由器。

哥们,看上去貌似没有问题,你的路由器型号是什么?试一下当前是否能ping通路由器。
我也发生了同样的错误,请问这个怎么解决的,万分感谢

我也发生了同样的错误,请问这个怎么解决的,万分感谢
貌似再次执行就好了。

貌似再次执行就好了。
使用telnet 10.10.120.1 -l root可以连接
但是遇到另外一个问题:reboot之后,半天没反应,是否已经砖了?

但是遇到另外一个问题:reboot之后,半天没反应,是否已经砖了?
这不一定。甚至这已经是普遍现象。断电,再上电,观察是否能正常进入系统。

执行这条命令的时候提示有语法错误
pip3 install -r requirements.txt
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(26): error C2061: syntax error: identifier 'intmax_t' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27): error C2061: syntax error: identifier 'rem' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27): error C2059: syntax error: ';' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(28): error C2059: syntax error: '}' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(30): error C2061: syntax error: identifier 'imaxdiv_t' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(30): error C2059: syntax error: ';' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(40): error C2143: syntax error: missing '{' before 'cdecl' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41): error C2146: syntax error: missing ')' before identifier '_Number' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41): error C2061: syntax error: identifier '_Number' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41): error C2059: syntax error: ';' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(42): error C2059: syntax error: ')' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(45): error C2143: syntax error: missing '{' before 'cdecl' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2146: syntax error: missing ')' before identifier '_Numerator' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2061: syntax error: identifier '_Numerator' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2059: syntax error: ';' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2059: syntax error: ',' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(48): error C2059: syntax error: ')' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(50): error C2143: syntax error: missing '{' before 'cdecl' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(56): error C2143: syntax error: missing '{' before 'cdecl' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(63): error C2143: syntax error: missing '{' before 'cdecl' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(69): error C2143: syntax error: missing '{' before 'cdecl' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(76): error C2143: syntax error: missing '{' before 'cdecl' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(82): error C2143: syntax error: missing '{' before 'cdecl' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(89): error C2143: syntax error: missing '{' before 'cdecl' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(95): error C2143: syntax error: missing '{' before 'cdecl'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2 |
---|
ERROR: Command errored out with exit status 1: 'c:\users\administrator\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Administrator\AppData\Local\Temp\pip-install-lna6x3bj\pycrypto\setup.py'"'"'; file='"'"'C:\Users\Administrator\AppData\Local\Temp\pip-install-lna6x3bj\pycrypto\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Administrator\AppData\Local\Temp\pip-record-48ixpmdn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\administrator\appdata\local\programs\python\python38\Include\pycrypto' Check the logs for full command output. |

这是安装依赖的时候报错了。请尝试更换python版本。

这是安装依赖的时候报错了。请尝试更换python版本。
谢谢

我安装的是3.8.5版本,请问有推荐版本吗

我安装的是3.8.5版本,请问有推荐版本吗
可以尝试一下2.7版本,多试几次

你好 我这里同样的telnet不通 我用的linux ,请问一下该怎么解决呢?
[LX@MiWiFi-R4-srv ~]$ telnet 192.168.31.1 Trying 192.168.31.1... telnet: connect to address 192.168.31.1: Connection refused

ping 192.168.31.1的话是可以的

ping 192.168.31.1的话是可以的
这个情况有可能是之前的步骤有报错。之前步骤是否都正常呢?

ping 192.168.31.1的话是可以的
再试一次,或许就能成功

再试一次,或许就能成功
是呢,他就是这样成功了!

Running setup.py install for pycrypto ... error ERROR: Command errored out with exit status 1: command: 'c:\python\python36\python3.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\hzt\AppData\Local\Temp\pip-install-veo0d704\pycrypto\setup.py'"'"'; file='"'"'C:\Users\hzt\AppData\Local\Temp\pip-install-veo0d704\pycrypto\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\hzt\AppData\Local\Temp\pip-record-6q0tu156\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python\python36\Include\pycrypto' cwd: C:\Users\hzt\AppData\Local\Temp\pip-install-veo0d704\pycrypto\
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2 |
---|
ERROR: Command errored out with exit status 1: 'c:\python\python36\python3.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\hzt\AppData\Local\Temp\pip-install-veo0d704\pycrypto\setup.py'"'"'; file='"'"'C:\Users\hzt\AppData\Local\Temp\pip-install-veo0d704\pycrypto\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\hzt\AppData\Local\Temp\pip-record-6q0tu156\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python\python36\Include\pycrypto' Check the logs for full command output. |
这是我得到最新的报错,请问我该怎么继续呢

可以尝试下载git windows,借助git bash再试试

之前的问题已经解决,更换python的版本解决的。我终于进行下一步,但是还是遇到问题。
Administrator@HZT MINGW64 /h/openwrt/OpenWRTInvasion (master) $ python remote_command_execution_vulnerability.py File "remote_command_execution_vulnerability.py", line 22 router_ip_address = input(f"Router IP address [press enter for using the default {router_ip_address}]: ") or router_ip_address ^ SyntaxError: invalid syntax

再试一次,这是哪一步报错的?

再试一次,这是哪一步报错的?
运行
python3 remote_command_execution_vulnerability.py时报错

好像说的是路由器ip地址不对

好像说的是路由器ip地址不对

上面是我运行remote_command_execution_vulnerability.py这个文件时的报错,代码是不是要改

正常来说是不需要修改代码的。这个报错可能跟python版本有关。

然后又遇到下面这个问题
没有提示这个GBK报错了,接下来有报错了
对于这个报错我看不懂,因为我没有学习过python编程,实在难搞。请大哥们帮我看看。

虽然我想尽办法,最后还是失败了。

抱歉,你的回复我已经收到短信提示的。今天有点忙。
你的路由器型号是多少?

抱歉,你的回复我已经收到短信提示的。今天有点忙。
你的路由器型号是多少?
路由器型号是小米4

你的路由器型号是多少?
路由器型号是小米4
小米4应该是没问题的。要不在wsl或者linux环境试一下。

你的路由器型号是多少?
路由器型号是小米4
我查询到Python3.6版本才有字符串前加F的用法,在脚本里输入IP的这一行就是用的这种格式,而我用的是python3.5,我将会装3.6 版本的再尝试。

我查询到Python3.6版本才有字符串前加F的用法,在脚本里输入IP的这一行就是用的这种格式,而我用的是python3.5,我将会装3.6 版本的再尝试。
嗯嗯,可以直接尝试3.8

哥,有联系方式吗,我的米4出了点问题,有线连接正常速度,峰值11M每秒,但是无线连接始终只有500K,就好像被限速了,无论如何调试都无效,更改无线频段有所改散,2.4G现在用11信道40M可达3.5M每秒,5G干脆直接无法用,只有100K每秒,如何调试都是无效的,虽然说勉强可用2.4G,但是很难受,现在想刷固件看看能不能改善这个问提,可是我完全是爬虫小白,你提的先决条件我都下载好了工具,但是你所展示的代码这些,看不懂。可以要一个联系方式吗

哥,有联系方式吗,我的米4出了点问题,有线连接正常速度,峰值11M每秒,但是无线连接始终只有500K,就好像被限速了,无论如何调试都无效,更改无线频段有所改散,2.4G现在用11信道40M可达3.5M每秒,5G干脆直接无法用,只有100K每秒,如何调试都是无效的,虽然说勉强可用2.4G,但是很难受,现在想刷固件看看能不能改善这个问提,可是我完全是爬虫小白,你提的先决条件我都下载好了工具,但是你所展示的代码这些,看不懂。可以要一个联系方式吗
可以加我微信,在博客首页头像下方哈

root@XiaoQiang:~# cd /tmp root@XiaoQiang:/tmp# wget http://10.10.10.5/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin Connecting to 10.10.10.5 (10.10.10.5:80) openwrt-ramips-mt762 100% |****| 1874k 0:00:00 ETA root@XiaoQiang:/tmp# wget http://10.10.10.5/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin Connecting to 10.10.10.5 (10.10.10.5:80) openwrt-ramips-mt762 100% |****| 15616k 0:00:00 ETA root@XiaoQiang:/tmp# mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin kernel1 Could not open mtd device: kernel1 Can't open device for writing! root@XiaoQiang:/tmp# mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin rootfs0 Could not open mtd device: rootfs0 Can't open device for writing! root@XiaoQiang:/tmp# nvram set flag_try_sys1_failed=1 root@XiaoQiang:/tmp# nvram commit root@XiaoQiang:/tmp# reboot
root@XiaoQiang:/tmp# cat /proc/mtd dev: size erasesize name mtd0: 01000000 00010000 "ALL" mtd1: 00030000 00010000 "Bootloader" mtd2: 00010000 00010000 "Config" mtd3: 00010000 00010000 "Bdata" mtd4: 00010000 00010000 "Factory" mtd5: 00010000 00010000 "crash" mtd6: 00010000 00010000 "cfg_bak" mtd7: 00100000 00010000 "overlay" mtd8: 00d00000 00010000 "OS1" mtd9: 00b30000 00010000 "rootfs" mtd10: 00180000 00010000 "disk" root@XiaoQiang:/tmp#
能否帮忙看下?

这几行命令是需要在路由器里面执行,貌似你在本地终端执行的。👀️

这几行命令是需要在路由器里面执行,貌似你在本地终端执行的。👀️
是在路由器里执行的,写入的时候报 Can't open device
root@XiaoQiang:/tmp# mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin kernel1
Could not open mtd device: kernel1
Can't open device for writing!
root@XiaoQiang:/tmp# mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin rootfs0
Could not open mtd device: rootfs0

这个情况我没有遇到过,也没有其他人反映过有这个问题。你的路由器型号是小米路由器4
吗?我看主机名好像不正常。

这个情况我没有遇到过,也没有其他人反映过有这个问题。你的路由器型号是
小米路由器4
吗?我看主机名好像不正常。
小米R4A,应该是这个型号,我路由器的信息

那得找对应的固件去刷嘛。这个固件是小米路由器4的。

那得找对应的固件去刷嘛。这个固件是小米路由器4的。
小米R4A 就是小米路由4千兆版,可能是这个出厂晚些(这两个分区名称变了)命令中 kernel1,rootfs0 这个两个也要变化,但是我不确定对应的是哪两个...
谢谢,博主的回复

哦哦,你说这个情况我确实不太清楚。😂
祝你顺利!

那得找对应的固件去刷嘛。这个固件是小米路由器4的。
小米R4A 就是小米路由4千兆版,可能是这个出厂晚些(这两个分区名称变了)命令中 kernel1,rootfs0 这个两个也要变化,但是我不确定对应的是哪两个...
谢谢,博主的回复
小米R4A有点不同。先进入https://github.com/acecilia/OpenWRTInvasion, 下载它 miwifi_r4a_firmware_72d65_2.28.62.bin回来,升级你的小米4A千兆版的固件。 升级之后重新 执行python3 remote_command_execution_vulnerability.py, 然后执行 telnet <你的路由IP> 。然后在刷入OpenWRT这一步。
root@XiaoQiang:~# cd /tmp
root@XiaoQiang:/tmp# wget http://iovoz.org/openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade.bin
检查sha码,看是否是83feed9ff633863acb1f14b61c30029b924fec252c1ed1e4de2a909e52b2d872。。这个码就是对的
root@XiaoQiang:/tmp# ./busybox sha256sum openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade.bin
root@XiaoQiang:/tmp# mtd -e OS1 -r write firmware.bin OS1

那得找对应的固件去刷嘛。这个固件是小米路由器4的。
小米R4A 就是小米路由4千兆版,可能是这个出厂晚些(这两个分区名称变了)命令中 kernel1,rootfs0 这个两个也要变化,但是我不确定对应的是哪两个...
谢谢,博主的回复
root@XiaoQiang:/tmp# mtd -e OS1 -r write openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade.bin OS1
最后一句这样写。

谢谢哥们!

那得找对应的固件去刷嘛。这个固件是小米路由器4的。
小米R4A 就是小米路由4千兆版,可能是这个出厂晚些(这两个分区名称变了)命令中 kernel1,rootfs0 这个两个也要变化,但是我不确定对应的是哪两个...
谢谢,博主的回复
小米R4A有点不同。先进入https://github.com/acecilia/OpenWRTInvasion, 下载它 miwifi_r4a_firmware_72d65_2.28.62.bin回来,升级你的小米4A千兆版的固件。 升级之后重新 执行python3 remote_command_execution_vulnerability.py, 然后执行 telnet <你的路由IP> 。然后在刷入OpenWRT这一步。
root@XiaoQiang:~# cd /tmp
root@XiaoQiang:/tmp# wget http://iovoz.org/openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade.bin
检查sha码,看是否是83feed9ff633863acb1f14b61c30029b924fec252c1ed1e4de2a909e52b2d872。。这个码就是对的
root@XiaoQiang:/tmp# ./busybox sha256sum openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade.bin
root@XiaoQiang:/tmp# mtd -e OS1 -r write firmware.bin OS1
root@XiaoQiang:/tmp# wget http://iovoz.org/openwrt-ramips-mt7621-xiaomi_mir3g-v2 -squashfs-sysupgrade.bin Connecting to iovoz.org (47.75.196.2:80) wget: server returned error: HTTP/1.1 404 Not Found root@XiaoQiang:/tmp#
网站失效了

我贡献一下吧,我自己的网站。。11月底前到期吧。 http://iovoz.org/openwrt-ramips-mt7621-xiaomi_mir4-initramfs-kernel.bin。
http://iovoz.org/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin。
http://iovoz.org/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin。
http://iovoz.org/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-sysupgrade.bin。

替网友谢谢哥们!👍

老哥你好 可以再传一下吗 404 not found 了

stok那个怎么取??

获取到ip后执行上述命令是否有报错提示呢?

获取到ip后执行上述命令是否有报错提示呢?
刷机成功。。但是lan地址改不了。我的宽带300m,WIFI现在只能跑150m,如果刷回原本在mac怎么刷?

获取到ip后执行上述命令是否有报错提示呢?
我按保存了。。保存不了。。重启,,变回192.168.1.1

可以尝试修改wifi的功率,频段等参数获得较高速率

保存不了多试几次,重启过程要尝试性访问新ip,否则系统会认为不可达而自动回滚配置。

R4a,卡在这一步了,执行没反应
C:\Users\RyanW\OpenWRTInvasion>python3 remote_command_execution_vulnerability.py
C:\Users\RyanW\OpenWRTInvasion>

上一步是否执行成功了呢?

上一步是否执行成功了呢?

根据其他网友的经验,换WSL或者Ubuntu,也许就可以了。😂

根据其他网友的经验,换WSL或者Ubuntu,也许就可以了。😂
前面刷好了,但是192.168.1.1打不开,ping 192.168.1.1 是可以的

试试进telnet

已刷 感谢大大的耐心指导 附上本人千牛存储 希望能帮到大家
wget http://qhyt2t2b3.hn-bkt.clouddn.com/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin wget http://qhyt2t2b3.hn-bkt.clouddn.com/attachment%20filenameopenwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin wget http://qhyt2t2b3.hn-bkt.clouddn.com/attachment%20filenameopenwrt-ramips-mt7621-xiaomi_mir4-squashfs-sysupgrade.bin wget http://qhyt2t2b3.hn-bkt.clouddn.com/attachment%20filenameopenwrt-ramips-mt7621-xiaomi_mir4-initramfs-kernel.bin

谢谢分享!

请大神帮个忙,无法telnet

经过网友提醒,这个问题请尝试降级解决。

大佬的release
里面已经不提供固件了。楼主能发个固件吗?xez8499@163.com。。谢谢楼主👍

经查看,release
里面有固件的呀。这个是别人提供的固件,可以尝试和原作者联系。

经查看,
release
里面有固件的呀。这个是别人提供的固件,可以尝试和原作者联系。
openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin
和openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin
不好意思,是我没表达清楚。这两个文件是在哪里下载的啊?

你需要自己上传,或者使用评论区网友留下来的地址。

➜ OpenWRTInvasion git:(master) python remote_command_execution_vulnerability.py
Router IP address [press enter for using the default {router_ip_address}]: 192.168.1.1
stok: 0012047c932c8df0236b7abd819b670d
****************
router_ip_address: 192.168.1.1
stok: 0012047c932c8df0236b7abd819b670d
****************
start uploading config file...
start exec command...
done! Now you can connect to the router using telnet (user: root, password: none)
In MacOS, execute in the terminal:
telnet 192.168.1.1
➜ OpenWRTInvasion git:(master) telnet 192.168.1.1
Trying 192.168.1.1...
telnet: Unable to connect to remote host: Connection refused
➜ OpenWRTInvasion git:(master)
执行脚本后无法 telnet
版本 2.28.62

尝试断电重启后,再进行一次

尝试断电重启后,再进行一次
断电后试了下,还是无法 telnet

再执行一次命令

再执行一次命令
再试了也不行。我以尝试了 0.0.1 版本,在 termux 上似乎是登上了路由器的 tty

看样子是连上了

看样子是连上了
重新刷机后 telnet 成功,将四个文件下载上了,但是 mtd 命令不成功

请检查是否路由器型号不对呀!

请问用的小米路由器R4的版本是多少,我用的是2.26.127,运行后r1.text会报{"code":1629,"msg":"解压失败,可能文件已经损坏"}错误, r2.text会返回502

尝试降级试试。我不记得了,但是网友有反馈需要降级。

请问一下,是哪里有问题。

请尝试断电重启,然后再操作一次。如果不行,尝试降级。

同机型同版本, 不成功, 无法telnet, 看readme里没有提到支持R4

嗯嗯,或许是这个原因。

刷了之后 网速有提升么 ?

并无提升哈。

可以共享下软件吗?就是你成功的版本

不好意思,我不敢呀😂

小米路由4刷机成功
但版本要用0.0.1
操作略有不同,需要使用netcat

固件用最新版就行

恭喜!!🎉

固件用最新版就行
大哥,能不能教我用00.0.1刷小米路由器4?我自己尝试了没有搞好,001版本还没有弄太懂

小米路由器4telnet无法连接,请问大神有没有办法解决?路由固件已从2.26.175降级为2.26.127,这两个固件都卡在telnet连接上
fly@fly:~/Desktop/Python-3.9.0/OpenWRTInvasion$ python3 remote_command_execution_vulnerability.py Router IP address: 192.168.31.1 stok: f9fc3d2201f28138c3b4b9228f6c4434
router_ip_address: 192.168.31.1 stok: f9fc3d2201f28138c3b4b9228f6c4434
start uploading config file... start exec command... done! Now you can connect to the router using telnet (user: root, password: none) In MacOS, execute in the terminal: telnet 192.168.31.1
fly@fly:~/Desktop/Python-3.9.0/OpenWRTInvasion$ telnet 192.168.31.1 Trying 192.168.31.1... telnet: Unable to connect to remote host: Connection refused

看样子并没有报错。可以尝试断电重启,然后再试一次。有网友通过这个方法成功了。

小米路由4 Telnet连不上可以参考下github原作者关于R4的回复:
[Mi Router 4]: user Firef0x claims that exploit version 0.0.1
works on firmware version 2.26.175
.
需要使用0.0.1版本结合netcat使用:
- 下载0.0.1版本:
https://github.com/acecilia/OpenWRTInvasion/archive/0.0.1.zip
- windows下载netcat参考,netcat可能会被查杀,先关闭杀毒软件:
https://blog.csdn.net/nicolewjt/article/details/88898735
- 根据代码提示打开新的终端使用netcat监听4444端口
- 连接后和Telnet操作一样
注:
- 在0.0.1版本未对中文优化,运行remote_command_execution_vulnerability.py可能报gbk错误
解决办法:用文档编辑器打开py文件,windows自带的记事本就可以:
remote_command_execution_vulnerability.py脚本中有4个with open:
with open("speedtest_urls_template.xml","rt")
在其中标明解码,改为:
with open("speedtest_urls_template.xml","rt", encoding="UTF-8")
可以在remote_command_execution_vulnerability.py中改ip、stok,省的每次运行都要复制粘贴:
router_ip_address = "192.168.31.1" attacker_ip_address = "192.168.31.114" stok = "你的stok"

感谢!👍 整理得很好!

已经用了0.01这个版本,然后用netcat监听了4444端口,输入路由器ip和stok之后,提示done完成之后就又没反应了。不知道怎么操作了,用telnet命令还是提示无法打开到主机的连接。

到这一步多半是成功的。根据经验,此时应该断电重启试试。

别用windows.Windows经常有奇怪bug

别用windows.Windows经常有奇怪bug
很同意!!

在网上翻来覆去,在传统xxx账号+小米路由的方式上,在小米路由刷开发机+xxxx的方式上,迷茫着倒腾快两周了,单是能确定到这两个倒腾方向上来,已经很不容易了。本来已经倾向于换小米路由器3或者mini这些看起来网友们倒腾成功率较高的设备了,或者可以说,这几个版本好赖有官方提供开发版固件,自己可能稍微不至于走入死胡同一些。不过当地市区好几家小米实体店都表示这些已经是旧版本了,没有货。
看着自家仓库一箱子又一箱子的路由4,和路由3无货的现状,我又限入了绝望。割腕自杀的最后一丝之际,我遇到了你,结果就是。。。。。这清晰可行的步骤带着我刷成功了!!你可真是个大好人,希望你永远活着,永远发光~

成功就好,恭喜恭喜!🎉️

git、python3、pip3、telnet,这几个东西哪里下载?

您好,这些工具需要查找对应程序的官方网站,在相应的网站进行下载。

提示22端口没有打开是怎么回事

23端口

23端口
请尝试一下断电重启。如果还是异常,再确认一下型号和对应的安装包是否一致呀~

试过了,下载的是0.06那个,还没到刷openWRT,就是前面都能执行成功,telnet的时候提示23端口连接失败

嗯嗯。你的路由器型号是哪一个呢?

嗯嗯。你的路由器型号是哪一个呢?
小米路由器4

更换了0.0.1版本后运行pip3 install那个命令出现了报错:
error: Microsoft Visual C++ 14.0 is required.
Get it with "Build Tools for Visual Studio":
https://visualstudio.microsoft.com/downloads/

尝试访问上述地址安装Build Tools for Visual Studio
后重新执行命令。

尝试访问上述地址安装
Build Tools for Visual Studio
后重新执行命令。
我用mac成功了,请问可否给一个wget地址呢,我没有对象存储

我用mac成功了,请问可否给一个wget地址呢,我没有对象存储
您可以注册一个七牛,有免费额度可以用呢!由于某些原因,我不方便提供固件,抱歉。

请问包在哪儿下载

可以到某恩搜搜看。

root@XiaoQiang:/tmp# wget http://192.168.31.153/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin
Connecting to 192.168.31.153 (192.168.31.153:80)
wget: can't connect to remote host (192.168.31.153): Connection refused
帮忙看看这是什么问题

无法访问192.168.31.153,请确保这个请求可以访问。

Trying 192.168.31.1... telnet: Unable to connect to remote host: Connection refused
到telnet那里连接被拒绝,断电重启了还是被拒绝。咋弄?

你的路由器是什么型号和版本,用的什么版本的程序?

你的路由器是什么型号和版本,用的什么版本的程序?
小米路由器4(R4),MiWiFi 稳定版 2.26.175

小米路由器4(R4),MiWiFi 稳定版 2.26.175
R4暂时还不支持,只支持R4C。

小米路由器4(R4),MiWiFi 稳定版 2.26.175
R4暂时还不支持,只支持R4C。
同样是R4,尝试了好多次,确实不幸

同样是R4,尝试了好多次,确实不幸
是的,很遗憾~

windows telnet进入后也输入不了命令啊。是需要linux系统嘛

可以尝试先进入WSL

可以尝试先进入WSL
前天晚上,我用001版本刷了。现在我的4q已经变砖了。固件地址:https://openwrt.org/toh/hwdata/xiaomi/xiaomi_mi_router_4q
准备改天有空用usb ttl刷一下了

很抱歉,至于4q为啥没成我也不是很清楚,估计不同版本有差异。

很抱歉,至于4q为啥没成我也不是很清楚,估计不同版本有差异。
没有,并不是您的错。我比较喜欢折腾,翻车很正常,网上的4q用的人太少了,哎

😄 我已经弃坑了

小米路由4 使用0.0.1
,刷入成功。不过由此我的电脑多了一个ubuntu。油管上有个老外用博主的方法也能成,不过他用的MacOS,这我就搞不到了。

嗯嗯,运行这类命令*unix系统好使!




😄 我已经弃坑了
没有,并不是您的错。我比较喜欢折腾,翻车很正常,网上的4q用的人太少了,哎
很抱歉,至于4q为啥没成我也不是很清楚,估计不同版本有差异。
要先卸载
Intel® RealSense™ Depth Camera Manager
,然后再安装各个msi。嗯嗯,运行这类命令*unix系统好使!