Created
July 9, 2019 11:04
-
-
Save dstreefkerk/68e4914b9d361a916a977cbcedef6f85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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