Skip to content

teqneers/blcheck

 
 

Repository files navigation

blcheck

A powerful script for testing a domain or an IP against mailing block and allow lists. Script will use dig if it is found. If dig is not found script will use host.

Features

  • More than 250 block lists already included!
  • Automatic distinction between domain, IPv4, or IPv6
  • Performs PTR validation (only if domain is supplied, does not work for IP)
  • 3 verbose (-v) levels and a quiet (-q) mode
  • The result of the script is the number of services which blocklisted the domain, so it can be used for any kind of automated scripts or cronjobs
  • JSON output mode (-j) for monitoring and automation integration
  • Unreachable list detection via -c flag (warns if a list's TLD no longer resolves)
  • Informative and pleasant output
  • Concurrent execution

Requirements

  • Any Unix/Linux or macOS with BASH.
  • Either dig or host command is available.
  • GNU parallel command available.

Usage

blcheck [options] <domain\_or\_IP>

Supplied domain must be a fully qualified domain name.
If an IP (v4 or v6) is supplied, the PTR check cannot be executed and will be skipped.

<pre>
-d dnshost  Use host as DNS server to make lookups
-l file     Load lists from file with one entry per line
-c          Warn if the top level domain of the list has expired
-v          Verbose mode, can be used multiple times (up to -vvv)
-q          Quiet mode with absolutely no output (useful for scripts)
-p          Plain text output (no coloring, no interactive status)
-j          JSON output (implies -p)
-t          Number of parallel threads (e.g. 4) or percentage of cores (e.g. 50%), default: 75%
-h          The help you are just reading
</pre>

Result of the script is the number of blocklisted entries. So if the supplied
IP is not blocklisted on any of the servers the return code is 0.

Testing

Unit tests live in tests/blcheck_test.sh and use bashunit.

Install bashunit, then run the tests from the repository root:

bashunit tests/blcheck_test.sh

The tests cover the core helper functions (info, error, resolve, loadList) and the provider list regex parser, without requiring a live DNS server.

TODO

  1. Handle domains with multiple DNS entries.

License

blcheck is distributed under the terms of the MIT license. See license file for details.

Credits

Script has been written by the Intellex team. Additional contributors:

About

Test a mail server against blacklists.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Shell 58.7%
  • Go 38.5%
  • Makefile 2.8%