Python输出子域名扫描的程序
时间: 2023-11-05 21:58:35 浏览: 104
Python库 | subdomain-0.1.3.tar.gz
好的,请稍等,我会给你展示一段Python代码:
```
import requests
def subdomain_scan(domain):
url = "https://crt.sh/?q=%25." + domain
res = requests.get(url)
subdomains = []
for line in res.text.split("\n"):
if "<TD>" not in line:
continue
subdomain = line.split("<TD>")[1].split("</TD>")[0]
if "*" not in subdomain:
subdomains.append(subdomain)
return subdomains
if __name__ == "__main__":
domain = input("请输入域名: ")
subdomains = subdomain_scan(domain)
for subdomain in subdomains:
print(subdomain)
```
这段代码使用 requests 库向 crt.sh 发送子域名查询请求,并解析响应获取子域名列表,最后将其输出到控制台。你可以根据需要进行修改和优化。希望对你有帮助。
阅读全文