GithubHelp home page GithubHelp logo

tuya-cloudcutter / tuya-cloudcutter Goto Github PK

View Code? Open in Web Editor NEW
965.0 30.0 69.0 27.71 MB

A tool that disconnects Tuya IoT devices from the cloud, allowing them to run completely locally.

License: MIT License

Dockerfile 0.13% Python 92.13% Shell 7.74%
bk7231n bk7231t hacktoberfest tuya-convert iot

tuya-cloudcutter's Introduction

Tuya Cloudcutter

This repository contains the toolchain to exploit a wireless vulnerability that can jailbreak some of the latest smart devices built with the bk7231 chipset under various brand names by Tuya. The vulnerability as well as the exploitation tooling were identified and created by Khaled Nassar and Tom Clement with support from Jilles Groenendijk.

Our tool disconnects Tuya devices from the cloud, allowing them to run completely locally. Additionally, it can be used to flash custom firmware to devices over-the-air.

ℹ️ Do you like this tool? Please consider giving it a star on Github so it reaches more people. ✨

⚠️ WARNING⚠️

Using cloudcutter means that you will NO LONGER be able to use Tuya's apps and servers. Be absolutely sure that you are never going to use them again!

Additionally, please be aware that this software is experimental and provided without any guarantees from the authors strictly for peronal and educational use. If you will still use it, then you agree that:

  1. You understand what the software is doing
  2. You choose to use it at your own risk
  3. The authors cannot be held accountable for any damages that arise

How does it work?

If you're curious about the vulnerability and how the exploit chain works, here's the detailed writeup and the proof of concept script.

Requirements

  • A device with a stand-alone wifi adapter (but not be your primary source of networking, ethernet is preferred for that)
  • An account with sudo / elevated privlidges - An account capable of making network setting changes.
  • NetworkManager / nmcli - This is used to scan for Tuya APs, connect to them, and host a CloudCutter AP to run the exploit. If you run into issues, make sure your NetworkManager service is started. You may need to use the -r parameter if you continue to have issues.
  • Docker / Docker CLI package - This is used to create a controlled python environment to handle and run the exploit
  • An active internet connection (Somewhat optional) - This is used to download the packages to build the docker container and to download new device profiles.

Usage

Check out usage instructions for info about flashing custom firmware and local cloud-less usage (detaching). There are also some host specific instructions for setups on devices like a Raspberry Pi.

FAQ

Please see the FAQ section of the wiki for the most up-to-date questions and answers. This will cover many things like how to get your device into pairing mode, how to find more information about your device like the current firmware installed, and is expanding as new questions are asked/answered. Additionally, you may want to consider searching issues.

Patched devices

Tuya has patched their SDK as of February 2022. Any device with a firmware compiled against a patched SDK will not be exploitable, but you can still apply 3rd party firmware via serial. For a list of known patched firmware/devices, see the known patched firmware wiki page.

Contribution

We'd be happy to receive your contributions! One way to contribute if you already know your way around some binary exploitation or would like to get your hands into it is by building device profiles to support more exploitable devices. Check out the detailed writeup for the information about the vulnerability and exploit chain.

Additional work on expanding the Lightleak project, which can dump unexploited firmware, could use additional attention, as well as possibly expanding it to flash firmware, similiar to regular cloud-cutter as well. A port to bash/linux may also be useful.

Device dumps

You can also contribute device dumps by making an issue with a your device dump attached, but be aware if your device was already onboarded on your WiFi AP:

  • If you don't want your SSID and/or SSID password to be out there, then it's best to dump a device that was onboarded on a dummy AP that you don't mind leaking the parameters for. Otherwise, you may also configure it on a dummy access point a few times before dumping it. This will greatly lower the chances of accidental leakage to anyone working on the building a profile from your device flash dump, but it is never zero in this case. As a rule of thumb, it's better to dump a fresh device which has been configured with a dummy AP, but if you still want to dump one that's in use on your home AP then know that you always run the risk of leaking your SSID and password.
  • Another option, when having a device paired to SmartLife/TuyaSmart, is to open the app, click the pencil icon in the top-right corner, choose Remove Device and click Disconnect and wipe data.

Note that a dump made on a device which has been already activated on Tuya's app using any working SSID and password would simplify profile building a lot for contributors, so if possible please try to do so. Flash dumps of devices that have never been joined to Smart Life (or disconnected with a data wipe) are now generally acceptable. In order to not potentially leak personal information, that may be the preferred way.

Tools to dump flash from devices:

  • ltchiptool - universal flashing/dumping GUI tool
  • BK7231Flasher - GUI tool for firmware backup and flashing OpenBeken
  • bk7231tools - original toolset for dumping and analyzing Beken binaries
  • Lightleak - wireless dumping, still in development; testing is appreciated

Note: other tools, such as hid_download_py or BkWriter, create incomplete dumps, or have data out-of-order which makes processing more difficult. Please use the tools outlined above instead.

  • Example dump command: bk7231tools read_flash -d COM5 device-make-and-model.bin
  • Since bk7231tools v1.0.0, the -s and -c parameters are not needed (additionally, -c is deprecated in favor of -l/--length <bytes>). The program now reads the entire flash contents by default.
  • A valid dump for a standard 2M BK7231 should be 2,097,152 bytes. If your dump is any other size, it is probably incomplete!

Additionally, device profiles require a proper Datapoint ID (DPID) schema for local configuration with stock firmware. These can be pulled directly from flash on a device (config region starts at 0x1EF000 on BK7231 devices) if it has been configured to communicate with Tuya servers at least once, or through the profiler-builder scripts with the aid of an active Smart Life account. Profile builder's pull-schema.py script will walk you through the process. If you are not comfortable with this, just submit the full 2 MiB bin in an issue and a schema will be pulled and added.

Testing if a device is exploitable

If you'd like to check if a device is exploitable, one way to lower the chance of having to pry open a device that's not exploitable is testing it out with this test script. The downside to this test is that it won't tell you if the device is BK7231 based or not, since it seems that RTL87{1,2}0 devices are also exploitable but so far no work has been done to support them.

Previous work

tuya-cloudcutter's People

Contributors

blakadder avatar cossid avatar interfect avatar jhenkens avatar khalednassar avatar kuba2k2 avatar no2chem avatar notkmhn avatar openshwprojects avatar phpersson avatar pkoretic avatar rb2k avatar rspier avatar sillyfrog avatar tjclement avatar tony-fav avatar troy-f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tuya-cloudcutter's Issues

eMylo XL9251WI Smart Switch

CPU CB2S
PCB:
image

I tried to connect
VCC -> VCC,
GND -> GND,
TX -> RX1
RX -> TX1

and dump with:

pipenv run python uartprogram --unprotect -d com6 -r --startaddr 0x0 dump.bin

And also with

pipenv run python bk7231tools.py read_flash -d COM6 -s 0 -c 512 dump.bin

But to no avail, device just doesn't react, even tough it gets power and LE Dlights up. Any thougts? I guess I won't be able to dump it without disconnecting RX1 from PCB - thus, destroying the device?
I can't access CEN because I cannot hold more connects in place simultanously, but I guess it also won't work, as it's basically the same as resetting VCC/GND for a short period of time?

Some devices do not connect to any AP after exploitation

hostapd config does not specify which 802.11 (g for 2.4GHz band vs a for 5GHz band) mode to use, which may be causing it to start an AP on the 5GHz band.

Smart devices would not be able to connect to the cloudcutter AP if the AP is configured on the 5GHz band.

WB8P - LEDVANCE Smart+ WW/CW Classic A60 B27 Tunable White Light Bulb

I've attached the bin dump of one of these WB8P bulbs.
ledvance_wwcw.bin.zip

Dumped with bk7231tools
python bk7231tools.py read_flash -d /dev/tty.usbserial-0001 -s 0 -c 512 dump.bin

This is how it went:

Connected! Chip info: BK7231S_1.0.5
Flash read start address 0x0 is not greater than 0x10000 - adding 0x2000000 to bypass bootloader checks
Reading 4k page at 0X2000000 (0.00%)
Reading 4k page at 0X2001000 (0.20%)
Reading 4k page at 0X2002000 (0.39%)
...
Reading 4k page at 0X21FE000 (99.61%)
Reading 4k page at 0X21FF000 (99.80%)

I've also tried dissecting but it went like this:

~# python bk7231tools.py dissect_dump -e -O dump_extract_dir dump.bin
RBL containers:
	0x10f9a: bootloader - [encoding_algorithm=NONE, size=0xdd20] - extracted to dump_extract_dir/dump_bootloader_1.00.bin
Missing app RBL container. Using a scan pattern instead
	0x11000: app - [NO RBL, size=0x0] - written to dump_extract_dir/dump_app_pattern_scan.bin

PS. I tested it with "test_device_exploitable.py" but it did not stop the flash.

Thanks!

Dumping RTL87{1,2}0 devices

The documentation states:

The downside to this test is that it won't tell you if the device is BK7231 based or not, since it seems that RTL87{1,2}0 devices are also exploitable but so far no work has been done to support them.

I have a potentially damaged switch based on Tuya WR3E, which is RTL8710BN. Would a dump of such a device be interesting, even though it's not supported yet? If so: how to dump it? I didn't find any dumper tools yet.

BK7231N Airam Smart A60 827-865 RGB 806lm E27 OP (Light bulb)

See https://www.elektroda.com/rtvforum/viewtopic.php?p=19977811

At first boot it is blinking rapidly and only showing a bluetooth device named "TY". After being switched on/off three times it shows a Smartlife-xxxx Wifi AP. Tested "test_device_exploitable.py" which indeed stops the blinking and starts again after ~60s. Also tested the Tuya-Generic / E27-A60-RGBWW-V1 profile, but it didn't work.

Dumped with "OpenBekenIOT/hid_download_py/uartprogram"
uartprogram -r -s 0 -d /dev/ttyUSB0 -l1ef000 -u dump3.bin

dump3.zip

Actual firmware change

Has there been any progress on flashing custom firmware into exploited devices?
If I knew where to start, I'd suggest writing it as a Node-Red flow?
s

Bootloader-based exploit chain question

Hi All,

I've not had time yet to investigate an actual firmware swap using this yet.

However, something came to mind.

In the description you describe searching the code for suitable points to call to achieve various things.
The bootloader in these items is almost guaranteed to be the same for all....
Have you searched the bootloader for suitable jump points?
I'm sure there is a non-encrypted dump in the SDK... if not, my python flasher mod includes a decrypter...

br,

Simon

Dumping WB8P from Energizer EAW2-1001-SWT Bulb - Running into issues

Hey all,

I'm attempting to dump this light bulb for not only this, but another project I'm working on. I've gotten TX1 and RX1 soldered up along with GND and VCC (going to 3.3V) but cannot get this bulb to connect via using the BKWriter tool or the hid_download_py program.

I've tried both at all possible speeds, flipping around TX and RX, but nothing has worked. I always get a fail to init on the BKWriter, or "Cannot Get Bus" from the hid_download_py tool. I've tried rebooting during these processes when it is trying to connect, and nothing has worked so far.

My options for the command line are python3 uartprogram -d COM4 -s 0x0 -u -r bindump.bin along with various speeds. All of them have the same issue.

The lightbulb still responds within the app, so I know the chip is not dead.

Any ideas or suggestions?

strange SSL failure

Hi,

got my 'free' avatar ALS04 today, so now ready to try a full OTA of a unit. But it does not complete the exploit (it did on another unit, although I did not get a full log of that). Tried 'issue31' branch first (what I used last time), and then checked out main and pulled latest, and tried again.

But from RPI3, the below full log is what I end up with. Seems the exploit works, but something goes wrong at the end, when trying to set my wireless settings? It connects to 'cloudcutterflash', but ends with an odd SSL error.

Any ideas?

br,
Simon

log

Building cloudcutter docker image..
Sending build context to Docker daemon 35.65MB
Step 1/10 : FROM python:3.9-slim-buster AS base
---> 941ab71369b5
Step 2/10 : RUN apt-get -qq update && apt-get install -qy --no-install-recommends git hostapd rfkill dnsmasq build-essential libssl-dev iproute2 mosquitto
---> Using cache
---> f76e16a2edbc
Step 3/10 : FROM base AS python-deps
---> f76e16a2edbc
Step 4/10 : RUN pip install --upgrade pipenv
---> Using cache
---> 1bb2baa3e032
Step 5/10 : COPY src/Pipfile /src/
---> Using cache
---> a54e0d3b6af2
Step 6/10 : COPY src/Pipfile.lock /src/
---> Using cache
---> 53d5f0233220
Step 7/10 : RUN cd /src && PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
---> Using cache
---> 8708b12a7e91
Step 8/10 : FROM python-deps AS cloudcutter
---> 8708b12a7e91
Step 9/10 : COPY src /src
---> Using cache
---> dd7be37ee76b
Step 10/10 : WORKDIR /src
---> Using cache
---> cfa867418d90
Successfully built cfa867418d90
Successfully tagged cloudcutter:latest
Successfully built docker image
[?] Select the brand of your device: Avatar
STITCH
iHome
MartinJerry
TreatLife
CLOUDY_BAY
Feit

Avatar
PHOPOLLO
LSC
Tuya-Generic
Mlambert

[?] Select the article number of your device: ASL04-TV-BACKLIGHT

ASL04-TV-BACKLIGHT

==> Toggle Tuya device's power off and on again 6 times, with ~1 sec pauses in between, to enable AP mode. Repeat if your device's SSID doesn't show up within ~30 seconds.
Failed to start network-manager.service: Unit network-manager.service not found.
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Found access point name: "SmartLife-68C9", trying to connect..
Device 'wlan0' successfully activated with 'ccddf769-1b9e-4021-87c8-3345174246ca'.
Connected to access point.
Waiting 1 sec to allow device to set itself up..
Running initial exploit toolchain..
Exploit run, saved device config to!
output=/work/configured-devices/yZMxN30dFuRr.deviceconfig
Saved device config in /work/configured-devices/yZMxN30dFuRr.deviceconfig
==> Turn the device off and on again once. Repeat 6 more times if your device's SSID doesn't show up within ~5 seconds.
Failed to start network-manager.service: Unit network-manager.service not found.
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Found access point name: "SmartLife-68C9", trying to connect..
Error: Connection activation failed: (53) The Wi-Fi network could not be found.
Failed to start network-manager.service: Unit network-manager.service not found.
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Scanning for "(A-)|(SmartLife-)|(iHome-)|(Merkury-)|(Geeni-)|(TreatLife-SL-)|(SL-CreeLighting)" SSID...
Found access point name: "SmartLife-68C9", trying to connect..
Device 'wlan0' successfully activated with 'ccddf769-1b9e-4021-87c8-3345174246ca'.
Connected to access point.
Configured device to connect to 'cloudcutterflash'
Device is connecting to 'cloudcutterflash' access point. Passphrase for the AP is 'abcdabcd' (without ')
Cutting device off from cloud..
==> Wait for 20-30 seconds for the device to connect to 'cloudcutterflash'. This script will then show the activation requests sent by the device, and tell you whether local activation was successful.
Failed to stop network-manager.service: Unit network-manager.service not loaded.
Using WLAN adapter: wlan0
Apr 16 08:45:09 dnsmasq[16]: started, version 2.80 cachesize 150
Apr 16 08:45:09 dnsmasq[16]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Apr 16 08:45:09 dnsmasq-dhcp[16]: DHCP, IP range 10.42.42.10 -- 10.42.42.40, lease time 12h
Apr 16 08:45:09 dnsmasq-dhcp[16]: DHCP, sockets bound exclusively to interface wlan0
Apr 16 08:45:09 dnsmasq[16]: read /etc/hosts - 5 addresses
Configuration file: /dev/stdin
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr b8:27:eb:b9:38:a0 and ssid "cloudcutterflash"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
Apr 16 08:45:13 dnsmasq-dhcp[16]: 150391764 available DHCP range: 10.42.42.10 -- 10.42.42.40
Apr 16 08:45:13 dnsmasq-dhcp[16]: 150391764 client provides name: wlan0
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 DHCPDISCOVER(wlan0) d4:a6:51:43:68:c9
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 tags: wlan0
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 DHCPOFFER(wlan0) 10.42.42.20 d4:a6:51:43:68:c9
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 requested options: 1:netmask, 3:router, 28:broadcast, 6:dns-server
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 next server: 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 1 option: 53 message-type 2
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 54 server-identifier 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 51 lease-time 12h
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 58 T1 6h
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 59 T2 10h30m
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 1 netmask 255.255.255.0
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 28 broadcast 10.42.42.255
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 3 router 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 6 dns-server 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 available DHCP range: 10.42.42.10 -- 10.42.42.40
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 client provides name: wlan0
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 DHCPDISCOVER(wlan0) d4:a6:51:43:68:c9
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 tags: wlan0
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 DHCPOFFER(wlan0) 10.42.42.20 d4:a6:51:43:68:c9
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 requested options: 1:netmask, 3:router, 28:broadcast, 6:dns-server
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 next server: 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 1 option: 53 message-type 2
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 54 server-identifier 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 51 lease-time 12h
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 58 T1 6h
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 59 T2 10h30m
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 1 netmask 255.255.255.0
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 28 broadcast 10.42.42.255
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 3 router 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 6 dns-server 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 available DHCP range: 10.42.42.10 -- 10.42.42.40
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 client provides name: wlan0
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 DHCPREQUEST(wlan0) 10.42.42.20 d4:a6:51:43:68:c9
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 tags: wlan0
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 DHCPACK(wlan0) 10.42.42.20 d4:a6:51:43:68:c9 wlan0
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 requested options: 1:netmask, 3:router, 28:broadcast, 6:dns-server
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 next server: 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 1 option: 53 message-type 5
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 54 server-identifier 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 51 lease-time 12h
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 58 T1 6h
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 59 T2 10h30m
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 1 netmask 255.255.255.0
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 28 broadcast 10.42.42.255
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 3 router 10.42.42.1
Apr 16 08:45:16 dnsmasq-dhcp[16]: 150391764 sent size: 4 option: 6 dns-server 10.42.42.1
Apr 16 08:45:52 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:45:52 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 62098): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:45:53 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:45:53 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 62099): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:45:55 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:45:55 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 62100): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:45:57 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:45:57 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 62101): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
WARNING:tornado.access:404 GET /api/nouser/lights/5 (192.168.1.154) 4.24ms
Apr 16 08:45:58 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:45:58 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 62102): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:45:59 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:45:59 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 62103): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
WARNING:tornado.access:404 GET /api/nouser/lights/8 (192.168.1.154) 3.69ms
Apr 16 08:46:01 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:46:01 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 62104): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:46:02 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:46:02 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 62105): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
WARNING:tornado.access:404 GET /api/nouser/lights/9 (192.168.1.154) 3.51ms
WARNING:tornado.access:404 GET /api/nouser/lights/7 (192.168.1.154) 3.54ms
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 available DHCP range: 10.42.42.10 -- 10.42.42.40
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 client provides name: wlan0
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 DHCPDISCOVER(wlan0) d4:a6:51:43:68:c9
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 tags: wlan0
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 DHCPOFFER(wlan0) 10.42.42.20 d4:a6:51:43:68:c9
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 requested options: 1:netmask, 3:router, 28:broadcast, 6:dns-server
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 next server: 10.42.42.1
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 1 option: 53 message-type 2
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 54 server-identifier 10.42.42.1
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 51 lease-time 12h
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 58 T1 6h
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 59 T2 10h30m
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 1 netmask 255.255.255.0
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 28 broadcast 10.42.42.255
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 3 router 10.42.42.1
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 6 dns-server 10.42.42.1
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 available DHCP range: 10.42.42.10 -- 10.42.42.40
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 client provides name: wlan0
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 DHCPREQUEST(wlan0) 10.42.42.20 d4:a6:51:43:68:c9
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 tags: wlan0
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 DHCPACK(wlan0) 10.42.42.20 d4:a6:51:43:68:c9 wlan0
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 requested options: 1:netmask, 3:router, 28:broadcast, 6:dns-server
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 next server: 10.42.42.1
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 1 option: 53 message-type 5
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 54 server-identifier 10.42.42.1
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 51 lease-time 12h
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 58 T1 6h
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 59 T2 10h30m
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 1 netmask 255.255.255.0
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 28 broadcast 10.42.42.255
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 3 router 10.42.42.1
Apr 16 08:48:41 dnsmasq-dhcp[16]: 748088021 sent size: 4 option: 6 dns-server 10.42.42.1
Apr 16 08:48:42 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:48:42 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 60123): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:48:43 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:48:43 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 60124): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:48:45 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:48:45 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 60125): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:48:47 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:48:47 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 60126): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:48:48 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:48:48 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 60127): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:48:49 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:48:49 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 60128): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:48:50 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:48:50 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 60129): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:48:51 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:48:51 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 60130): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:48:52 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:48:52 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 60131): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
Apr 16 08:48:53 dnsmasq[16]: query[A] h3.iot-dns.com from 10.42.42.20
Apr 16 08:48:53 dnsmasq[16]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 02
WARNING:tornado.general:SSL Error on 12 ('10.42.42.20', 60132): [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1129)
WARNING:tornado.access:404 GET /api/nouser/lights/4 (192.168.1.154) 3.74ms
WARNING:tornado.access:404 GET /api/nouser/lights/3 (192.168.1.154) 3.51ms
WARNING:tornado.access:404 GET /api/nouser/lights/13 (192.168.1.154) 3.67ms
WARNING:tornado.access:404 GET /api/nouser/lights/14 (192.168.1.154) 3.48ms
^CTraceback (most recent call last):
File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/src/cloudcutter/main.py", line 340, in
args.handler(args)
File "/src/cloudcutter/main.py", line 160, in __configure_local_device_or_update_firmware
tornado.ioloop.IOLoop.current().start()
File "/src/.venv/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 199, in start
self.asyncio_loop.run_forever()
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 601, in run_forever
self._run_once()
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1869, in _run_once
event_list = self._selector.select(timeout)
File "/usr/local/lib/python3.9/selectors.py", line 469, in select
fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt
Oh no, something went wrong with detaching from the cloud! Try again I guess..
Failed to start network-manager.service: Unit network-manager.service not found.

WB3S - Treatlife DS03 Smart Ceiling Fan Control and Dimmer Light Switch Dump

Code responses for endpoints in cloudcutter itself

Responses for endpoints are currently saved as part of the device profile, when realistically the only thing that's needed is the profile file + the schema that's sent in the tuya.device.active response.

As an initial move towards more usable device profiles, a good first step is to move the standard endpoint responses from these files to cloudcutter itself. Further changes to the profile structure can follow over time.

For an initial implementation, the following should be done:

  • Handle all endpoint responses except for tuya.device.active in cloudcutter itself instead of through the profile folders
  • Pay attention to the tuya.device.dynamic.config.get response, it varies from T to N SDKs. One way of doing so in an agnostic fashion is just responding with one version and if the device requests the endpoint again respond with the other version.

Extra SSIDs matching "A-"

When trying to detach a TreatLife device, run_detach failed due to my neighbors' access points using "default" Spectrum SSID names containing the string "A-"

ubuntu:~/tuya-cloudcutter$ nmcli -t -f SSID dev wifi list --rescan yes | eval grep -e "A-" -e "TreatLife-SL-"  | sort -u
MySpectrumWiFiDA-2G
MySpectrumWiFiDA-5G
TreatLife-SL-8097

ubuntu:~/tuya-cloudcutter$ sudo ./run_detach.sh my_ssid 'secret' 
Scanning for "A-" -e "TreatLife-SL-" SSID... 
Found access point name: "MySpectrumWiFiDA-2G
MySpectrumWiFiDA-5G
TreatLife-SL-8097", trying to connect.. 
Error: Parameter 'MySpectrumWiFiDA-2G
MySpectrumWiFiDA-5G
TreatLife-SL-8097' is neither SSID nor BSSID.
Error: MySpectrumWiFiDA-2G
MySpectrumWiFiDA-5G
TreatLife-SL-8097 - no such connection profile.

