Created
November 9, 2018 00:10
-
-
Save cwedgwood/17db5a7df2ea80acf92385632662348a to your computer and use it in GitHub Desktop.
Using python to get a list of IPs from DNS
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
#!/usr/bin/python2.7 | |
# https://docs.python.org/2.7/library/socket.html#socket.getaddrinfo | |
import socket | |
[ addr[4][0] for addr in socket.getaddrinfo("google.com", 0) if addr[0] in (socket.AF_INET, socket.AF_INET6) ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment