Created
March 3, 2022 18:03
-
-
Save ozuma/bb1ad48e337fcd2529201028eb11fe0e to your computer and use it in GitHub Desktop.
Add IP addresses from a URL list.
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/python3 | |
import urllib.parse | |
import dns.resolver | |
import sys | |
with open(sys.argv[1]) as f: | |
for url in f: | |
url = url.strip() | |
parsed_url = urllib.parse.urlparse(url) | |
ip = dns.resolver.query(parsed_url.netloc, 'A')[0] | |
print(f"{ip},{url}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment