python cookie登录DVWA,phpstudy搭建DVWA参考https://www.jianshu.com/p/97d874548300

import requests
header={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"}
c=requests.session()
s=c.get("http://127.0.0.1/DVWA/login.php",headers=header)
a=requests.cookies.RequestsCookieJar()
a.set('security','impossible')
a.set('PHPSESSID','npjjgdp2np9d3nnmr99t12ic87')
c.cookies.update(a)
ll=c.get("http://127.0.0.1/DVWA/index.php",headers=header)
print(ll.text)

原文地址:https://www.cnblogs.com/canglongdao/p/11938701.html