Created
June 17, 2020 01:28
-
-
Save BlackthornYugen/4d9bc645f802718fe9883a7612c82255 to your computer and use it in GitHub Desktop.
Use yq, jq, and dig +yaml to resolve a bunch of domains with nice output.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make a neato jq filter that just gives us question and answer sections. | |
JQ_FILTER='.[].message.response_message_data | [.QUESTION_SECTION[], ( .ANSWER_SECTION[]? | split(" ")[-1])]' | |
# What are my name servers for each of these? | |
for domain in jskw jsteel jsteelkw ; do for tld in ca dev ; do dig ${domain}.${tld} +yaml -tns | yq $JQ_FILTER ; done ; done # SHOW NS | |
[ | |
"jskw.ca. IN NS", | |
"ns-cloud-c4.googledomains.com.", | |
"ns-cloud-c3.googledomains.com.", | |
"ns-cloud-c2.googledomains.com.", | |
"ns-cloud-c1.googledomains.com." | |
] | |
[ | |
"jskw.dev. IN NS", | |
"ns-cloud-a1.googledomains.com.", | |
"ns-cloud-a4.googledomains.com.", | |
"ns-cloud-a3.googledomains.com.", | |
"ns-cloud-a2.googledomains.com." | |
] | |
[ | |
"jsteel.ca. IN NS", | |
"ns-cloud-a3.googledomains.com.", | |
"ns-cloud-a2.googledomains.com.", | |
"ns-cloud-a1.googledomains.com.", | |
"ns-cloud-a4.googledomains.com." | |
] | |
[ | |
"jsteel.dev. IN NS", | |
"ns-cloud-d4.googledomains.com.", | |
"ns-cloud-d3.googledomains.com.", | |
"ns-cloud-d2.googledomains.com.", | |
"ns-cloud-d1.googledomains.com." | |
] | |
[ | |
"jsteelkw.ca. IN NS", | |
"ns-cloud-c2.googledomains.com.", | |
"ns-cloud-c1.googledomains.com.", | |
"ns-cloud-c4.googledomains.com.", | |
"ns-cloud-c3.googledomains.com." | |
] | |
[ | |
"jsteelkw.dev. IN NS", | |
"ns-cloud-b3.googledomains.com.", | |
"ns-cloud-b2.googledomains.com.", | |
"ns-cloud-b1.googledomains.com.", | |
"ns-cloud-b4.googledomains.com." | |
] | |
# What about text records? | |
for domain in jskw jsteel jsteelkw ; do for tld in ca dev ; do dig _acme-challenge.${domain}.${tld} +yaml -ttxt | yq $JQ_FILTER'| @tsv' -r ; done ; done # TXT | |
_acme-challenge.jskw.ca. IN TXT | |
_acme-challenge.jskw.dev. IN TXT "ypvNMp3T_mzm-AShcnHEZXLW29FFLYhtilIcHeslhkU" | |
_acme-challenge.jsteel.ca. IN TXT | |
_acme-challenge.jsteel.dev. IN TXT "y_FSTUJLZVCqvabKC5e-boC9fMVm4tE-MdnQDPONk90" | |
_acme-challenge.jsteelkw.ca. IN TXT | |
_acme-challenge.jsteelkw.dev. IN TXT "34asWOKCaLY90cZHGLrlTb4UXPqv-XqENQ3R5jsYSoY" | |
# Get an A record for a bunch of domains | |
for domain in jskw jsteel jsteelkw ; do for tld in ca dev ; do dig x.y.${domain}.${tld} +yaml | yq $JQ_FILTER'| @tsv' -r ; done ; done | |
x.y.jskw.ca. IN A | |
x.y.jskw.dev. IN A 144.217.207.192 | |
x.y.jsteel.ca. IN A 144.217.207.192 | |
x.y.jsteel.dev. IN A 144.217.207.192 | |
x.y.jsteelkw.ca. IN A 144.217.207.192 | |
x.y.jsteelkw.dev. IN A 144.217.207.192 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment