update install and booting method

This commit is contained in:
Alfonso Gamboa 2022-04-12 21:13:18 -07:00
parent fe9e712c38
commit b63fe86438
10 changed files with 118 additions and 137 deletions

View File

@ -1,58 +1,61 @@
# wz_mini_hacks
### v3 devices ONLY
Run the latest stable ( 4.36.8.32 ) firmware on your v3 cam and have root access to the device. This is in early stages of testing, use CAUTION if you are unsure of what you are doing. No support whatsoever is offered with this release.
Run the latest stable ( 4.36.8.32 ) firmware on your v3 cam and have root access to the device. This is in early stages of testing, use CAUTION if you are unsure of what you are doing. No support whatsoever is offered with this release.
**Do not contact the manufacturer for information or support, they will not be able to assist you!**
### Related Projects:
* wz_mini_debian: run full debian in a chroot, on the v3!
* wz_mini_utils: various statically compiled binaries for use with the v3 (mipsel)
## Features
* Modifies /dev/mtd2, changes the unknown root password to WYom2020, adds a hook to /etc/init.d/rcS to run a script ( /media/mmc/run_mmc.sh ) from the micro sd card 30 seconds after the camera has booted successfully.
* Flashes the latest firmware during installation ( 4.36.8.32, as of this writing )
* Enables SSH, telnet will be disabled after installation.
* Add your own changes to run at boot into the script on the micro sd card located at /media/mmc/run_mmc.sh, mount nfs, run ping, whatever you want.
* Ability to update to the latest stable or beta firmware, this mod should survive updates ( as long as the firmware update does not change /dev/mtd2.
* Ability to block remote AND app initiated firmware updates.
* An Internet connection is required to download and patch the files required for this to work.
* Inspired by HclX and WyzeHacks, borrowed busybox and dropbearmulti from his v2 repo. Bless you for all your work! You are the master!
* Works on ANY ( tested up to 4.36.8.32 ) v3 firmware relase
* DNS Spoofing or Telnet mod are *not* required prior to installation.
* *NEW* Automated installer, put files on the micro sd card and wait for the unit to reboot.
* No modification is done to the system. **_Zero!_**
* Custom kernel loads all required files from micro-sd card
* Easy uninstall, just remove files from micro-sd card, or don't use a micro-sd card at all!
* Add your own changes to run at boot into the script on the micro sd card located at /media/mmc/run_mmc.sh, mount nfs, run ping, whatever you want
* Ability to update to the latest stable or beta firmware, this mod should survive updates as long as the bootloader remains the same
* Ability to block remote AND app initiated firmware updates
* Works on ANY ( tested up to 4.36.8.32, even RTSP ) v3 firmware release
* DNS Spoofing or Telnet mod are *not* required prior to installation
* *NEW* Automated installer, put files on the micro sd card and wait for the unit to reboot
* PAN v2 Support coming soon
* Inspired by HclX and WyzeHacks, borrowed busybox and dropbearmulti from his v2 repo. Bless you for all your work! You are the master!
## Prerequisites
* Linux
* squashfs-tools ( install with your favorite package manager )
* wget
* Person
* Computer
* Micro-SD Card is required!
## Setup
1. git clone the repo, then run ./setup.sh compile to generate the files to be copied to your SD card
1. git clone the repo or download the repo zip
2. copy all the files inside of SD_ROOT to your micro sd card
On PC:
```bash
./setup.sh compile
```
To disable automatic firmware updates, edit run_mmc.sh on your micro sd card, un-comment the lines following:
```bash
#echo "Disable remote firmware upgrade, uncomment lines below to enable"
```
If a remote or app update is initiated, the camera will reboot due to the failure of the update. The firmware update should not proceed again for some time, or at all again.
## Installation
1. Turn off the v3 camera
2. Insert the micro sd memory card into the v3 camera
3. Turn on the v3 camera
4. The installation will begin when the front led light blinks slowly between red and blue.
5. The installation will complete when the front led light blinks rapidly red and blue.
6. The camera will reboot, then you may connect via the IP address of your device using SSH, port 22. username is root password is WYom2020. It may take a few minutes for the device to finish booting and connect to wifi, then launch the SSH server. Be patient.
4. The camera will boot, then you may connect via the IP address of your device using SSH, port 22. username is root password is WYom2020. It may take a few minutes for the device to finish booting and connect to wifi, then launch the SSH server. Be patient.
## Removal
1. Delete the files you copied to the memory card. The next time you boot the camera, you will return to stock firmware.
## Customization
Edit run_mmc.sh, this is a script stored on the micro sd card that is run when the camera boots. You can change the hostname of the camera, mount NFS, add ping commands, anything you like.
To disable automatic firmware updates, edit run_mmc.sh on your micro sd card, un-comment the lines following:
```bash
#echo "Disable remote firmware upgrade, uncomment lines below to enable"
```
If a remote or app update is initiated, the camera will reboot due to the failure of the update. The firmware update should not proceed again for some time, or at all again.
## Latest Updates
* 04-12-22: Updated, custom kernel loads all required items from micro sd card. System modification no longer needed.
* 04-05-22: Update readme to indicate that telnet mod nor DNS spoofing is required for installation, and add pre-requisites section.
* 04-02-22: Update to automatic install method, remove manual install.
@ -70,8 +73,9 @@ DO NOT USE THIS SOFTWARE IF YOU ARE NOT CONFIDENT IN RESTORING YOUR DEVICE FROM
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
## Thank You
Thank you to everyone who is passionate about Wyze products for making the devices popular, and thank you to Wyze for producing them. Sign up for CamPlus, show some love to the company.
Thank you to everyone who is passionate about Wyze products for making the devices popular, and thank you to Wyze for producing them. Sign up for CamPlus, show some love and support to the company.
Thanks for HclX for WyzeHacks!
Thank you bakueikozo for his atomcam_tools repo! https://github.com/bakueikozo/atomcam_tools
Thank you to virmaior for the atomcam_tools info!
Thanks for HclX for WyzeHacks! https://github.com/HclX/WyzeHacks/
Thank you mnakada for his atomcam_tools fork! https://github.com/mnakada/atomcam_tools
Thank you bakueikozo for his atomcam_tools repo! https://github.com/bakueikozo/atomcam_tools
Thank you to virmaior for the atomcam_tools tip!

BIN
SD_ROOT/factory_t31_ZMC6tiIDQN Executable file

Binary file not shown.

BIN
SD_ROOT/wz_mini/bin/busybox Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
root:aVG8.5PMEOfnQ:0:0:99999:7:::

55
SD_ROOT/wz_mini/run_mmc.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/sh
echo "check if ethernet adapter is present"
if [[ ! -d /sys/class/net/eth* ]]; then
echo "usb ethernet not present"
if [[ ! -d /sys/class/net/usb0* ]]; then
echo "usb host not present"
else
ifconfig usb0 down
ifconfig wlan0 down
/media/mmc/busybox ip link set wlan0 address 02:01:02:03:04:08
/media/mmc/busybox ip link set wlan0 name wlanold
/media/mmc/busybox ip link set usb0 name wlan0
ifconfig wlan0 up
udhcpc -i wlan0
/media/mmc/dropbearmulti dropbear -R -m &
sleep 5
mount -o bind /media/mmc/wpa_cli.sh /bin/wpa_cli
fi
else
ifconfig eth0 down
ifconfig wlan0 down
/media/mmc/busybox ip link set wlan0 name wlanold
/media/mmc/busybox ip link set eth0 name wlan0
ifconfig wlan0 up
udhcpc -i wlan0
/media/mmc/dropbearmulti dropbear -R -m &
sleep 5
mount -o bind /media/mmc/wpa_cli.sh /bin/wpa_cli
fi
echo set hostname
hostname WCV3_spare_test
echo Store dmesg logs
dmesg > /media/mmc/wz_mini/logs/dmesg.log
echo Run dropbear ssh server
/media/mmc/wz_mini/bin/dropbearmulti dropbear -R -m
#echo Disable remote firmware upgrade, uncomment lines below to enable
#mkdir /tmp/Upgrade
#mount -t tmpfs -o size=1,nr_inodes=1 none /tmp/Upgrade
#echo -e 127.0.0.1 localhost n127.0.0.1 wyze-upgrade-service.wyzecam.com > /tmp/hosts_wz
#mount --bind /tmp/hosts_wz /etc/hosts
sleep 3
#Place commands here to run 30 seconds after boot
#such as mount nfs, ping, etc
#mount -t nfs -o nolock,rw,noatime,nodiratime 192.168.1.1:/volume1 /media/mmc/record

Binary file not shown.

24
SD_ROOT/wz_mini/v3_init.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
###
###DO NOT MODIFY UNLESS YOU KNOW WHAT YOU ARE DOING
###
echo '
__ ________ __ __ _____ _ _ _____
\ \ / |___ / | \/ |_ _| \ | |_ _|
\ \ /\ / / / / | \ / | | | | \| | | |
\ \/ \/ / / / | |\/| | | | | . ` | | |
\ /\ / / /__ | | | |_| |_| |\ |_| |_
\/ \/ /_____| |_| |_|_____|_| \_|_____|
______
|______|
'
mount -t tmpfs /tmp
cp /opt/wz_mini/etc/shadow /tmp/
mount --bind /tmp/shadow /etc/shadow
chmod 400 /etc/shadow
{ sleep 30; /media/mmc/wz_mini/run_mmc.sh > /media/mmc/wz_mini/wz_mini_hacks.log; } &
/linuxrc

BIN
Test.tar

Binary file not shown.

103
setup.sh
View File

@ -1,103 +0,0 @@
#!/bin/bash
LATEST_ROOTFS="4.36.3.19"
LATEST_FW="4.36.8.32"
clean() {
rm -rf tmp_root
rm -rf SD_ROOT
}
setup() {
echo "Create SD Card root directory"
mkdir SD_ROOT
echo "Copy test to SD_ROOT"
cp Test.tar SD_ROOT
echo "Download utilities to SD_ROOT"
wget https://www.busybox.net/downloads/binaries/1.21.1/busybox-mipsel -O SD_ROOT/busybox
echo "Copy locla utilities to SD_ROOT"
cp dropbearmulti SD_ROOT
echo "Download latest rootfs firmware $LATEST_ROOTFS"
wget https://s3-us-west-2.amazonaws.com/wuv2/upgrade/WYZE_CAKP2JFUS/firmware/$LATEST_ROOTFS.tar --directory-prefix=./tmp_root/
mkdir ./tmp_root/"$LATEST_ROOTFS"_ext
tar -xf ./tmp_root/$LATEST_ROOTFS.tar -C ./tmp_root/"$LATEST_ROOTFS"_ext
echo "Download latest stable firmware $LATEST_FW"
mkdir ./tmp_root/"$LATEST_FW"_ext
wget https://s3-us-west-2.amazonaws.com/wuv2/upgrade/WYZE_CAKP2JFUS/firmware/$LATEST_FW.tar --directory-prefix=./tmp_root/
tar -xf ./tmp_root/$LATEST_FW.tar -C ./tmp_root/"$LATEST_FW"_ext
echo "Extract rootfs, prepare for modification"
unsquashfs -d ./tmp_root/"$LATEST_ROOTFS"_ext/Upgrade/rootfs_dir ./tmp_root/"$LATEST_ROOTFS"_ext/Upgrade/rootfs
##test
mkdir ./tmp_root/"$LATEST_ROOTFS"_ext/Upgrade/rootfs_dir/.ssh
echo "Change unknown stock password to WYom2020 in /etc/shadow"
rm -rf ./tmp_root/"$LATEST_ROOTFS"_ext/Upgrade/rootfs_dir/etc/shadow
echo "root:aVG8.5PMEOfnQ:0:0:99999:7:::" > ./tmp_root/"$LATEST_ROOTFS"_ext/Upgrade/rootfs_dir/etc/shadow
chmod 400 ./tmp_root/"$LATEST_ROOTFS"_ext/Upgrade/rootfs_dir/etc/shadow
echo "Add run_mmc.sh to rootfs rcS init.d script"
sed -i '/\-f\ \/system\/init\/app_init.sh/a { sleep 30; /media/mmc/run_mmc.sh > /media/mmc/wz_mini_hacks.log; } &' ./tmp_root/"$LATEST_ROOTFS"_ext/Upgrade/rootfs_dir/etc/init.d/rcS
echo "repack rootfs for flashing"
mksquashfs ./tmp_root/"$LATEST_ROOTFS"_ext/Upgrade/rootfs_dir SD_ROOT/rootfs2.bin -noappend -all-root -comp xz
echo "copy latest appfs and kernel to SD_ROOT"
cp ./tmp_root/"$LATEST_FW"_ext/Upgrade/app SD_ROOT/appfs.bin
cp ./tmp_root/"$LATEST_FW"_ext/Upgrade/kernel SD_ROOT/kernel.bin
echo "extract run_mmc.sh script to SD_ROOT"
echo "#!/bin/sh
echo "set hostname"
hostname WCV3
echo "Store dmesg logs"
dmesg > /media/mmc/dmesg.log
#echo "Run telnetd"
#/media/mmc/busybox telnetd &
echo "Run dropbear ssh server"
/media/mmc/dropbearmulti dropbear -R -m
#echo "Disable remote firmware upgrade, uncomment lines below to enable"
#mkdir /tmp/Upgrade
#mount -t tmpfs -o size=1,nr_inodes=1 none /tmp/Upgrade
#echo -e "127.0.0.1 localhost \n127.0.0.1 wyze-upgrade-service.wyzecam.com" > /tmp/hosts_wz
#mount --bind /tmp/hosts_wz /etc/hosts
sleep 3
#Place commands here to run 30 seconds after boot
#such as mount nfs, ping, etc
#mount -t nfs -o nolock,rw,noatime,nodiratime 192.168.1.1:/volume1 /media/mmc/record
" > SD_ROOT/run_mmc.sh
chmod 755 SD_ROOT/run_mmc.sh
}
if [ "$1" == "clean" ]; then
clean
elif [ "$1" == "compile" ]; then
setup
else
echo "wz_mini_hacks setup script"
echo "Usage:"
echo "./setup.sh compile to download and patch firmware"
echo "./setup.sh clean to delete all downloaded files and clean directory"
fi