MatMaul / pynetgear

Python library to control Netgear wireless routers through the SOAP-api.
MIT License
236 stars 75 forks source link

Login method changed on newest firmware #99

Closed starkillerOG closed 2 years ago

starkillerOG commented 2 years ago

I just updated my Netgear R7000 from firmware version V1.0.9.88_10.2.88 to V1.0.11.130_10.2.118. Unfortunatley they removed the api on port 5000, but port 80 now seems to be used to login to the router.

However on port 80 both login method 1 and method 2 fail with:

Attempting login using login_v2
Login v2
Starting new HTTP connection (1): 192.168.1.IP:80
http://192.168.1.IP:80 "POST /soap/server_sa/ HTTP/1.1" 401 None
Invalid response
401
{'WWW-Authenticate': 'Basic realm="NETGEAR R7000"', 'x-frame-options': 'SAMEORIGIN', 'Set-Cookie': 'XSRF_TOKEN=xxxxxxxxxx; Path=/', 'Content-type': 'text/html'}
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>---</title></head>
<body onload="document.aForm.submit()"><h1>----</h1>
<p>----</p><form method="post" action="unauth.cgi?id=-----" name="aForm"></form></body>
</html>
Attempting login using login_v1
Login v1
Starting new HTTP connection (1): 192.168.1.IP:80
http://192.168.1.IP:80 "POST /soap/server_sa/ HTTP/1.1" 401 None
Invalid response
401
{'WWW-Authenticate': 'Basic realm="NETGEAR R7000"', 'x-frame-options': 'SAMEORIGIN', 'Set-Cookie': 'XSRF_TOKEN=xxxxxxxxxx; Path=/', 'Content-type': 'text/html'}
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>----</title></head>
<body onload="document.aForm.submit()"><h1>----</h1>
<p>----</p><form method="post" action="unauth.cgi?id=----" name="aForm"></form></body>
</html>

@MatMaul any help is much appriciated!!! I can run tests and can program, but have no idea how to figure out how the new login protecol works. How did you figure out the first protocol in the first place?

starkillerOG commented 2 years ago

I found the solution: use port 5555 with SSL enabled. See the discussion here: https://github.com/home-assistant/core/issues/63956