Skip to content

Add UTF-8 support, Password Reset Utility and Environment Diagnostics#152

Open
rapekas wants to merge 4 commits intoopenwrt-xiaomi:mainfrom
rapekas:main
Open

Add UTF-8 support, Password Reset Utility and Environment Diagnostics#152
rapekas wants to merge 4 commits intoopenwrt-xiaomi:mainfrom
rapekas:main

Conversation

@rapekas
Copy link
Copy Markdown

@rapekas rapekas commented Feb 18, 2026

Summary

This PR adds two utilities: a root password reset script (reset_password.py) and a diagnostic test (test.py) for the XMiR Patcher environment.

Also adds UTF-8 encoding support in file read/write operations to ensure reliable handling of non-ASCII characters across different systems (fixes potential UnicodeDecodeError on non-English locales).


Changes

1. reset_password.py — Root Password Reset

Script to reset a forgotten root password via SSH or TELNET.

Behavior:

  • Tries SSH first (if a password exists in memcfg)

  • Falls back to TELNET (default password: root) when SSH is not usable

  • Sets a new root password and checks SSH access with it

  • Optional --ip flag to target a specific device IP

Usage:

./run.sh reset_password.py [new_password]

./run.sh reset_password.py --ip 192.168.31.1 new_password

Dependencies:

  • Device on the same network

  • SSH (with known password) or TELNET (telnet_en=1)


2. test.py — Environment Diagnostics

Script to verify XMiR Patcher setup, imports, config, and device reachability.

Checks:

  • [1] Imports — xmir_base, gateway, xqmodel, read_info

  • [2] Configuration — Gateway init, IP, SSH port, memcfg password

  • [3] Device discovery — Detection of Xiaomi device on the network

  • [4] Supported models — Lists known models (R3G, R3P, RM2100, R4A, WR30, etc.)

  • [5] Unsupported models — Notes that BE3600, BE2600, and other Wi‑Fi 7 (BE) devices use Qualcomm IPQ (ARM) instead of MediaTek MT7621 (MIPS), so Breed bootloader and some features are not supported

Usage:

./run.sh test.py

Testing

Both scripts use the existing gateway and xmir_base modules and are intended to run via ./run.sh.


Motivation

  • reset_password.py — Provides a simple way to recover root access when the password is lost, using SSH or TELNET.

  • test.py — Helps users quickly verify their environment and avoid common setup issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant