AlexandrErohin / TP-Link-Archer-C6U

Python package for API access and management for TP-Link Routers. See supported routers list
GNU General Public License v3.0
43 stars 14 forks source link

Test with archer C80 #7

Closed jlguibourg closed 5 months ago

jlguibourg commented 8 months ago

It is not working with Archer C80 firmware 1.13.2 There are no error messages

May be related to the fact that C80 doesn’t have username, it only prompts for password

AlexandrErohin commented 8 months ago

What error you got in the SETUP window? What errors in Settings -> System -> Logs?

jlguibourg commented 8 months ago

Hello

I don’t use windows but xubuntu 18.4 with python 3.11.4

The C80 is a the latest version.

I don’t have any error even with a wrong password or wrong IP address (just take more time with wrong IP address).

My script is as follow

from tplinkrouterc6u.client import TplinkRouter

from tplinkrouterc6u.enum import Wifi

from tplinkrouterc6u.dataclass import Firmware, Status, Device

router = TplinkRouter('http://192.168.171.203', 'mypassword')

print(router)

print("on est la")

Get firmware info - returns Firmware

firmware = router.get_firmware()

print(firmware)

Get status info - returns Status

status = router.get_status()

print(status)

The result is always

<tplinkrouterc6u.client.TplinkRouter object at 0xb79a8df0> on est la None None

I don’t have experience with python and I don’t know how to debug.

There is no user name with C80 , see picture attached.

The alternative is with TP-link ID which is a mail address (I tried it too).

Regards

De : AlexandrErohin @. Envoyé : lundi 15 janvier 2024 07:48 À : AlexandrErohin/TP-Link-Archer-C6U @.> Cc : jlguibourg @.>; Author @.> Objet : Re: [AlexandrErohin/TP-Link-Archer-C6U] Test with archer C80 (Issue #7)

What error you got in the SETUP window? What errors in Settings -> System -> Logs?

— Reply to this email directly, view it on GitHub https://github.com/AlexandrErohin/TP-Link-Archer-C6U/issues/7#issuecomment-1891403769 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ALRL2ULQ5CNOPTIZ2GVUUNTYOTGIFAVCNFSM6AAAAABBZIIAUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJRGQYDGNZWHE . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ALRL2UPHLZHOYOZ36OGMNE3YOTGIFA5CNFSM6AAAAABBZIIAUCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTQXSD7S.gif Message ID: @. @.> >

AlexandrErohin commented 8 months ago

to print logs - you need to pass 4th parameter TplinkRouter('http://192.168.0.1','password','admin2', _LOGGER)

jlguibourg commented 8 months ago

I don’t know what to put for _LOGGER

router = TplinkRouter('http://192.168.171.203', ‘mypassword', 'admin2', 'log.txt')

I tried with log.txt and get the following result

python3.11 examples.py

<tplinkrouterc6u.client.TplinkRouter object at 0xb794ee10>

on est la

Traceback (most recent call last):

File "/home/xubuntu/.local/lib/python3.11/site-packages/requests/models.py", line 971, in json

return complexjson.loads(self.text, **kwargs)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/json/init.py", line 346, in loads

return _default_decoder.decode(s)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/json/decoder.py", line 340, in decode

raise JSONDecodeError("Extra data", s, end)

json.decoder.JSONDecodeError: Extra data: line 1 column 2 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/home/xubuntu/Scripts/TP-Link-Archer-C6U-main/tplinkrouterc6u/client.py", line 174, in _request_pwd

data = response.json()

       ^^^^^^^^^^^^^^^

File "/home/xubuntu/.local/lib/python3.11/site-packages/requests/models.py", line 975, in json

raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

requests.exceptions.JSONDecodeError: Extra data: line 1 column 2 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/home/xubuntu/Scripts/TP-Link-Archer-C6U-main/tplinkrouterc6u/client.py", line 243, in _request

if self.authorize():

   ^^^^^^^^^^^^^^^^

File "/home/xubuntu/Scripts/TP-Link-Archer-C6U-main/tplinkrouterc6u/client.py", line 73, in authorize

self._request_pwd(referer)

File "/home/xubuntu/Scripts/TP-Link-Archer-C6U-main/tplinkrouterc6u/client.py", line 182, in _request_pwd

self._logger.error('TplinkRouter Integration Exception - No pwd response - {}'.format(response.text))

^^^^^^^^^^^^^^^^^^

AttributeError: 'str' object has no attribute 'error'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/home/xubuntu/Scripts/TP-Link-Archer-C6U-main/examples.py", line 22, in

firmware = router.get_firmware()

           ^^^^^^^^^^^^^^^^^^^^^

File "/home/xubuntu/Scripts/TP-Link-Archer-C6U-main/tplinkrouterc6u/client.py", line 41, in get_firmware

return self._request(self._get_firmware)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/xubuntu/Scripts/TP-Link-Archer-C6U-main/tplinkrouterc6u/client.py", line 251, in _request

self._logger.error('TplinkRouter Integration Exception - {}'.format(error))

^^^^^^^^^^^^^^^^^^

AttributeError: 'str' object has no attribute 'error'

@.***:~/Scripts/TP-Link-Archer-C6U-main$ ^C

@.***:~/Scripts/TP-Link-Archer-C6U-main$

De : AlexandrErohin @. Envoyé : lundi 15 janvier 2024 10:38 À : AlexandrErohin/TP-Link-Archer-C6U @.> Cc : jlguibourg @.>; Author @.> Objet : Re: [AlexandrErohin/TP-Link-Archer-C6U] Test with archer C80 (Issue #7)

to print logs - you need to pass 4th parameter TplinkRouter('http://192.168.0.1','password','admin2', _LOGGER)

— Reply to this email directly, view it on GitHub https://github.com/AlexandrErohin/TP-Link-Archer-C6U/issues/7#issuecomment-1891700438 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ALRL2UP5V3PFY2LD2ZNRLZLYOT2IZAVCNFSM6AAAAABBZIIAUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJRG4YDANBTHA . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ALRL2UJKDGK5XH74KKDZYX3YOT2IZA5CNFSM6AAAAABBZIIAUCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTQYEHNM.gif Message ID: @. @.> >

AlexandrErohin commented 8 months ago

from logging import Logger

jlguibourg commented 8 months ago

Sorry but I don’t understand what you mean with : from logging import Logger

@.***:~/Scripts/TP-Link-Archer-C6U-main$ python3.11 examples.py

Traceback (most recent call last):

File "/home/xubuntu/Scripts/TP-Link-Archer-C6U-main/examples.py", line 12, in

router = TplinkRouter('http://192.168.171.203', 'mypassword', 'admin2', _LOGGER)

                                                                       ^^^^^^^

NameError: name '_LOGGER' is not defined

AlexandrErohin commented 8 months ago

from tplinkrouterc6u import TplinkRouter from logging import Logger

client = TplinkRouter('http://192.168.171.203', 'mypassword', logger=Logger('test'))

print(client.get_status())

jlguibourg commented 8 months ago

Here it is with

from tplinkrouterc6u.client import TplinkRouter

from tplinkrouterc6u.client import Logger

from tplinkrouterc6u.enum import Wifi

from tplinkrouterc6u.dataclass import Firmware, Status, Device

client = TplinkRouter('http://192.168.171.203', 'mypassword', logger=Logger('test'))

print(client.get_status())

Result :

TplinkRouter Integration Exception - No pwd response - 00005

TplinkRouter Integration Exception - Unsupported router!

None

AlexandrErohin commented 8 months ago

So your router is not supported. It would be great if you could add support for your router to this client.

jlguibourg commented 8 months ago

Yes sure, I would like.

What is way to do it ?

jlguibourg commented 8 months ago

How to add support for Archer C80 ? Who could do it? Thanks for your help

AlexandrErohin commented 8 months ago

As I dont have Archer C80, I cannot add support for this. If you want to add support for your router you need to trace requests from browser to your router and reconstruct them in python code

jlguibourg commented 8 months ago

Would you be interested if I give you a remote access to my Archer C80?

AlexandrErohin commented 7 months ago

@jlguibourg Please try new version - As TP-link Archer C1200 v2.0 support with different login process was added - your router may also be supported now

To try client you need to get WebEncryptedPassword, please follow this instructions https://github.com/AlexandrErohin/TP-Link-Archer-C6U?tab=readme-ov-file#web-encrypted-password

from tplinkrouterc6u import TplinkRouterProvider
from logging import Logger

client = TplinkRouterProvider.get_client('192.168.0.1', 'WebEncryptedPassword', logger=Logger('test'))
firmware, status = client.get_full_info()

print(firmware.model)
print(firmware.hardware_version)
print(firmware.firmware_version)
print(status.lan_macaddr)
jlguibourg commented 7 months ago

I get a problem with the WebEncryptedPassword

document.getElementById("login-password").value; Uncaught TypeError: document.getElementById(...) is null

debugger eval code:1
AlexandrErohin commented 7 months ago

Could you try this steps to get WebEncryptedPassword?

  1. Open the browser and go to the webinterface of you TP-link router and open the developertools(ctrl+shift+i or F12).
  2. In the developertools navigate to the network tab.
  3. Make sure the recoder is enabeld.
  4. Login to your router
  5. There should appear activity in the networking tab.
  6. Scroll up until you find something like "login?form=login" and click it.
  7. Click payload, and copy the string of characters, it should be a long string.
  8. This is the web encrypted password.
jlguibourg commented 7 months ago

There is nothing such as "login?form=login"

Everything are scripts see below

See what I have if I enter a wrong password

AlexandrErohin commented 7 months ago

Lets try to add support for your router - https://github.com/AlexandrErohin/TP-Link-Archer-C6U/blob/main/CONTRIBUTING.md

jlguibourg commented 7 months ago

Just did it, Let me know if this is what you need.

I only did displays but if you are ok with the capture data, I can do more

De : AlexandrErohin @. Envoyé : mardi 13 février 2024 20:17 À : AlexandrErohin/TP-Link-Archer-C6U @.> Cc : jlguibourg @.>; Mention @.> Objet : Re: [AlexandrErohin/TP-Link-Archer-C6U] Test with archer C80 (Issue #7)

Lets try to add support for your router - https://github.com/AlexandrErohin/TP-Link-Archer-C6U/blob/main/CONTRIBUTING.md

— Reply to this email directly, view it on GitHub https://github.com/AlexandrErohin/TP-Link-Archer-C6U/issues/7#issuecomment-1942219615 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ALRL2UOGKN72KFNYETU2KPDYTO32JAVCNFSM6AAAAABBZIIAUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBSGIYTSNRRGU . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ALRL2UPINWRTG6CU7EK2R5LYTO32JA5CNFSM6AAAAABBZIIAUCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTTYPVV6.gif Message ID: @. @.> >

AlexandrErohin commented 5 months ago

Duplicate of https://github.com/AlexandrErohin/TP-Link-Archer-C6U/issues/11