fishbigger / TapoP100

A module for controlling the TP-Link Tapo P100 Plugs
MIT License
567 stars 139 forks source link

login() on L530/L510 devices does not work after firmware upgrade to V1.0.9 Build 220526 #74

Closed mundus08 closed 1 year ago

mundus08 commented 2 years ago

After a firmware upgrade on my L530/L510 devices to V1.0.9 Build 220526 the login does not work. Instead of a json doc the device responds with a “<html><body><center>200 OK</center></body></html>” message. The problem persists even after a full device reset Please find attached two network traces. The first trace with the old firmware, the second trace with the new firmware.

Host: 192.168.2.144
User-Agent: python-requests/2.28.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Cookie: TP_SESSIONID=356C284A7A37AA71A190A17086FD2075
Content-Length: 294
Content-Type: application/json

{"method": "securePassthrough", "params": {"request": "b+kvUcU6Xtpj0ZsM1BJW8XoHDxGduxxanrvIxzKsvy5tjTYZKH4+W9t1AangVD+gqsWS7fH+X/zmwAqM7JA3JE9ZaG0Kc+zc6BSGOR/cStc63zSyYi43ji06zVLWnRDm5ei037XJ7BoFYQcNpgbI+hN6Di8clbROEs1eH4kImxhbuOsR+7kY436mVKjbdy7uRKUuK999Usmghj02YQHNdx1d6neoRDGwVwobzvIXyt0="}}

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Server: SHIP 2.0
Content-Length: 149

{"error_code":0,"result":{"response":"9gAdTZym8QKCecP1VeZRY3hYqnTgjVo2vsgxXb+U2ReyPeLIeLMgd8pjRHC8yQHZwcoqGHYO9EaZp4ISpcCKrfgf+IYFlAPfJrA6wgnnIuw="}}

----------

Host: 192.168.2.144
User-Agent: python-requests/2.28.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Cookie: TP_SESSIONID=50C060108D186B23D576E826BBDA6D27;
Content-Length: 294
Content-Type: application/json

{"method": "securePassthrough", "params": {"request": "As+K5sk9Eyy0om9K+/MroCZk17EM4UN656gwlgj8BNjrWnD13k6gD0bp8l9XLa0o7jdDWTsL7oitqkCyveiwAwh+GjouWGdK8onDnzIeI6TOpEa5H3vK5kto58YFmklH2pZJjZocI/3WtLJ3yZklJZWoR2Rli4ToI+hkbJ/3A9ACiKRq4tUUiOF959lgAYNsOnAHtc1JFJPlWz8//quczC1E176VLXsacmqg1Yty6jg="}}

HTTP/1.1 200 OK
Server: SHIP 2.0
Content-Length: 49
Content-Type: text/html

<html><body><center>200 OK</center></body></html>

Error message
Traceback (most recent call last):
  File "/home/conda/miniconda3/envs/tp-tapo/lib/python3.9/site-packages/requests/models.py", line 972, in json
    return complexjson.loads(self.text, **kwargs)
  File "/home/conda/miniconda3/envs/tp-tapo/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/home/conda/miniconda3/envs/tp-tapo/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/conda/miniconda3/envs/tp-tapo/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/conda/ws/play/test/./tapo-t11.py", line 30, in <module>
    xx.login()
  File "/home/conda/miniconda3/envs/tp-tapo/lib/python3.9/site-packages/PyP100/PyP100.py", line 160, in login
    decryptedResponse = self.tpLinkCipher.decrypt(r.json()["result"]["response"])
  File "/home/conda/miniconda3/envs/tp-tapo/lib/python3.9/site-packages/requests/models.py", line 976, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
tnmendes commented 2 years ago

Can this be related to the new Two-Factor Authentication (2FA)?