Skip to content

/common_page/login.html returns 404 on newer connect box versions; new REST-based API #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ShadowJonathan opened this issue Mar 3, 2025 · 1 comment

Comments

@ShadowJonathan
Copy link

ShadowJonathan commented Mar 3, 2025

I have a ziggo connect box, which after a while has stopped working properly.

Debugging it from my remote home assistant installation, I stumbled across some weird data while debugging;

In [2]: from connect_box import ConnectBox
In [3]: import aiohttp
In [4]: async def create():
   ...:     session = aiohttp.ClientSession()
   ...:     return ConnectBox(session, "[REDACTED]", "192.168.178.1")
   ...:

In [5]: import logging

In [6]: logging.basicConfig(level=logging.DEBUG)

In [7]: box = await create()

In [9]: await box.async_initialize_token()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[9], line 1
----> 1 await box.async_initialize_token()

File ~/.venv/lib/python3.12/site-packages/connect_box/__init__.py:506, in ConnectBox.async_initialize_token(self)
    504 async def async_initialize_token(self) -> None:
    505     """Get the token first."""
--> 506     await self._async_initialize_valid_token()
    507     await self._async_do_login_with_password(CMD_LOGIN)

File ~/.venv/lib/python3.12/site-packages/connect_box/__init__.py:519, in ConnectBox._async_initialize_valid_token(self)
    513     async with self._session.get(
    514         f"http://{self.host}/common_page/login.html",
    515         headers=self.headers,
    516         timeout=10,
    517     ) as response:
    518         await response.read()
--> 519         self.token = response.cookies["sessionToken"].value
    521 except (asyncio.TimeoutError, aiohttp.ClientError) as err:
    522     _LOGGER.error("Can not load login page from %s: %s", self.host, err)

KeyError: 'sessionToken'

In [10]: async with box._session.get(
    ...:                 f"http://{box.host}/common_page/login.html",
    ...:                 headers=box.headers,
    ...:                 timeout=10,
    ...:             ) as response:
    ...:                 await response.read()
    ...:                 r = response
    ...:

In [11]: r
Out[11]:
<ClientResponse(http://192.168.178.1/common_page/login.html) [404 Not Found]>
<CIMultiDictProxy('Content-Type': 'text/html', 'Content-Length': '341', 'Date': 'Mon, 03 Mar 2025 11:14:51 GMT', 'Server': 'lighttpd/1.4.63')>

It returns a 404, which I hadn't seen before.

curl confirms this, with it 404ing on the login sub-page, while it returns a whole new page on /


This is the login page i'm getting, after a spinner;

Image

In "administration", and the information section, i get the following;

Connect Box informatie
De onderstaande informatie geeft de Connect Box status weer.

Conform standaard specificaties	:	DOCSIS 3.0
Hardware versie					:	5.01
Software versie					:	LG-RDK_CH7465LG-NCIP-6.18-2406.2-NOSH
MAC-adres						:	[REDACTED]
Serienummer Connect Box			:	[REDACTED]
Beschikbaarheid					:	83day(s)7h:38m:4s
Netwerk toegang					:	Toegang tot internet
@ShadowJonathan ShadowJonathan changed the title /common_page/login.html can return 404 on newer connect box versions? /common_page/login.html can return 404 on newer connect box versions? Mar 3, 2025
@ShadowJonathan
Copy link
Author

Connectbox seems to have switched to a REST-based API, I see the following API calls;

GET  http://192.168.178.1/rest/v1/system/localization
GET  http://192.168.178.1/rest/v1/system/ui/screens
GET  http://192.168.178.1/rest/v1/system/modemmode
GET  http://192.168.178.1/rest/v1/system/firstinstall
GET  http://192.168.178.1/rest/v1/user/3/language
GET  http://192.168.178.1/rest/v1/user/login
POST http://192.168.178.1/rest/v1/user/login
GET  http://192.168.178.1/rest/v1/system/gateway/provisioning
GET  http://192.168.178.1/rest/v1/system/languages
GET  http://192.168.178.1/rest/v1/system/softwareupdate
GET  http://192.168.178.1/rest/v1/cablemodem/state_
GET  http://192.168.178.1/rest/v1/system/info
GET  http://192.168.178.1/rest/v1/network/hosts?connectedOnly=true
GET  http://192.168.178.1/rest/v1/network/ipv4/dhcp
DELETE http://192.168.178.1/rest/v1/user/3/token/[REDACTED]
GET  http://192.168.178.1/rest/v1/mta/lines
GET  http://192.168.178.1/rest/v1/wifi/band2g/state
GET  http://192.168.178.1/rest/v1/wifi/band5g/state
GET  http://192.168.178.1/rest/v1/wifi/band2g/wps/pairing/jobs
GET  http://192.168.178.1/rest/v1/wifi/band5g/wps/pairing/jobs

@ShadowJonathan ShadowJonathan changed the title /common_page/login.html can return 404 on newer connect box versions? /common_page/login.html returns 404 on newer connect box versions; new REST-based API Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant