Home > Enterprise >  Why does the subdomain finder stop because "label empty or too long"?
Why does the subdomain finder stop because "label empty or too long"?

Time:09-18

So I made this subdomain finder from a hacking course. It seems to work fine for a little bit but then gives a weird error. Could anyone help me?

Here is the code

        import requests

        url = "youtube.com"

        def request(url):
            try:
                return requests.get("http://"   url, timeout=2)
            except requests.exceptions.ConnectionError:
                pass
            except requests.exceptions.InvalidURL:
                print('INVALID:', url)

        with open("/home/kali/PycharmProjects/websitesub/subdomains-wodlist.txt", "r") as wordlist_file:
            for line in wordlist_file:
                word = line.strip()
                test_url = word   "."   url
                response = request(test_url)
                if response:
                    print("Discovered SUBDOM"   test_url) 

here is the output I am getting, as we can see it finds a few websites then stops

CodePudding user response:

From the image with the stacktrace, last subdomains tested are:

  • pl,
  • es.

And then, the interesting part is at the end of the stackatrace:

failed to parse m..youtube.com

It seems that the word that failed is ending with a dot m. and thus the tried url is m..youtube and there is nothing between the two dots, leading to the error you get.

  • Related