Skip to content

Mytai20100/AP-AX3000CV2-root-access

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

AP-AX3000CV2-root-access

EnglishChineseVietnamese

EN

Python script to set up SSH password for FPT AP-AX3000CV2

router-ssh

A minimal script to set the SSH root password on AEI-based routers (OpenWrt firmware) via the ubus JSON-RPC API. No SSH key required.

Tested on: AP-AX3000CV2 (AEI firmware)


Requirements

  • Python 3.13.7 or later (no third-party libraries required)
  • paramiko (optional, only needed for --verify)
  • Must be connected to the router's LAN network
pip install paramiko

How it works

AEI firmware exposes a ubus JSON-RPC endpoint at http://<router-ip>/ubus. The script does the following:

  1. Sends a login request with the web GUI credentials to obtain a session token.
  2. Calls oui.network / set_ssh_password with the new password using that token.
  3. (Optional) Connects via SSH using paramiko to verify the new password works.

The web GUI password and the SSH root password are stored separately on this firmware. This script updates only the SSH root password.


Usage

python3 fpt-dump.py --webpass <web-gui-password> --sshpass <new-ssh-password> [options]

Options:

--ip        Router IP address          (default: 192.168.1.1)
--user      Web GUI username           (default: admin)
--webpass   Web GUI password           (required)
--sshpass   New SSH root password      (required)
--verify    Test SSH login afterwards  (requires paramiko)

Examples

Set SSH password, using all defaults:

python3 fpt-dump.py --webpass "MyAdminPass" --sshpass "MySSHPass"

Set SSH password and verify the login works:

python3 fpt-dump.py --webpass "MyAdminPass" --sshpass "MySSHPass" --verify

Custom router IP and username:

python3 fpt-dump.py --ip 192.168.0.1 --user admin --webpass "MyAdminPass" --sshpass "MySSHPass"

After running, connect via SSH:

ssh root@192.168.1.1

ZH

router-ssh

通过 ubus JSON-RPC 接口,为基于 AEI 固件的路由器设置 SSH root 密码,无需 SSH 密钥认证。

适用设备:AP-AX3000CV2(AEI 固件)


依赖环境

  • Python 3.13.7 或更高版本(无需额外第三方库)
  • paramiko(可选,仅在使用 --verify 参数时需要)
  • 设备与路由器需处于同一局域网(LAN)

pip install paramiko


工作原理

AEI 固件在 http://<路由器IP>/ubus 提供 ubus JSON-RPC 接口,本脚本通过该接口完成 SSH 密码设置,流程如下:

  1. 使用 Web 管理界面账号登录,获取 session token。
  2. 使用该 token 调用 oui.network / set_ssh_password 接口,设置新的 SSH 密码。
  3. (可选)通过 paramiko 进行 SSH 登录验证,确认新密码是否生效。

在该固件中,Web 管理密码与 SSH root 密码是独立存储的,本脚本仅用于修改 SSH root 密码。


使用方法


python3 fpt-dump.py --webpass <Web管理密码> --sshpass <新的SSH密码> [可选参数]


参数说明


--ip        路由器 IP 地址        (默认:192.168.1.1)
--user      Web 管理用户名        (默认:admin)
--webpass   Web 管理密码          (必填)
--sshpass   SSH root 新密码       (必填)
--verify    设置完成后验证 SSH 登录(需要 paramiko)


示例

使用默认参数设置 SSH 密码:


python3 fpt-dump.py --webpass "MyAdminPass" --sshpass "MySSHPass"

设置完成后验证 SSH 登录:


python3 fpt-dump.py --webpass "MyAdminPass" --sshpass "MySSHPass" --verify

自定义 IP 和用户名:


python3 fpt-dump.py --ip 192.168.0.1 --user admin --webpass "MyAdminPass" --sshpass "MySSHPass"

完成后通过 SSH 连接:


ssh root@192.168.1.1


VI

router-ssh

Script thiết lập mật khẩu SSH root trên router firmware AEI (OpenWrt) thông qua ubus JSON-RPC API. Không cần SSH key.

Thử trên: AP-AX3000CV2 (firmware AEI)


Yêu cầu

  • Python 3.13.7 trở lên (không cần thư viện ngoài)
  • paramiko (tùy chọn, chỉ cần khi dùng --verify)
  • Máy tính phải kết nối vào mạng LAN của router

pip install paramiko


Cách hoạt động

Firmware AEI cung cấp ubus JSON-RPC tại http://<ip-router>/ubus. Script thực hiện theo các bước:

  1. Đăng nhập bằng tài khoản web GUI để lấy session token.
  2. Gọi oui.network / set_ssh_password với token đó để đặt mật khẩu mới.
  3. (Tùy chọn) Kết nối SSH bằng paramiko để xác nhận mật khẩu hoạt động.

Mật khẩu web GUI và mật khẩu SSH root được lưu riêng biệt trong firmware này. Script chỉ cập nhật mật khẩu SSH root.


Sử dụng


python3 fpt-dump.py --webpass <mật-khẩu-web> --sshpass <mật-khẩu-ssh-mới> [tùy-chọn]


Các tùy chọn


--ip        Địa chỉ IP router           (mặc định: 192.168.1.1)
--user      Tên đăng nhập web GUI       (mặc định: admin)
--webpass   Mật khẩu web GUI            (bắt buộc)
--sshpass   Mật khẩu SSH root mới       (bắt buộc)
--verify    Kiểm tra SSH sau khi đặt    (cần paramiko)


Ví dụ

Đặt mật khẩu SSH, dùng mặc định:


python3 fpt-dump.py --webpass "MatKhauAdmin" --sshpass "MatKhauSSH"

Đặt và kiểm tra luôn:


python3 fpt-dump.py --webpass "MatKhauAdmin" --sshpass "MatKhauSSH" --verify

Tùy chỉnh IP và tên đăng nhập:


python3 fpt-dump.py --ip 192.168.0.1 --user admin --webpass "MatKhauAdmin" --sshpass "MatKhauSSH"

Sau khi chạy xong, kết nối SSH:


ssh root@192.168.1.1


Cpu:

root@AP-AX3000CV2-FACF:~# cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 60.48
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x51
CPU architecture: 7
CPU variant     : 0xa
CPU part        : 0x801
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 60.48
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x51
CPU architecture: 7
CPU variant     : 0xa
CPU part        : 0x801
CPU revision    : 4

Hardware        : Generic DT based system
Revision        : 0000
Serial          : 0000000000000000
root@AP-AX3000CV2-FACF:~#

Ram

root@AP-AX3000CV2-FACF:~# free -h
              total        used        free      shared  buff/cache   available
Mem:         429600      198564      105628       20528      125408      144460
Swap:             0           0           0
root@AP-AX3000CV2-FACF:~#

login

mytai@snd-nodevn1:~$ sshpass -p '#Test0001' ssh root@192.168.1.1


BusyBox v1.33.2 (2025-09-09 06:20:54 UTC) built-in shell (ash)

     MM           NM                    MMMMMMM          M       M
   $MMMMM        MMMMM                MMMMMMMMMMM      MMM     MMM
  MMMMMMMM     MM MMMMM.              MMMMM:MMMMMM:   MMMM   MMMMM
MMMM= MMMMMM  MMM   MMMM       MMMMM   MMMM  MMMMMM   MMMM  MMMMM'
MMMM=  MMMMM MMMM    MM       MMMMM    MMMM    MMMM   MMMMNMMMMM
MMMM=   MMMM  MMMMM          MMMMM     MMMM    MMMM   MMMMMMMM
MMMM=   MMMM   MMMMMM       MMMMM      MMMM    MMMM   MMMMMMMMM
MMMM=   MMMM     MMMMM,    NMMMMMMMM   MMMM    MMMM   MMMMMMMMMMM
MMMM=   MMMM      MMMMMM   MMMMMMMM    MMMM    MMMM   MMMM  MMMMMM
MMMM=   MMMM   MM    MMMM    MMMM      MMMM    MMMM   MMMM    MMMM
MMMM$ ,MMMMM  MMMMM  MMMM    MMM       MMMM   MMMMM   MMMM    MMMM
  MMMMMMM:      MMMMMMM     M         MMMMMMMMMMMM  MMMMMMM MMMMMMM
    MMMMMM       MMMMN     M           MMMMMMMMM      MMMM    MMMM
     MMMM          M                    MMMMMMM        M       M
       M
 ---------------------------------------------------------------
   For those about to rock... OpenWrt 19.07-SNAPSHOT, 0.7.2
 ---------------------------------------------------------------
root@AP-AX3000CV2-FACF:~# 

About

Script Python to set up password SSH for the FPT AP-AX3000CV2

Topics

Resources

License

Stars

3 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages