softScheck / tplink-smartplug

TP-Link WiFi SmartPlug Client and Wireshark Dissector
Apache License 2.0
1.14k stars 295 forks source link

Cannot get working with smartPlug_CE_HS100(AU)_HS110(AU) #22

Open mamejay opened 7 years ago

mamejay commented 7 years ago

Hello everyone. I have been trying to get this working with an australian version hs100 model Hardware is version 2 and firmware installed is smartPlug_CE_HS100(AU)_HS110(AU)_1.1.3_Build_170120_Rel.171906.bin Checking the firmware sizes from know working models shows it is only 513kb where the woeking models are about 3mb. Is it possible to check the firmware for the au model and see if there are differences in the command set? I have basic knowledge of wireshark and linux so hoping some smarter people can assist.

uwwint commented 7 years ago

Update encrypt with the following:

def encrypt(self, string):
                key = 171
                result = "\0\0\0"+chr(len(string))
                for i in string:
                        a = key ^ ord(i)
                        key = a
                        result += chr(a)
                return result

works with HS100(AU) HW:2.0 SW:1.0.10

rct commented 7 years ago

I have a couple of HS100/HS110 (US) modules. The code with and without the above patch to encrypt seems to work fine with those modules. However I have a new mini plug HS105 (US), HW version 1.0, firmware versino 1.2.9 that doesn't seem to respond with or without this patch. I don't know if I'm just missing something or there is some other difference for this.

So I think it's worth merging the PR for this patch. I'll probably open up a separate issue for the HS105.

jneilliii commented 7 years ago

That modification was already merged into my plugin to get the au versions working. If you find out a way to get your version to work let me know.

kchiem commented 6 years ago

result = pack('>I', len(string))

rct commented 6 years ago

@kchiem - Thank you, that works with both my new HS105(US) and older HS100's.

Note: An import struct is needed. Pack is in the struct module.

jneilliii commented 6 years ago

Thanks @kchiem , I've updated my plugin in the dev branch and am awaiting confirmation for the HS105. It does still seem to work fine for my HS100 plugs.

jpap commented 6 years ago

I had to use this patch to get the script working with my HS100(US), hardware version 2.0 firmware version 1.2.9.

xaviervilla commented 6 years ago

Using @uwwint's suggestion, all I changed was this line: result = "\0\0\0"+chr(len(string)) and It started working after that, I'm using tplink hs100 (US). Thanks for the suggestion.