r2350 icon indicating copy to clipboard operation
r2350 copied to clipboard

Additional patches

Open markkey014 opened this issue 1 year ago • 5 comments

Not an issue actually, but was wondering if its possible to add the generic patches from https://github.com/geekman/xqrepack I tried to apply the patches from that repo manually via SSH and can confirm that it does work. If not possible, would you be so kind to provide a guide on how I can unpack the r2350 firmware since the ubi_reader that geekman used doesn't seem to work with r2350 firmware?

markkey014 avatar May 22 '23 22:05 markkey014

Which patch from xqrepack do you want to apply? I think all the necessary patches are already here. I used binwalk, squashfs-tools, and dd to unpack/pack the firmware.

eisaev avatar Sep 20 '23 10:09 eisaev

This is what I tested.

mark web footer so that users can confirm the right version has been flashed

sed -i 's/romVersion%>/& xqrepack/;' "$FSDIR/usr/lib/lua/luci/view/web/inc/footer.htm"

stop resetting root password

sed -i '/set_user(/a return 0' "$FSDIR/etc/init.d/system" sed -i 's/flg_init_pwd=.*/flg_init_pwd=0/' "$FSDIR/etc/init.d/boot_check"

make sure our backdoors are always enabled by default

sed -i '/ssh_en/d;' "$FSDIR/usr/share/xiaoqiang/xiaoqiang-reserved.txt" sed -i '/ssh_en=/d; /uart_en=/d; /boot_wait=/d;' "$FSDIR/usr/share/xiaoqiang/xiaoqiang-defaults.txt" cat <<XQDEF >> "$FSDIR/usr/share/xiaoqiang/xiaoqiang-defaults.txt" uart_en=1 ssh_en=1 boot_wait=on XQDEF

always reset our access nvram variables

grep -q -w enable_dev_access "$FSDIR/lib/preinit/31_restore_nvram" ||
cat <<NVRAM >> "$FSDIR/lib/preinit/31_restore_nvram" enable_dev_access() { nvram set uart_en=1 nvram set ssh_en=1 nvram set boot_wait=on nvram commit }

boot_hook_add preinit_main enable_dev_access NVRAM

modify root password

sed -i "s@root:[^:]*@root:${ROOTPW}@" "$FSDIR/etc/shadow"

stop phone-home in web UI

cat <<JS >> "$FSDIR/www/js/miwifi-monitor.js" (function(){ if (typeof window.MIWIFI_MONITOR !== "undefined") window.MIWIFI_MONITOR.log = function(a,b) {}; })(); JS

dont start crap services

for SVC in stat_points statisticsservice
datacenter
smartcontroller
plugincenter plugin_start_script.sh cp_preinstall_plugins.sh; do rm -f $FSDIR/etc/rc.d/[SK]*$SVC done

prevent stats phone home & auto-update

for f in StatPoints mtd_crash_log logupload.lua otapredownload wanip_check.sh; do > $FSDIR/usr/sbin/$f; done

rm -f $FSDIR/etc/hotplug.d/iface/*wanip_check

for f in wan_check messagingagent.sh; do sed -i '/start_service(/a return 0' $FSDIR/etc/init.d/$f done

cron jobs are mostly non-OpenWRT stuff

for f in $FSDIR/etc/crontabs/*; do sed -i 's/^/#/' $f done

as a last-ditch effort, change the *.miwifi.com hostnames to localhost

sed -i 's@\w+.miwifi.com@localhost@g' $FSDIR/etc/config/miwifi

markkey014 avatar Sep 20 '23 14:09 markkey014

mark web footer so that users can confirm the right version has been flashed

Version information already displayed in the web UI

stop resetting root password

Looks useful

make sure our backdoors are always enabled by default

This values is already permanent

always reset our access nvram variables

Not required (see previous item)

modify root password

It can't be added to the firmware because users want to have different passwords :)

stop phone-home in web UI dont start crap services prevent stats phone home & auto-update cron jobs are mostly non-OpenWRT stuff as a last-ditch effort, change the *.miwifi.com hostnames to localhost

Can't be added to the firmware because these changes should break work of Xiaomi MiWiFi app.

eisaev avatar Sep 20 '23 16:09 eisaev

Added scripts for repacking the firmware

Thanks a lot. Will try this when I've got a free time.

markkey014 avatar Sep 20 '23 22:09 markkey014