python requests怎么解决url中../自动跳目录的问题?

import requests

burp0_url = "http://127.0.0.1:80/../../../../a"

burp0_headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36", "Accept-Encoding": "gzip, deflate", "Accept": "*/*", "Connection": "close", "Accept-Language": "en"}

requests.get(burp0_url, headers=burp0_headers, proxies={'http':'http://127.0.0.1:8080'})

python requests怎么解决url中../自动跳目录的问题?
图中可见../自动跳了目录,../在请求中不见了。
python requests怎么解决url中../自动跳目录的问题?
别给建议说编码、curl什么的,烦请能实现了再回答,能用python解决就行,谢了。


回答:

解决办法:

import urllib.request

proxy_support = urllib.request.ProxyHandler({"http" : "http://127.0.0.1:8080"})

opener = urllib.request.build_opener(proxy_support)

urllib.request.install_opener(opener)

url = "http://127.0.0.1/../../../../a"

f = urllib.request.urlopen(url)

print(f.read())

以上是 python requests怎么解决url中../自动跳目录的问题? 的全部内容, 来源链接: utcz.com/p/937898.html

回到顶部