Since I cannot turn them off, and didn't feel like moving everything to a remote location, I tried to workaround by editing ap_preambles.txt to use "^A-" instead, but I also removed the "-F" in the grep command in common.sh since it is now a regular expression. I'm sure you can think of a better fix, I just wanted to provide feedback from my admittedly corner case.

Instructions for adding new devices ?

Are there instructions for pulling a firmware dump without opening a device to be able to contribute towards the expansion of supported devices?

I've got a handful of tuya devices that don't support the conversion to tasmota, hoping that's because they're using chips that this project might support. But with tuya having already patched the exploit, time may be ticking to stock up on some devices that this will work on.

(Specifically I'm keen on normal toggle looking dimmer switches that are wifi, not zigbee or zwave, like this: 3-Way Smart WiFi Toggle Dimmer Light Switch, in-Wall, No Hub Required, Compatible with Alexa/Google Home, ETL and FCC Listed (WF31TS) https://www.amazon.com/dp/B08T1JBD9P/ref=cm_sw_r_cp_api_i_91SR38557T9HJPC4VSJK?_encoding=UTF8&psc=1)

I can't find my notes from when I took it apart but I believe it was a tuya WB2S chip, which should be compatible if I'm understand this project right!

Bulbs will loose connection after losing power for a longer period of time.

I've had a few power outages in the house. Once the bulbs are off for a few hours, they will no longer return back online and need to be re-exploited in order for them to work again. The issue with this however, is that they will get new ID's en local keys every time you do this, which makes setting up LocalTuya every time for 20+ bulbs a big hassle.

Apart from this, it's also no longer possible to get the bulbs detected in the Tuya App to register them in the cloud if i still wanted to. A warning about this would be great, because that came as a suprise when i temporarily wanted to change back to Tuya in order for them to just "work" for now until the outages are fixed.

STITCH-42266: Dump from WB8P (from 1 Pack)

WB8P: https://developer.tuya.com/en/docs/iot/wb8p-module-datasheet?id=K9fwx4f89tvzd

STITCH Bulb: https://www.monoprice.com/product?p_id=42266

Dump: STITCH-42266.zip

STITCH apparently has 3 bulbs: 42266, 42267, and 42268. The website seems to indicate the 1 pack comes with 42266, 2 pack comes with 42267, and 4 pack comes with 42268. That tracks with my experience but I cannot confirm it for the 4 pack. The unfortunate thing is that they have different firmware.

After a little bit of continuity tracing, I was able to dump this bulb without desoldering the WB8P or soldering any leads to the bulb. The only "destruction" of the bulb that was dumped was pulling off the diffuser.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.