Skip to content

Instantly share code, notes, and snippets.

@Wpkenpachi
Created January 19, 2023 01:37
Show Gist options
  • Save Wpkenpachi/c543eba0a183d65f1d344587d972252f to your computer and use it in GitHub Desktop.
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
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