MatMaul / pynetgear

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

Authentication Fails Do To Target Machine Actively Refusing #110

Open gist901 opened 2 years ago

gist901 commented 2 years ago

Hi there,

I have run into authentication issue where I receive the following error:

Max retries exceeded with url: /soap/server_sa/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000001E25540B520>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

I am currently running pynetgear version .91. I can successfully login to my Netgear Admin console via the web browser.

I have also tried as you suggested netgear.login_try_port() and receive the error stated above for each connection attempt: login using all known port-ssl combinations failed. Out[3]: False

Here is the full error output for one of the connection attempts:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\cth\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\cth\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "C:\Users\cth\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 994, in _validate_conn
    conn.connect()
  File "C:\Users\cth\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 334, in connect
    conn = self._new_conn()
  File "C:\Users\cth\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 168, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x000001E25540B520>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
GeraldPape commented 2 years ago

on my ORBI I just need port 80, without SSL, tried that?

starkillerOG commented 2 years ago

did you try rebooting the router and then trying netgear.login_try_port()

gist901 commented 2 years ago

Yes, I have tried rebooting the router and running the following: ( I have also tried defining my host IP as well )

It looks like it does authenticate here but then I do not know why your script doesn't exit:

Starting new HTTPS connection (1): www.netgear.com:443
https://www.netgear.com:443 "GET /home/services/routerlogincom HTTP/1.1" 301 176
https://www.netgear.com:443 "GET /home/services/routerlogincom/ HTTP/1.1" 200 None

Here is the full output

netgear = Netgear(password='mypass')
netgear.login_try_port()
Starting new HTTP connection (1): routerlogin.net:80
http://routerlogin.net:80 "GET /soap/server_sa/ HTTP/1.1" 401 None
Starting new HTTP connection (1): routerlogin.net:5000
Starting new HTTPS connection (1): routerlogin.net:443
https://routerlogin.net:443 "GET /soap/server_sa/ HTTP/1.1" 302 110
Starting new HTTPS connection (1): www.netgear.com:443
https://www.netgear.com:443 "GET /home/services/routerlogincom HTTP/1.1" 301 176
https://www.netgear.com:443 "GET /home/services/routerlogincom/ HTTP/1.1" 200 None
Login v2, port '5000', ssl, 'False'
Starting new HTTPS connection (1): routerlogin.net:443
https://routerlogin.net:443 "POST /soap/server_sa/ HTTP/1.1" 403 118
Login v1, port '5000', ssl, 'False'
Starting new HTTPS connection (1): routerlogin.net:443
https://routerlogin.net:443 "POST /soap/server_sa/ HTTP/1.1" 403 118
Get Info
Login re-attempt within the login, ignoring.
Login v1, port '5555', ssl, 'True'
Starting new HTTPS connection (1): routerlogin.net:443
https://routerlogin.net:443 "POST /soap/server_sa/ HTTP/1.1" 403 118
Get Info
Login re-attempt within the login, ignoring.
Login v2, port '5555', ssl, 'True'
Starting new HTTPS connection (1): routerlogin.net:443
https://routerlogin.net:443 "POST /soap/server_sa/ HTTP/1.1" 403 118
Login v2, port '443', ssl, 'True'
Starting new HTTPS connection (1): routerlogin.net:443
https://routerlogin.net:443 "POST /soap/server_sa/ HTTP/1.1" 403 118
Login v1, port '443', ssl, 'True'
Starting new HTTPS connection (1): routerlogin.net:443
https://routerlogin.net:443 "POST /soap/server_sa/ HTTP/1.1" 403 118
Get Info
Login re-attempt within the login, ignoring.
Login v1, port '80', ssl, 'False'
Starting new HTTPS connection (1): routerlogin.net:443
https://routerlogin.net:443 "POST /soap/server_sa/ HTTP/1.1" 403 118
Get Info
Login re-attempt within the login, ignoring.
Login v2, port '80', ssl, 'False'
Starting new HTTPS connection (1): routerlogin.net:443
https://routerlogin.net:443 "POST /soap/server_sa/ HTTP/1.1" 403 118
login using all known port-ssl combinations failed.
starkillerOG commented 2 years ago

could you please also specify the host using IP and the username as well as the password while initializing the Netgear class?