OK response even with the wrong password?

╄→尐↘猪︶ㄣ 提交于 2019-12-11 06:15:12

问题


I am trying to write a script that'll let me interact with my router without opening up the browser. I wrote the following script.

from bs4 import BeautifulSoup
import requests
username = input("Enter username ")
password = input("Enter Password ")

with requests.Session() as c:
    url = "http://192.168.1.2" #+url   make it dynamic later
    print(url)
    username = username
    password = password
    r = c.get(url)
    print(r)
    login_data = dict(userName=username, pcPassword=password,next='/')
    c.post(url,data=login_data, headers={"Referer": "http://www.techruse.com/"})
    page = c.get('http://192.168.1.2//userRpm/WlanStationRpm.htm')
    print(page.content)

every time I run the code and enter my correct password this is the response I get.

<Response [200]>
b'<body><script language="javaScript">window.parent.document.cookie="Authorization=;path=/";\nwindow.parent.location.href = "http://192.168.1.2";\n</script></body></html>\n'

and with the wrong password the response is exactly the same. I understand that code means The request was full filled (source : https://www.w3.org/Protocols/HTTP/HTRESP.html) either I have the wrong understanding of the term or maybe I am not authenticating at all. Can someone please explain this to me? thank you.

来源:https://stackoverflow.com/questions/43451135/ok-response-even-with-the-wrong-password

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!