import requests
import sys

# Take the list of subdomains and read them in from the files and split the string by line
# Download the dnscan files from: https://github.com/rbsec/dnscan
sub_list = open("subdomains_files/dnscan/subdomains-1000.txt").read()
subs = sub_list.splitlines()

for sub in subs:
    url_to_check = f"http://{sub}.{sys.argv[1]}"

    try:
        requests.get(url_to_check)

    except requests.ConnectionError:
        pass
    else:
        print("Valid Domain: ", url_to_check)