Created
August 25, 2021 23:57
-
-
Save subtosilencio/8883481d825bd7fccffcabecd50f102f to your computer and use it in GitHub Desktop.
Return DNS servers of a domain
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
import subprocess | |
def returnDNS(domain): | |
''' Return DNS servers of a domain ''' | |
proc = subprocess.Popen(["dig +short +time=2 -t ns " +domain], | |
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | |
(out, err) = proc.communicate() | |
return sorted(out.decode('utf-8').split()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment