首页 > 其他分享 >小米 AX9000 破解 SSH 刷 OpenWrt 系统教程

小米 AX9000 破解 SSH 刷 OpenWrt 系统教程

时间:2024-08-16 15:24:07浏览次数:10  
标签:admin AX9000 echo SSH 033 font OpenWrt

AX9000破解过程与AX6相似但有不同,网上有关AX9000的教程不多,因此在成功后写一篇文章分享存档。

准备

1. 设备和文件

2. 设备预处理

2.1. 辅助路由器

  1. 将闲置的 OpenWrt 设备恢复出厂设置后用网线与电脑连接,直接用 SSH 登入控制台
    ssh [email protected]
    
  2. 切换到/tmp目录下,新建文件run.sh
    cd /tmp
    vi run.sh
    
  3. i编辑,写入如下内容3ESC退出,:wq保存
    #!/bin/ash
    # SPDX-License-Identifier: GPL-3.0-only
    #
    # Copyright (C) 2021 Robert Marko <[email protected]>
    # Copyright (C) 2021 Tianling Shen <[email protected]>
    # Copyright (C) 2024 Fumiama Minamoto <[email protected]>
    #
    # Original thread: https://forum.openwrt.org/t/openwrt-support-for-xiaomi-ax9000/98908/34
    
    error_font="\033[31m[Error]\033[0m"
    info_font="\033[36m[Info]\033[0m"
    success_font="\033[32m[Success]\033[0m"
    warning_font="\033[33m[Warning]\033[0m"
    
    echo -e "${warning_font} Please make sure your router has wireless support!"
    echo -e "${warning_font} Please make sure your router is restored to factory settings (not configured)!"
    echo -e "${warning_font} Please make sure you've backed up the network and wireless settings!"
    echo -e "${warning_font} Please make sure you've connected the router via *wired ethernet*!"
    echo -e "${warning_font} Running this script will change your *network* settings!"
    read -p "Use Ctrl+C to exit or press enter key to continue..."
    
    echo -e ""
    echo -e "${info_font} Adding xqsystem controller..."
    cat > "/usr/lib/lua/luci/controller/admin/xqsystem.lua" <<EOF
    module("luci.controller.admin.xqsystem", package.seeall)
    
    function index()
        local page   = node("api")
        page.target  = firstchild()
        page.title   = ("")
        page.order   = 100
        page.index = true
        page   = node("api","xqsystem")
        page.target  = firstchild()
        page.title   = ("")
        page.order   = 100
        page.index = true
        entry({"api", "xqsystem", "token"}, call("getToken"), (""), 103, 0x08)
    end
    
    local LuciHttp = require("luci.http")
    
    function getToken()
        local result = {}
        result["code"] = 0
        result["token"] = "; nvram set ssh_en=1; nvram set uart_en=1; nvram set boot_wait=on; nvram commit; uci set wireless.@wifi-iface[0].key=\`mkxqimage -I\`; uci commit; sed -i 's/channel=.*/channel=\"debug\"/g' /etc/init.d/dropbear; /etc/init.d/dropbear start;"
        LuciHttp.write_json(result)
    end
    EOF
    
    echo -e "${info_font} Changing network settings..."
    set -x
    uci set dhcp.lan.ignore='1'
    uci set network.lan.ipaddr='169.254.31.1'
    uci set wireless.@wifi-iface[0].ssid='MEDIATEK-ARM-IS-GREAT'
    uci set wireless.@wifi-iface[0].encryption='psk2+ccmp'
    uci set wireless.@wifi-iface[0].key='ARE-YOU-OK'
    uci set wireless.@wifi-iface[0].mode='ap'
    uci set wireless.@wifi-iface[0].network='LAN lan'
    uci -q commit
    set +x
    
    echo -e "${success_font} All settings are applied.\n"
    echo -e "${info_font} Please now disconnect from this router, and connect to your Xiaomi AX9000."
    echo -e "${info_font} Then open your browser, access the following URL:"
    echo -e "       http://192.168.31.1/cgi-bin/luci/;stok=<STOK>/api/xqsystem/extendwifi_connect_inited_router?ssid=MEDIATEK-ARM-IS-GREAT&password=ARE-YOU-OK&encryption=WPA2PSKenctype=CCMP&admin_username=root&admin_password=admin&admin_nonce=xxx"
    echo -e "${info_font} If the return code is 0, now you can connect to your AX9000 via SSH."
    echo -e "${info_font} SSH login password is 5GHz wireless connection password."
    echo -e ""
    echo -e "${success_font} Thanks for usage."
    echo -e "          Staff: Robert Marko, Tianling Shen"
    
    echo -e ""
    echo -e "${warning_font} Restarting network..."
    wifi reload >"/dev/null" 2>&1
    /etc/init.d/network restart >"/dev/null" 2>&1
    
  4. 为文件添加可执行权限
    chmod +x run.sh
    

2.2. 目标路由器

不保留配置刷入小米官方 1.0.108 版本固件,随意设置一个密码。

开启 SSH

  1. 在辅助设备上运行
    ./run.sh
    
    此后 SSH 自行断开,不用理会,保持该设备通电,网线可以拔出。
  2. 登录待刷写设备网页管理,复制<STOK>码(网址栏;stok=/web之间的十六进制码)
  3. 同浏览器访问下面的链接,记得替换<STOK>
    http://192.168.31.1/cgi-bin/luci/;stok=<STOK>/api/xqsystem/extendwifi_connect_inited_router?ssid=MEDIATEK-ARM-IS-GREAT&password=ARE-YOU-OK&encryption=WPA2PSKenctype=CCMP&admin_username=root&admin_password=admin&admin_nonce=xxx
    
  4. 成功会返回一个JSON字符串,其中code字段为0。此时SSH已打开且5G WiFi密码已被更改为SSHroot用户密码,可进入管理页查看

刷入工厂固件

  1. 使用上面获得的密码登入待刷写路由器
    ssh [email protected]
    
  2. 确认可以登入后,使用scp拷贝工厂快照固件到路由器/tmp目录
    scp openwrt-qualcommax-ipq807x-xiaomi_ax9000-initramfs-factory.ubi [email protected]:/tmp
    
  3. 查看当前系统所在分区,0代表rootfs1代表rootfs_1
    nvram get flag_boot_rootfs
    
  4. 查看分区对应mtd文件
    cat /proc/mtd
    
    注意:请确保mtd21对应rootfsmtd22对应rootfs_1
  5. 如果第三步返回0,执行
    ubiformat /dev/mtd22 -y -f /tmp/openwrt-qualcommax-ipq807x-xiaomi_ax9000-initramfs-factory.ubi -s 2048 -O 2048 && nvram set flag_boot_rootfs=1 && nvram set flag_last_success=1 && nvram commit
    
  6. 如果第三步返回1,执行
    ubiformat /dev/mtd21 -y -f /tmp/openwrt-qualcommax-ipq807x-xiaomi_ax3600-initramfs-factory.ubi -s 2048 -O 2048 && nvram set flag_boot_rootfs=0 && nvram set flag_last_success=0 && nvram commit
    
  7. 重启路由器

刷入正式 OpenWrt 固件

如可以直接访问luci网页,在页面刷入即可。如无法访问,则还需要用scp拷贝对应sysupgrade.bin文件到/tmp,再用sysupgrade -n命令刷入后重启。


  1. [OpenWrt WiKi] Xiaomi Mi Router AX9000 - https://openwrt.org/toh/xiaomi/ax9000 ↩︎

  2. [OpenWrt WiKi] Xiaomi Mi AIoT Router AX3600 - https://openwrt.org/toh/xiaomi/ax3600 ↩︎

  3. [知乎] 小米AX9000 安装OpenWrt双系统 - https://zhuanlan.zhihu.com/p/427734325 ↩︎

标签:admin,AX9000,echo,SSH,033,font,OpenWrt
From: https://blog.csdn.net/u011570312/article/details/141259096

