If you manage more than a handful of domains, sooner or later someone asks: "which of our domains can be spoofed?" Here is how to answer by hand, and how I automated it.
The three lookups, by hand
Everything lives in public DNS, so dig is enough.
DMARC is a TXT record on the _dmarc subdomain:
dig +short TXT _dmarc.example.com # "v=DMARC1; p=none; rua=mailto:dmarc@example.com" The part that matters is p=. With p=none forged mail is reported but still delivered. Only p=quarantine and p=reject actually protect the domain. No record at all means no protection.
SPF is a TXT record on the domain itself, starting with v=spf1:
dig +short TXT example.com | grep spf1 # "v=spf1 include:_spf.google.com ~all" Look at the last mechanism: -all rejects other senders, ~all only marks them, +all allows anyone. Also count the include, a, mx and redirect terms, followed recursively: SPF allows at most 10 DNS lookups (RFC 7208, section 4.6.4), and a record that goes over fails for everyone.
DKIM is harder, because the record sits under a selector you have to know:
dig +short TXT google._domainkey.example.com There is no way to list selectors. You try the usual ones for the provider (google, selector1 and selector2 for Microsoft 365, k1 for Mailchimp, and so on).
Domains that send no mail
They are the easiest to forget and the easiest to spoof. A parked domain should publish v=spf1 -all and a DMARC record with p=reject.
Doing it for hundreds of domains
A shell loop around dig works until you need the SPF lookup count, the DKIM selector guessing and a readable verdict per domain. I turned those checks into a small tool: SPF, DKIM & DMARC Checker (I am the author).
You paste domains, and each one comes back as one row: a grade, whether it can be spoofed, the email provider, the records found, and for every problem the DNS record to publish. A shortened example of a row:
{ "domain": "example.org", "grade": "C", "spoofable": true, "summary": "Not protected: DMARC only monitors, forged mail is still delivered.", "emailProvider": "Google Workspace", "spfAll": "softfail (~all)", "spfLookupCount": 4, "dmarcPolicy": "none", "dkimSelectorsFound": ["google"], "issues": [{ "code": "DMARC_POLICY_NONE", "fix": "Move to p=quarantine, then p=reject, once reports show legitimate mail passes." }] } It only reads public DNS. It costs $0.80 per 1,000 domains, and invalid or non-existent domains are not charged. There is a ready-to-run example here: Check DMARC, SPF and DKIM for a list of domains.
If you prefer to keep your own script, the three dig commands above are all you need to start. If a domain is graded wrongly by the tool, tell me in the comments with the domain name and I will look at it.

