Skip to content

Instantly share code, notes, and snippets.

@kbence
Created February 8, 2020 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbence/0cc95109f5228bd919fef4c34247655e to your computer and use it in GitHub Desktop.
Save kbence/0cc95109f5228bd919fef4c34247655e to your computer and use it in GitHub Desktop.
Script to check number of dig DNS results for a few free DNS servers out there.
#!/usr/bin/env bash
DNS_SERVERS="
8.8.8.8 8.8.4.4
1.1.1.1
208.67.222.222 208.67.220.220
199.85.126.10 199.85.127.10
8.26.56.26 8.20.247.20
9.9.9.9 149.112.112.112
64.6.64.6 64.6.65.6
"
parallel echo BEGIN {} \; dig @{} "$1" \; echo END {} ::: $DNS_SERVERS | egrep -v '(^;|^$)' \
| IFS=$'\t' awk '
$1 == "BEGIN" {dns=$2; count[dns]=0}
$1 != "BEGIN" && $1 != "END" {count[dns]++}
$1 == "END" {printf "%-15s %2d\n", dns, count[dns]}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment