Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using python to get a list of IPs from DNS
#!/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