こんにちは、pthon3 スクリプトを使用して URL を変更する必要があります。たとえば、これは私のスクリプト出力 " http://10.10.10.5/dvwa/vulnerabilities/fi/?page=include.php"で、出力から "include.php" を削除したいと考えています。出力したいのは「http://10.10.10.5/dvwa/vulnerabilities/fi/?page=」です。
import requests
from bs4 import BeautifulSoup
from urllib.request import urlparse, urljoin
url = "http://10.10.10.5/dvwa/index.php"
cookies = {'security' : 'low', 'PHPSESSID':'ev5mlspqdiklrgaqfqbh00act0'}
r = requests.post(url, cookies = cookies)
soup = BeautifulSoup(r.text, 'lxml')
for link in soup.findAll('a', href = True):
href_csrf = (link['href'])
if "fi" in href_csrf:
csrf_url = urljoin(url, href_csrf)
print("Found fi : ", csrf_url)