Skip to main content

A Python module and command line parser for SPF and DMARC records

Project description

Build Status

A Python module and command line utility for validating SPF and DMARC DNS records

usage: checkdmarc [-h] [-d] [-f FORMAT] [-o OUTPUT]
              [-n NAMESERVER [NAMESERVER ...]] [-t TIMEOUT] [-v]
              [-w WAIT]
              domain [domain ...]

Validates and parses SPF amd DMARC DNS records

positional arguments:
  domain                one or ore domains, or a single path to a file
                        containing a list of domains

optional arguments:
  -h, --help            show this help message and exit
  -d, --descriptions    include descriptions of DMARC tags in the JSON output
  -f FORMAT, --format FORMAT
                        specify JSON or CSV output format
  -o OUTPUT, --output OUTPUT
                        output to a file path rather than printing to the
                        screen
  -n NAMESERVER [NAMESERVER ...], --nameserver NAMESERVER [NAMESERVER ...]
                        nameservers to query (Default is Cloudflare's)
  -t TIMEOUT, --timeout TIMEOUT
                        number of seconds to wait for an answer from DNS
                        (default 2.0)
  -v, --version         show program's version number and exit
  -w WAIT, --wait WAIT  number os seconds to wait between processing domains
                        (default 0.0)
$ checkdmarc fbi.gov
{
  "domain": "fbi.gov",
  "base_domain": "fbi.gov",
  "mx": {
    "hosts": [
      {
        "preference": 10,
        "hostname": "mx-east.fbi.gov",
        "addresses": [
          "153.31.160.5"
        ]
      }
    ],
    "warnings": []
  },
  "spf": {
    "record": "v=spf1 +mx ip4:153.31.0.0/16 -all",
    "valid": true,
    "dns_lookups": 1,
    "warnings": [],
    "parsed": {
      "pass": [
        {
          "value": "mx-east.fbi.gov",
          "mechanism": "mx"
        },
        {
          "value": "153.31.0.0/16",
          "mechanism": "ip4"
        }
      ],
      "neutral": [],
      "softfail": [],
      "fail": [],
      "include": [],
      "redirect": null,
      "exp": null,
      "all": "fail"
    }
  },
  "dmarc": {
    "record": "v=DMARC1; p=reject; adkim=r; aspf=r; rua=mailto:dmarc-feedback@fbi.gov; ruf=mailto:dmarc-feedback@fbi.gov; pct=100",
    "valid": true,
    "location": "fbi.gov",
    "warnings": [],
    "tags": {
      "v": {
        "value": "DMARC1",
        "explicit": true
      },
      "p": {
        "value": "reject",
        "explicit": true
      },
      "adkim": {
        "value": "r",
        "explicit": true
      },
      "aspf": {
        "value": "r",
        "explicit": true
      },
      "rua": {
        "value": [
          {
            "scheme": "mailto",
            "address": "dmarc-feedback@fbi.gov",
            "size_limit": null
          }
        ],
        "explicit": true
      },
      "ruf": {
        "value": [
          {
            "scheme": "mailto",
            "address": "dmarc-feedback@fbi.gov",
            "size_limit": null
          }
        ],
        "explicit": true
      },
      "pct": {
        "value": 100,
        "explicit": true
      },
      "fo": {
        "value": [
          "0"
        ],
        "explicit": false
      },
      "rf": {
        "value": [
          "afrf"
        ],
        "explicit": false
      },
      "ri": {
        "value": 86400,
        "explicit": false
      },
      "sp": {
        "value": "reject",
        "explicit": false
      }
    }
  }
}

Installation

checkdmarc requires Python 3.

On Debian or Ubuntu systems, run:

$ sudo apt-get install python3-pip

Python 3 installers for Windows and macOS can be found at https://www.python.org/downloads/

To install or upgrade to the latest stable release of checkdmarc on macOS or Linux, run

$ sudo -H pip3 install -U checkdmarc

Or, install the latest development release directly from GitHub:

$ sudo -H pip3 install -U git+https://github.com/domainaware/checkdmarc.git

Documentation

https://domainaware.github.io/checkdmarc

Bug reports

Please report bugs on the GitHub issue tracker

https://github.com/domainaware/checkdmarc/issues

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

checkdmarc-2.7.2.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

checkdmarc-2.7.2-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file checkdmarc-2.7.2.tar.gz.

File metadata

  • Download URL: checkdmarc-2.7.2.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6

File hashes

Hashes for checkdmarc-2.7.2.tar.gz
Algorithm Hash digest
SHA256 d85072762ef15d50a4840e4dbd8fb02d4689a3086ce428ab1f63d341c56d4db6
MD5 4b6b7689f86c8a3dd949933a35926d3c
BLAKE2b-256 502c1038a9d42d931ac7b74569d743a64601e45268a6067e2b02b07bc4e2d2f4

See more details on using hashes here.

File details

Details for the file checkdmarc-2.7.2-py3-none-any.whl.

File metadata

  • Download URL: checkdmarc-2.7.2-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6

File hashes

Hashes for checkdmarc-2.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8e085845673adca40eab5d3ff6ad2f2e5b52718fdc92756a5335c11db8f06148
MD5 df7b7a7588a19144582cd339f211849d
BLAKE2b-256 bcd10d08326525ba431782452051a8b86a70f50abb113ee1f7ea54a9ab58b51a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page