Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import libraries
- import csv
- import requests
- from bs4 import BeautifulSoup
- URL="http://thuvientulap.org/login.aspx"
- username="user"
- password="password"
- s=requests.Session()
- r=s.get(URL)
- soup=BeautifulSoup(r.content,'html.parser')
- VIEWSTATE=soup.find(id="__VIEWSTATE")['value']
- EVENTVALIDATION=soup.find(id="__EVENTVALIDATION")['value']
- VIEWSTATEGENERATOR=soup.find(id="__VIEWSTATEGENERATOR")['value']
- login_data={"__VIEWSTATE":VIEWSTATE,
- "txt_name_login":username,
- "txt_password_ogin":password,
- "__VIEWSTATE":VIEWSTATE,
- "__EVENTVALIDATION":EVENTVALIDATION,
- "__VIEWSTATEGENERATORT":VIEWSTATEGENERATOR,
- }
- r = s.post(URL, data=login_data)
- admin_url =("http://thuvientulap.org/admin.aspx")
- r = s.get(admin_url)
- print (r.url)
- print (r.text)
- import requests
- s=requests.Session()
- url ="http://thuvientulap.org/login.aspx"
- r=s.get(url)
- dct=s.cookies.get_dict()#you will get a ASP.net cookie pass it in header
- along with other headers
- aid=dct["ASP.NETID"]*
- head = {ASP.NETID=jid,.....}*
- *check for the correct ASPid-name in request headers
- r = s.post(url, data=login_data,headers=head)
Add Comment
Please, Sign In to add comment