我正在尝试使用python登录网页,,,当发送post请求时,我看到在请求主体中发送了4个参数(使用burp套件(:(username、password、logintoken、anchor(我得到了前3个,但当试图获得"锚"的值时,我看到了:
输入id=";"锚";type=";隐藏的";name=";"锚";值="scrpt>document.getElementById('nchor'(.value=location.hash<scrpt
所以它的值是JS=location.hash我如何提取它并将其与POST请求一起发送?
这里是网站:[https://elearning.yu.edu.jo/]
完整代码:
import requests
from bs4 import BeautifulSoup as bb
url = "https://84.16.252.74/login/index.php"
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69'}
s = requests.Session()
y = s.get(url, headers=headers, verify=False)
d=(s.cookies).get_dict()
soup = bb(y.text, "html.parser")
div = soup.find("input", attrs={'name': 'logintoken'})
tok=div.attrs['value']
dd = {'username': my_username, 'password':
'my_pass',"logintoken":tok,'anchor':""}
ss = requests.post(url, data=dd,verify=False,headers=headers,cookies=d)
if "Dashboard" in ss.text:
print('Success')
会不会是因为我把";证书验证";是否为False?
对于类似http://www.example.com/index.php#test
的URL
location.hash
将返回#test
hash返回URL中#符号后面的部分,包括#符号。
所以我认为你可以将空字符串传递给锚点参数