Dig Domain
import whois
def bulk_whois_lookup(domain_list):
results = []
for domain in domain_list:
try:
whois_data = whois.whois(domain)
results.append(f"\nWHOIS information for {domain}:")
if isinstance(whois_data, str):
results.append(whois_data)
else:
for key, value in whois_data.items():
results.append(f"{key}: {value}")
except whois.parser.PywhoisError:
results.append(f"\nWHOIS information for {domain}:\nWHOIS data not available")
return results
# Read domains from list.txt
with open("list.txt", "r") as file:
domains = [line.strip() for line in file]
# Perform WHOIS lookups
whois_results = bulk_whois_lookup(domains)
# Append results to results.txt
with open("results.txt", "a") as file:
file.writelines(whois_results)
print("WHOIS lookup completed. Results appended to results.txt")