通过dns api解析域名

1. Cloudflare dns api

curl -H "accept: application/dns-json" "https://1.1.1.1/dns-query?name=baidu.com"

import requests
headers = {"accept": "application/dns-json"}
r = requests.get("https://1.1.1.1/dns-query?name=baidu.com",headers=headers,verify=False)
print(r.json())

 

2. google dns api

curl -H "accept: application/dns-json" "https://8.8.8.8/resolve?name=baidu.com"

import requests
headers = {"accept": "application/dns-json"}
r = requests.get("https://8.8.8.8/resolve?name=baidu.com",headers=headers,verify=False)
print(r.json())

 

posted on 2023-02-01 21:05  生活费  阅读(136)  评论(0编辑  收藏  举报

导航