Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstreefkerk/68e4914b9d361a916a977cbcedef6f85 to your computer and use it in GitHub Desktop.
Save dstreefkerk/68e4914b9d361a916a977cbcedef6f85 to your computer and use it in GitHub Desktop.
# Retrieve SPF records for a domain via Cloudflare DoH
$domain = 'example.com'
$result = Invoke-RestMethod -Uri "https://cloudflare-dns.com/dns-query?name=$domain&type=TXT" -Headers @{'accept'='application/dns-json'}
if ($result -ne $null) {
if ($result.answer -ne $null) {
$result.answer | Select-Object -ExpandProperty data | Where-Object {$_ -like '*v=spf1*'}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment