Skip to content

Commit 61ba060

Browse files
authored
Release v2.4.5
2 parents 94acc3b + 0bb2369 commit 61ba060

File tree

8 files changed

+168
-7
lines changed

8 files changed

+168
-7
lines changed

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ These scripts were tested in
3333
* a Raspberry Pi 3B / 3B+ / 4B with Raspbian Stretch and its internal Wifi chip
3434
* a Raspberry Pi 3B / 3B+ Raspberry Pi OS Buster (previously called Raspbian) and its internal Wifi chip
3535
* a Raspberry Pi 3B+ + USB-WIFI with an image from [here](https://www.offensive-security.com/kali-linux-arm-images/)
36-
* Ubuntu 18.04.3 64Bit in VirtualBox on Win10 with a [cheap RTL8188CU Wifi Adapter](http://s.click.aliexpress.com/e/KrKIoPdI) connected to the VM
36+
* Ubuntu 18.04.3 64Bit in VirtualBox on Win10 with a cheap RTL8188CU Wifi Adapter connected to the VM
3737

3838
Any Linux with a Wifi adapter which can act as an Access Point should also work. Please note that we have tested the Raspberry Pi with clean installations only. If you use your Raspberry Pi for anything else, we recommend using another SD card with a clean installation.
3939

4040
## PROCEDURE
4141

42-
On January 28th, 2019, Tuya started [distributing a patch](https://www.heise.de/newsticker/meldung/Smart-Home-Hack-Tuya-veroeffentlicht-Sicherheitsupdate-4292028.html) that prevented older versions of tuya-convert from completing successfully. We have since developed a work around to enable OTA flashing once again, but there is always the possibility that Tuya will respond with yet another patch. To ensure the best chance of success, **do not connect your device with the official app** as it may automatically update the device, preventing you from flashing with tuya-convert. It is up to the individual brands to update their firmware, so some devices may be affected sooner than others.
42+
On January 28th, 2019, Tuya started [distributing a patch](https://www.heise.de/newsticker/meldung/Smart-Home-Hack-Tuya-veroeffentlicht-Sicherheitsupdate-4292028.html) that prevented older versions of tuya-convert from completing successfully. We have since developed a work around to enable OTA flashing on some newer devices, but Tuya has since released [yet another patch](https://github.com/ct-Open-Source/tuya-convert/issues/483).
43+
44+
To ensure the best chance of success, **do not connect your device with the official app** as it may automatically update the device, preventing you from flashing with tuya-convert. It is up to the individual brands to update their firmware, so some devices may be affected sooner than others.
45+
46+
Unfortunately many devices have already been shipping with the new patched firmware, evident by a PSK ID beginning with 02 in smarthack-psk.log. There is no workaround at this time. Additionally, manufacturers have been silently switching from the ESP82xx based modules to other chipsets, making it impossible to install alternative ESP firmware on these devices.
4347

4448
### INSTALLATION
4549
# git clone https://github.com/ct-Open-Source/tuya-convert
@@ -50,7 +54,7 @@ On January 28th, 2019, Tuya started [distributing a patch](https://www.heise.de/
5054
BE SURE THE FIRMWARE FITS YOUR DEVICE!
5155
1. Place your binary file in the `/files/` directory or use one of the included firmware images.
5256

53-
Currently a [Tasmota](https://github.com/arendst/Tasmota) `tasmota-wifiman.bin` build is included in the Tuya-Convert package. You can easily update to the [current maintenance release](http://thehackbox.org/tasmota) via OTA **after** the flashing process completes successfully. The included binary does not have any specific hardware configured. Once flashed using Tuya-Convert you will need to configure your device(s) properly. Please note that while we include this firmware for your convenience, we are not affiliated with the Tasmota project and cannot provide support for post installation issues. Please refer to the [Tasmota project](https://github.com/arendst/Tasmota) and [its documentation](http://tasmota.com) for configuration and support. **IMPORTANT:** If you still want to update the tasmota binary before using Tuya-Convert, always pickup `tasmota-wifiman.bin`. Never ever use `tasmota-minimal.bin` as you will brick your device.
57+
Currently a [Tasmota](https://github.com/arendst/Tasmota) `tasmota-lite.bin` build is included in the Tuya-Convert package. You can easily update to the [current maintenance release](http://thehackbox.org/tasmota) via OTA **after** the flashing process completes successfully. The included binary does not have any specific hardware configured. Once flashed using Tuya-Convert you will need to configure your device(s) properly. Please note that while we include this firmware for your convenience, we are not affiliated with the Tasmota project and cannot provide support for post installation issues. Please refer to the [Tasmota project](https://github.com/arendst/Tasmota) and [its documentation](http://tasmota.com) for configuration and support. **IMPORTANT:** If you still want to update the tasmota binary before using Tuya-Convert, always pickup `tasmota-lite.bin`. **Never ever** use `tasmota-minimal.bin` as you will brick your device.
5458

5559
An ESPurna [1.13.5](https://github.com/xoseperez/espurna/releases/tag/1.13.5) binary is also included (`espurna-base.bin`). Like before, the binary included does not have any specific hardware defined. Once flashed using Tuya-Convert you can update to the device-specific version via any of the means that ESPurna provides (OTA, web interface update, update via telnet or MQTT). Please refer to the [ESPurna project page](http://espurna.io) for more info and support.
5660

files/tasmota.bin

23.6 KB
Binary file not shown.

install_prereq.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
sudo apt-get update
6-
sudo apt-get install -y git iw dnsmasq hostapd screen curl build-essential python3-pip python3-setuptools python3-wheel python3-dev mosquitto haveged net-tools libssl-dev
6+
sudo apt-get install -y git iw dnsmasq rfkill hostapd screen curl build-essential python3-pip python3-setuptools python3-wheel python3-dev mosquitto haveged net-tools libssl-dev
77

88
sudo -H python3 -m pip install --upgrade paho-mqtt tornado git+https://github.com/drbild/sslpsk.git pycryptodomex
99

scripts/dr_tuya.sh

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
NON_ESP_WARNING="WARNING: it appears this device does not use an ESP82xx and therefore cannot install ESP based firmware"
4+
5+
get_macs_from_wifi_log () {
6+
grep AP-STA-CONNECTED smarthack-wifi.log |
7+
cut -d ' ' -f3 |
8+
sort | uniq
9+
}
10+
11+
get_ouis_from_wifi_log () {
12+
get_macs_from_wifi_log |
13+
tr -d : | grep -Po "^.{6}"
14+
}
15+
16+
psk_02 () {
17+
grep -q "ID: 02" smarthack-psk.log
18+
}
19+
20+
web_non_esp () {
21+
grep -q "$NON_ESP_WARNING" smarthack-web.log
22+
}
23+
24+
udp_non_esp () {
25+
grep -q "$NON_ESP_WARNING" smarthack-udp.log
26+
}
27+
28+
esp_oui () {
29+
get_ouis_from_wifi_log | grep -iqf- oui/esp.txt
30+
}
31+
32+
non_esp_oui () {
33+
get_ouis_from_wifi_log | grep -iqf- oui/nonesp.txt
34+
}
35+
36+
check_for_common_issues () {
37+
if psk_02; then
38+
echo "Your device's firmware is too new."
39+
echo "Tuya patched the PSK vulnerability that we use to establish a connection."
40+
echo "You might still be able to flash this device over serial."
41+
echo "For more information and to follow progress on solving this issue see:"
42+
echo "https://github.com/ct-Open-Source/tuya-convert/wiki/Collaboration-document-for-PSK-Identity-02"
43+
exit 1
44+
fi
45+
if web_non_esp || udp_non_esp || non_esp_oui; then
46+
echo "Your device does not use an ESP82xx."
47+
echo "This means you cannot flash custom ESP firmware even over serial."
48+
exit 1
49+
fi
50+
if esp_oui; then
51+
echo "An ESP82xx based device connected according to your wifi log."
52+
echo "If this is the device you are trying to flash, another issue may be preventing it from flashing."
53+
echo "Otherwise, it could be that the device does not use an ESP82xx or it did not connect."
54+
else
55+
echo "No ESP82xx based devices connected according to your wifi log."
56+
echo "Here is a list of all the MAC addresses that connected:"
57+
get_macs_from_wifi_log
58+
echo
59+
echo "If you see your IoT device in this list, it is not an ESP82xx based device."
60+
echo "Otherwise, another issue may be preventing it from connecting."
61+
fi
62+
echo "For additional information, check the *.log files inside the scripts folder."
63+
echo "Please include these logs when opening a new issue on our GitHub issue tracker."
64+
}
65+
66+
check_for_common_issues
67+

scripts/oui/esp.txt

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# "Espressif Inc." OUIs
2+
# updated Jan 26 2021
3+
083AF2
4+
0CDC7E
5+
10521C
6+
18FE34
7+
240AC4
8+
2462AB
9+
246F28
10+
24A160
11+
24B2DE
12+
2C3AE8
13+
2CF432
14+
30AEA4
15+
3C6105
16+
3C71BF
17+
40F520
18+
483FDA
19+
4C11AE
20+
4C7525
21+
500291
22+
545AA6
23+
5CCF7F
24+
600194
25+
6055F9
26+
68C63A
27+
70039F
28+
7C9EBD
29+
7CDFA1
30+
807D3A
31+
840D8E
32+
84CCA8
33+
84F3EB
34+
8CAAB5
35+
8CCE4E
36+
9097D5
37+
943CC6
38+
94B97E
39+
98CDAC
40+
98F4AB
41+
9C9C1F
42+
A020A6
43+
A0764E
44+
A47B9D
45+
A4CF12
46+
A4E57C
47+
A8032A
48+
AC67B2
49+
ACD074
50+
B4E62D
51+
B8F009
52+
BCDDC2
53+
BCFF4D
54+
C44F33
55+
C45BBE
56+
C4DD57
57+
C82B96
58+
CC50E3
59+
D8A01D
60+
D8BFC0
61+
D8F15B
62+
DC4F22
63+
E09806
64+
E0E2E6
65+
E868E7
66+
E8DB84
67+
ECFABC
68+
F008D1
69+
F4CFA2
70+
FCF5C4

scripts/oui/nonesp.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Known unsupported OUIs including
2+
# "Tuya (HK) Limietd"
3+
# "Tuya Smart Inc."
4+
# "Beijing Winner Microelectronics Ltd"
5+
# updated Jan 26 2021
6+
000D8A
7+
000F89
8+
10D561
9+
1869D8
10+
286DCD
11+
68572D
12+
708976
13+
807484
14+
84E342
15+
D4A651
16+
DC446D
17+
E078A3

scripts/setup_ap.sh

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ setup () {
4242
--interface=$WLAN \
4343
--bind-interfaces \
4444
--listen-address=$GATEWAY \
45+
--except-interface=lo \
4546
--dhcp-range=10.42.42.10,10.42.42.40,12h \
4647
--address=/#/$GATEWAY
4748

start_flash.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@ while true; do
7979
printf .
8080
if (( --i == 0 )); then
8181
echo
82-
echo "Device did not appear with the intermediate firmware"
83-
echo "Check the *.log files in the scripts folder"
82+
echo "Timed out while waiting for the device to (re)connect"
8483
pkill -f smartconfig/main.py && echo "Stopping smart config"
84+
echo "======================================================"
85+
echo "Attempting to diagnose the issue..."
86+
./dr_tuya.sh
87+
echo "======================================================"
8588
read -p "Do you want to try flashing another device? [y/N] " -n 1 -r
8689
echo
8790
[[ "$REPLY" =~ ^[Yy]$ ]] || break 2
@@ -133,4 +136,3 @@ while true; do
133136
echo
134137
[[ "$REPLY" =~ ^[Yy]$ ]] || break
135138
done
136-

0 commit comments

Comments
 (0)