相关文章

  • 详解Linux命令--ssh
    ssh命令是Linux中最常用的命令之一,用于通过安全的Shell协议远程登录和管理其他计算机。本文将详细介绍ssh命令的用法,并给出具体的示例。1.基本语法ssh的基本语法如下:ssh[options][user@]hostname[command][options]:可选参数,用于控制SSH会话行为。[user@]hostname:......
  • SSH升级至9.8p1
    此次升级的环境是CentOS-7.6.1810ssh版本7.4p1准备好升级包后上传至/home目录,上图红色字体就是上传上去的升级包,共计三个,分别是:openssh-9.8p1.tar.gzopenssl-3.2.2.tar.gzzlib-1.3.1.tar.gz第一步,安装编译环境,以及vim等此次CentOS-7.6是最小化安装,几乎没有安装多余......
  • 自建 RSSHub,打造你的专属信息聚合神器!
    本文着重讲讲根据Docker如何自建RSSHub。当然,根据官网文档,使用npm/Vercel的方式也是可以的,也很简单。‍先声明下:如果没有编程基础的话,搭建起来会有点麻烦,这没关系,每天学习一点,慢慢搭建,总能成功的。网上有不少一键部署的教程,Vercel一键部署RSSHub如果你实在不想动手......
  • 矿渣改NAS,迅雷赚钱宝1代刷OpenWRT
    ​1.迅雷赚钱宝1代配置1.1硬件配置条目描述CPUAmologic晶晨半导体s805(Meson8Family,Meson8b,Quad32bitCortex-A5,ARMv7,28nm,四核1.5GHz)RAMNanyaDDR3256MB,留有一个空位可扩展ROMSpansionS34ML01G100TF1001GbSLCNANDFLASH,[1Gbit=12M]......
  • 博客建站4 - ssh远程连接服务器
    1.什么是SSH?2.下载shh客户端3.配置ssh密钥4.连接服务器5.常见问题5.1.ITISPOSSIBLETHATSOMEONEISDOINGSOMETHINGNASTY!1.什么是SSH?SSH(SecureShell)是一种加密的网络协议,用于在不安全的网络中安全地远程登录到其他计算机系统。它提供了对远程服务器的......
  • Openwrt 配置 PS5 端口转发
    前言前阵子申请了公网IP通过了想远程串流玩PS5通过Socat配置端口转发后仅桌面端Chiaki可以远程串流PS5改用Openwrt的防火墙转发使PSPlay+Chiaki都可串流环境Openwrt22.03.6状态>概览>固件版本步骤打开网络>防火墙>端口转发点击添加配置4个端口9295TC......
  • linux中mysql开启远程ssh连接
    步骤1:配置MySQL允许远程连接1.1修改MySQL配置文件首先,你需要修改MySQL的配置文件(my.cnf或mysqld.cnf),以允许MySQL监听所有网络接口,而不仅仅是本地主机。打开MySQL的配置文件,通常在/etc/mysql/my.cnf或/etc/mysql/mysql.conf.d/mysqld.cnf,或者在CentOS/RHEL......
  • ssh 和 git 教程(1万字超详细)
    SSH(SecureShell)是一种用于安全地访问和管理远程计算机的网络协议。它通过加密的连接在不安全的网络上提供安全的通信方式。SSH常用于远程登录、远程命令执行以及安全数据传输。当我们使用Git进行版本控制时,经常需要将代码推送到远程仓库(例如GitHub、GitLab、Bitbucket等)或......
  • Linux:@2024-08-11 最新的Openssl-3.3.1 Openssh-9.8p1 Centos7上的编译后二进制 一键
     附件:Portable_Openssl-Openssh9.8p1-bin-el7.v1.4.1.tgz.zip 特点:适用于centos7.x 已经编译为二进制对老版本的关键二进制文件sshd、sftp、scp、openssl进行了备份升级前,自动打开一个端口为2222的老版本的sshd服务,你可以连接那个2222的服务,以防死翘翘。对sshd_confi......
  • SSH(Secure Shell)服务配置
    SSH(SecureShell)服务配置是一个涉及多个步骤和配置项的过程,旨在确保远程登录和数据传输的安全性。以下是对SSH服务配置的详细阐述,包括基本概念、配置步骤、常用选项以及最佳实践。一、SSH基本概念SSH是一种安全通道协议,主要用来实现字符界面的远程登录、远程复制等功能。S......