# domain-email-records
[![PyPi](https://img.shields.io/pypi/v/domain-email-records.svg)](https://pypi.python.org/pypi/domain-email-records/)
[![Python Versions](https://img.shields.io/pypi/pyversions/domain-email-records.svg)](https://github.com/ndejong/domain-email-records/)
[![Build Tests](https://github.com/ndejong/domain-email-records/actions/workflows/build-tests.yml/badge.svg)](https://github.com/ndejong/domain-email-records/actions/workflows/build-tests.yml)
![License](https://img.shields.io/github/license/ndejong/domain-email-records.svg)
CLI tool to quickly lookup MX, SPF, DMARC records for many domains
__NB1__ this tool can generate several-hundred DNS queries per second, be sure your
nameservers have capacity to handle this.
__NB2__ if you get errors like `OSError: [Errno 24] Too many open files: '/etc/resolv.conf'` then
you are trying to set the chunk-size too large for your system - use a smaller chunk-size.
## Install
```shell
pip install [--upgrade] domain-email-records
```
## Usage
```shell
usage: domain-email-records [-h] [-q | -v] [-o <filename>] [-T <seconds>] [-n [<address> ...]] [-t [<qtype> ...]] [-c <size>] [-d [<domain> ...]] [-f <filename>] [-col <col>]
domain-email-records v0.4.1
CLI tool to quickly lookup MX, SPF, DMARC records for many domains
options:
-h, --help show this help message and exit
-q, --quiet Set quiet logging output
-v, --verbose Set verbose logging output
-o <filename>, --out <filename>
Filename to save JSON formatted output to (default: stdout)
-T <seconds>, --timeout <seconds>
Timeout seconds per domain-record query (default: 10)
-n [<address> ...], --nameservers [<address> ...]
Space separated list of alternate nameservers (default: system nameservers)
-t [<qtype> ...], --types [<qtype> ...]
Space separated list lookup types to collect (default: ['ns', 'apex', 'mx', 'spf', 'dmarc']); also 'txt' type is available
-c <size>, --chunk <size>
Chunk size per async loop to resolve together (default: 500)
domains-by-cli:
-d [<domain> ...], --domains [<domain> ...]
Space separated list of domain names to query
domains-by-file:
-f <filename>, --filename <filename>
Filename with list of domains to use; plain list text file -or- a comma-separated CSV file list.
-col <col>, --csv-column <col>
CSV column number to use for domain-names -if- the file is CSV formatted (default: 2)
```
## Examples
### Domains from CSV-file with output file
```shell
$ domain-email-records -c 1000 -f alexa-top-1m-20220708.csv -o /tmp/output.json
2022-07-09T16:51:41+1000 - INFO - Looking up 772475 domains in chunks of 1000 per async loop using system-local nameservers.
2022-07-09T16:51:56+1000 - INFO - Domains in list from:google.com (index:0) to:icims.com (index:1000) query rate ~15.5ms per domain (5.2ms per query) ETA: 2022-07-09T20:11:09+1000
2022-07-09T16:52:11+1000 - INFO - Domains in list from:aliyuncs.com (index:1000) to:rapidgator.net (index:2000) query rate ~15.1ms per domain (5.0ms per query) ETA: 2022-07-09T20:08:23+1000
2022-07-09T16:52:27+1000 - INFO - Domains in list from:hola.org (index:2000) to:shaadi.com (index:3000) query rate ~15.4ms per domain (5.1ms per query) ETA: 2022-07-09T20:08:58+1000
^C2022-07-09T16:52:27+1000 - WARNING - Exiting...
```
### Domains from plain-file with specific nameservers
```shell
$ domain-email-records -n 9.9.9.9 1.1.1.1 8.8.8.8 -f alexa-top-1m-20220708.txt -o /tmp/output.json
2022-07-09T07:34:08+0000 - INFO - Looking up 772475 domains in chunks of 500 per async loop using ['1.1.1.1', '9.9.9.9', '8.8.8.8'] nameservers.
2022-07-09T07:34:18+0000 - INFO - Domains in list from:google.com (index:0) to:googlesyndication.com (index:500) query rate ~18.3ms per domain (6.1ms per query) ETA: 2022-07-09T11:30:18+0000
2022-07-09T07:34:20+0000 - WARNING - cisco.com unable to UTF-8 decode rdata: b'\xc8atlassian-domain-verification=blI4HshP3kJO1PV8nZFlncJ6TwVviYYxBNhkMi9wIa9DTxUjY4p1GO7O5SjiioyT'
2022-07-09T07:34:24+0000 - INFO - Domains in list from:chegg.com (index:500) to:icims.com (index:1000) query rate ~12.4ms per domain (4.1ms per query) ETA: 2022-07-09T10:51:50+0000
2022-07-09T07:34:32+0000 - INFO - Domains in list from:aliyuncs.com (index:1000) to:poshukach.com (index:1500) query rate ~15.3ms per domain (5.1ms per query) ETA: 2022-07-09T10:51:43+0000
^C2022-07-09T07:35:10+0000 - WARNING - Exiting...
```
### Domains from cli args with output to file
```shell
$ domain-email-records -d google.com facebook.com apple.com amazon.com -o /tmp/output.json
2022-07-09T14:24:57+1000 - INFO - Domains in list from:google.com to:amazon.com queried (4x) at approx 121.1ms per domain (40.4ms per query) ETA: 2022-07-09 14:24:00
```
### Domains from cli args with output to stdout
```
$ domain-email-records -d google.com facebook.com apple.com amazon.com
2022-10-06T09:37:38+1000 - INFO - Looking up 4 domains in chunks of 500 per async loop using system-local nameservers.
{
"google.com": {
"ns": [
"ns2.google.com.",
"ns4.google.com.",
"ns1.google.com.",
"ns3.google.com."
],
"apex": [
"142.250.204.14"
],
"mx": [
"smtp.google.com."
],
"mx_preference": [
"10"
],
"spf": [
"v=spf1 include:_spf.google.com ~all"
],
"dmarc": [
"v=DMARC1; p=reject; rua=mailto:mailauth-reports@google.com"
]
}
}
...
2022-10-06T09:37:38+1000 - INFO - Domains in list from:google.com (index:0) to:amazon.com (index:4) query rate ~21.2ms per domain (2.4ms per query) ETA: 2022-10-06T09:37:38+1000
```
---
Copyright © 2022 Nicholas de Jong
Raw data
{
"_id": null,
"home_page": "",
"name": "domain-email-records",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "domain-name,dns,email,spf,dmarc",
"author": "Nicholas de Jong",
"author_email": "ndejong@threatpatrols.com",
"download_url": "https://files.pythonhosted.org/packages/81/85/8de94d800021f03a984a8107b7c11cfeab7e4afd980f4e7efe3be6ad94b1/domain_email_records-0.5.2.tar.gz",
"platform": null,
"description": "# domain-email-records\n[![PyPi](https://img.shields.io/pypi/v/domain-email-records.svg)](https://pypi.python.org/pypi/domain-email-records/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/domain-email-records.svg)](https://github.com/ndejong/domain-email-records/)\n[![Build Tests](https://github.com/ndejong/domain-email-records/actions/workflows/build-tests.yml/badge.svg)](https://github.com/ndejong/domain-email-records/actions/workflows/build-tests.yml)\n![License](https://img.shields.io/github/license/ndejong/domain-email-records.svg)\n\nCLI tool to quickly lookup MX, SPF, DMARC records for many domains\n\n__NB1__ this tool can generate several-hundred DNS queries per second, be sure your \nnameservers have capacity to handle this.\n\n__NB2__ if you get errors like `OSError: [Errno 24] Too many open files: '/etc/resolv.conf'` then \nyou are trying to set the chunk-size too large for your system - use a smaller chunk-size.\n\n## Install\n```shell\npip install [--upgrade] domain-email-records\n```\n\n## Usage\n```shell\nusage: domain-email-records [-h] [-q | -v] [-o <filename>] [-T <seconds>] [-n [<address> ...]] [-t [<qtype> ...]] [-c <size>] [-d [<domain> ...]] [-f <filename>] [-col <col>]\n\ndomain-email-records v0.4.1\n\nCLI tool to quickly lookup MX, SPF, DMARC records for many domains\n\noptions:\n -h, --help show this help message and exit\n -q, --quiet Set quiet logging output\n -v, --verbose Set verbose logging output\n -o <filename>, --out <filename>\n Filename to save JSON formatted output to (default: stdout)\n -T <seconds>, --timeout <seconds>\n Timeout seconds per domain-record query (default: 10)\n -n [<address> ...], --nameservers [<address> ...]\n Space separated list of alternate nameservers (default: system nameservers)\n -t [<qtype> ...], --types [<qtype> ...]\n Space separated list lookup types to collect (default: ['ns', 'apex', 'mx', 'spf', 'dmarc']); also 'txt' type is available\n -c <size>, --chunk <size>\n Chunk size per async loop to resolve together (default: 500)\n\ndomains-by-cli:\n -d [<domain> ...], --domains [<domain> ...]\n Space separated list of domain names to query\n\ndomains-by-file:\n -f <filename>, --filename <filename>\n Filename with list of domains to use; plain list text file -or- a comma-separated CSV file list.\n -col <col>, --csv-column <col>\n CSV column number to use for domain-names -if- the file is CSV formatted (default: 2)\n```\n\n## Examples\n\n### Domains from CSV-file with output file\n```shell\n$ domain-email-records -c 1000 -f alexa-top-1m-20220708.csv -o /tmp/output.json\n2022-07-09T16:51:41+1000 - INFO - Looking up 772475 domains in chunks of 1000 per async loop using system-local nameservers.\n2022-07-09T16:51:56+1000 - INFO - Domains in list from:google.com (index:0) to:icims.com (index:1000) query rate ~15.5ms per domain (5.2ms per query) ETA: 2022-07-09T20:11:09+1000\n2022-07-09T16:52:11+1000 - INFO - Domains in list from:aliyuncs.com (index:1000) to:rapidgator.net (index:2000) query rate ~15.1ms per domain (5.0ms per query) ETA: 2022-07-09T20:08:23+1000\n2022-07-09T16:52:27+1000 - INFO - Domains in list from:hola.org (index:2000) to:shaadi.com (index:3000) query rate ~15.4ms per domain (5.1ms per query) ETA: 2022-07-09T20:08:58+1000\n^C2022-07-09T16:52:27+1000 - WARNING - Exiting...\n```\n\n### Domains from plain-file with specific nameservers\n```shell\n$ domain-email-records -n 9.9.9.9 1.1.1.1 8.8.8.8 -f alexa-top-1m-20220708.txt -o /tmp/output.json\n2022-07-09T07:34:08+0000 - INFO - Looking up 772475 domains in chunks of 500 per async loop using ['1.1.1.1', '9.9.9.9', '8.8.8.8'] nameservers.\n2022-07-09T07:34:18+0000 - INFO - Domains in list from:google.com (index:0) to:googlesyndication.com (index:500) query rate ~18.3ms per domain (6.1ms per query) ETA: 2022-07-09T11:30:18+0000\n2022-07-09T07:34:20+0000 - WARNING - cisco.com unable to UTF-8 decode rdata: b'\\xc8atlassian-domain-verification=blI4HshP3kJO1PV8nZFlncJ6TwVviYYxBNhkMi9wIa9DTxUjY4p1GO7O5SjiioyT'\n2022-07-09T07:34:24+0000 - INFO - Domains in list from:chegg.com (index:500) to:icims.com (index:1000) query rate ~12.4ms per domain (4.1ms per query) ETA: 2022-07-09T10:51:50+0000\n2022-07-09T07:34:32+0000 - INFO - Domains in list from:aliyuncs.com (index:1000) to:poshukach.com (index:1500) query rate ~15.3ms per domain (5.1ms per query) ETA: 2022-07-09T10:51:43+0000\n^C2022-07-09T07:35:10+0000 - WARNING - Exiting...\n```\n\n### Domains from cli args with output to file\n```shell\n$ domain-email-records -d google.com facebook.com apple.com amazon.com -o /tmp/output.json\n2022-07-09T14:24:57+1000 - INFO - Domains in list from:google.com to:amazon.com queried (4x) at approx 121.1ms per domain (40.4ms per query) ETA: 2022-07-09 14:24:00\n```\n\n### Domains from cli args with output to stdout\n```\n$ domain-email-records -d google.com facebook.com apple.com amazon.com\n2022-10-06T09:37:38+1000 - INFO - Looking up 4 domains in chunks of 500 per async loop using system-local nameservers.\n{\n \"google.com\": {\n \"ns\": [\n \"ns2.google.com.\",\n \"ns4.google.com.\",\n \"ns1.google.com.\",\n \"ns3.google.com.\"\n ],\n \"apex\": [\n \"142.250.204.14\"\n ],\n \"mx\": [\n \"smtp.google.com.\"\n ],\n \"mx_preference\": [\n \"10\"\n ],\n \"spf\": [\n \"v=spf1 include:_spf.google.com ~all\"\n ],\n \"dmarc\": [\n \"v=DMARC1; p=reject; rua=mailto:mailauth-reports@google.com\"\n ]\n }\n}\n...\n2022-10-06T09:37:38+1000 - INFO - Domains in list from:google.com (index:0) to:amazon.com (index:4) query rate ~21.2ms per domain (2.4ms per query) ETA: 2022-10-06T09:37:38+1000\n```\n\n---\n\nCopyright © 2022 Nicholas de Jong\n\n",
"bugtrack_url": null,
"license": "BSD-2-Clause",
"summary": "CLI tool to quickly lookup MX, SPF, DMARC records for many domains",
"version": "0.5.2",
"project_urls": {
"Bug Tracker": "https://github.com/ndejong/domain-email-records/issues",
"Documentation": "https://github.com/ndejong/domain-email-records",
"Homepage": "https://github.com/ndejong/domain-email-records",
"Repository": "https://github.com/ndejong/domain-email-records.git"
},
"split_keywords": [
"domain-name",
"dns",
"email",
"spf",
"dmarc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ff6b1068fd61d2612a100683ae17513a2b40d6947ba8d7842ed15436f259829b",
"md5": "f6f633ddb101ab9a909674b7f68a71ae",
"sha256": "1b78d049c2451d7e175215a7a782443c0cbc3f064d66eaa19c74f9984b3e4cbb"
},
"downloads": -1,
"filename": "domain_email_records-0.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f6f633ddb101ab9a909674b7f68a71ae",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 11297,
"upload_time": "2023-10-20T11:44:40",
"upload_time_iso_8601": "2023-10-20T11:44:40.940216Z",
"url": "https://files.pythonhosted.org/packages/ff/6b/1068fd61d2612a100683ae17513a2b40d6947ba8d7842ed15436f259829b/domain_email_records-0.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "81858de94d800021f03a984a8107b7c11cfeab7e4afd980f4e7efe3be6ad94b1",
"md5": "9036d45fc3aec299e83c3b79d95bd68e",
"sha256": "45d99ffda23848f307b87353899b5f210b82e34178288e54d9d222c6897cc2ad"
},
"downloads": -1,
"filename": "domain_email_records-0.5.2.tar.gz",
"has_sig": false,
"md5_digest": "9036d45fc3aec299e83c3b79d95bd68e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 10701,
"upload_time": "2023-10-20T11:44:44",
"upload_time_iso_8601": "2023-10-20T11:44:44.050129Z",
"url": "https://files.pythonhosted.org/packages/81/85/8de94d800021f03a984a8107b7c11cfeab7e4afd980f4e7efe3be6ad94b1/domain_email_records-0.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-20 11:44:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ndejong",
"github_project": "domain-email-records",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "domain-email-records"
}