Created
January 19, 2023 01:37
-
-
Save Wpkenpachi/c543eba0a183d65f1d344587d972252f to your computer and use it in GitHub Desktop.
A sample of script to execute dig bash command in some domains inside a csv file
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 dns.resolver as resolver | |
import pandas as pd | |
domains_csv = pd.read_csv('./domains.csv') | |
domains = domains_csv.values.tolist() | |
found = [] | |
for domain in domains: | |
dname = domain[0] | |
try: | |
output = list(dns.resolver.resolve(dname, 'MX')) | |
for res in output: | |
found.append(str(res)) | |
except: | |
pass | |
lst = pd.DataFrame.from_dict(data=found) | |
lst.to_csv('lst.csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment