擅长:python、mysql、java
<p>这是查找包含<code>.php?id=</code>的所有HREF所需的代码</p>
<pre><code>from bs4 import BeautifulSoup
import requests
import re
def gethref(ip):
url = ("http://" + ip)
print("[x] ~ SCAN: " + url + " ~ [x]")
req = requests.get(url)
soup = BeautifulSoup(req.text, 'html.parser')
h = soup.find_all(href=re.compile(r'(.*).php\?id=\d*'))
print(h)
# sqli = soup.select('a') # i don't know what its doing, so i just commented it out
# for link in soup.find_all('a'):
# sqli = str(link.get('href'))
# print(sqli)
# if 'page' in sqli:
# print(sqli.a)
</code></pre>
<p>我想这就是你需要的</p>
<p>告诉我如果它不起作用</p>