First prototype
This commit is contained in:
parent
b20212d18b
commit
2d1e778989
49
main.py
Normal file
49
main.py
Normal file
|
@ -0,0 +1,49 @@
|
|||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
username = "username"
|
||||
password = "password"
|
||||
|
||||
ses = requests.Session()
|
||||
ses.headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"
|
||||
ses.headers["Connection"] = "keep-alive"
|
||||
connection_page = ses.get("http://detectportal.firefox.com/canonical.html")
|
||||
soup = BeautifulSoup(connection_page.text, features="html.parser")
|
||||
input_challenge = soup.find("input", {"name": "challenge"})
|
||||
|
||||
challenge = input_challenge["value"]
|
||||
|
||||
"""
|
||||
POST /intercept.php HTTP/1.1
|
||||
Host: alcasar-0320002d.smile-education.fr
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0
|
||||
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
|
||||
Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
|
||||
Accept-Encoding: gzip, deflate, br
|
||||
Referer: https://alcasar-0320002d.smile-education.fr/intercept.php?res=failed&reason=reject&uamip=10.124.31.254&uamport=3990&challenge=14ede6ce0f123f55e8ef11310225fa03&called=00-15-5D-FF-2F-01&mac=30-03-C8-0F-F8-76&ip=10.124.26.117&reply=Login%20failed&nasid=alcasar-0320002d.smile-education.fr&sessionid=654a2a5d00000069&ssl=https%3a%2f%2f1.0.0.1%3a3991%2f&redirurl=&userurl=http%3a%2f%2fdetectportal.firefox.com%2fcanonical.html&md=97358BCC59AF443F0454EF5FB5F21635
|
||||
Content-Length: 162
|
||||
Origin: https://alcasar-0320002d.smile-education.fr
|
||||
Connection: keep-alive
|
||||
Upgrade-Insecure-Requests: 1
|
||||
Sec-Fetch-Dest: document
|
||||
Sec-Fetch-Mode: navigate
|
||||
Sec-Fetch-Site: same-origin
|
||||
Sec-Fetch-User: ?1
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Pragma: no-cache
|
||||
Cache-Control: no-cache"""
|
||||
|
||||
resp = ses.post("https://alcasar-0320002d.smile-education.fr/intercept.php", data=f"challenge={challenge}&userurl=http%3A%2F%2Fdetectportal.firefox.com%2Fcanonical.html&username={username}&password={password}&button=Authentification",
|
||||
allow_redirects=False, headers={"Origin": "https://alcasar-0320002d.smile-education.fr",
|
||||
"Referer": connection_page.url})
|
||||
|
||||
print(resp.text)
|
||||
redirect = resp.headers["Location"]
|
||||
|
||||
print(redirect)
|
||||
|
||||
#print(ses.get(redirect).content.decode())
|
||||
|
||||
#print(ses.get("http://alcasar-0320002d.smile-education.fr/status.php").content.decode())
|
||||
|
||||
#print(ses.get(redirect).content)
|
Loading…
Reference in a new issue