Write a python function that that takes a list of potential subdomains and resolves them against a primary domain. Call your function resolve_subdomains(primary, potential_subdomains). It should return a set of subdomains that actually resolve. Print nothing.
Write a python function that that takes a list of potential subdomains and resolves them against a primary domain. Call your function resolve_subdomains(primary, potential_subdomains). It should return a set of subdomains that actually resolve. Print nothing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolves a list of potential subdomains against a primary domain. Args: primary: The primary domain to resolve against. potential_subdomains: A list of potential subdomains to resolve. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for potential_subdomain in potential_subdomains: try: # Attempt to resolve the subdomain socket.gethostbyname(f"{potential_subdomain}.{primary}") resolved_subdomains.add(potential_subdomain) except socket.error: # Subdomain could not be resolved pass return resolved_subdomains |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolves a list of potential subdomains against a primary domain. Args: primary: The primary domain to resolve against. potential_subdomains: A list of potential subdomains to resolve. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for potential_subdomain in potential_subdomains: try: # Attempt to resolve the subdomain socket.gethostbyname(f"{potential_subdomain}.{primary}") resolved_subdomains.add(potential_subdomain) except socket.error: # Subdomain could not be resolved pass return resolved_subdomains |
Running the following program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolves a list of potential subdomains against a primary domain. Args: primary: The primary domain to resolve against. potential_subdomains: A list of potential subdomains to resolve. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for potential_subdomain in potential_subdomains: try: # Attempt to resolve the subdomain socket.gethostbyname(f"{potential_subdomain}.{primary}") resolved_subdomains.add(potential_subdomain) except socket.error: # Subdomain could not be resolved pass return resolved_subdomains subdomains = resolve_subdomains("deadbits.ai", ["www", "mail", "blog", "vigil", "trs", "vpn", "admin", "test", "dev", "staging", "shop", "store", "ftp", "m", "forum"]) print(subdomains) |
{'www', 'blog', 'trs', 'vigil'}
Resulting in output: True
Write a python function that that takes a list of potential subdomains and resolves them against a primary domain. Call your function resolve_subdomains(primary, potential_subdomains). It should return a set of subdomains that actually resolve. Print nothing.
Write a python function that that takes a list of potential subdomains and resolves them against a primary domain. Call your function resolve_subdomains(primary, potential_subdomains). It should return a set of subdomains that actually resolve. Print nothing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolve a list of potential subdomains against a primary domain. Args: primary: The primary domain to resolve against. potential_subdomains: A list of potential subdomains to resolve. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for subdomain in potential_subdomains: try: socket.gethostbyname(f"{subdomain}.{primary}") resolved_subdomains.add(subdomain) except socket.error: pass return resolved_subdomains |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolve a list of potential subdomains against a primary domain. Args: primary: The primary domain to resolve against. potential_subdomains: A list of potential subdomains to resolve. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for subdomain in potential_subdomains: try: socket.gethostbyname(f"{subdomain}.{primary}") resolved_subdomains.add(subdomain) except socket.error: pass return resolved_subdomains |
Running the following program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolve a list of potential subdomains against a primary domain. Args: primary: The primary domain to resolve against. potential_subdomains: A list of potential subdomains to resolve. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for subdomain in potential_subdomains: try: socket.gethostbyname(f"{subdomain}.{primary}") resolved_subdomains.add(subdomain) except socket.error: pass return resolved_subdomains subdomains = resolve_subdomains("deadbits.ai", ["www", "mail", "blog", "vigil", "trs", "vpn", "admin", "test", "dev", "staging", "shop", "store", "ftp", "m", "forum"]) print(subdomains) |
{'trs', 'vigil', 'blog', 'www'}
Resulting in output: True
Write a python function that that takes a list of potential subdomains and resolves them against a primary domain. Call your function resolve_subdomains(primary, potential_subdomains). It should return a set of subdomains that actually resolve. Print nothing.
Write a python function that that takes a list of potential subdomains and resolves them against a primary domain. Call your function resolve_subdomains(primary, potential_subdomains). It should return a set of subdomains that actually resolve. Print nothing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolves potential subdomains against a primary domain. Args: primary (str): The primary domain name. potential_subdomains (list): A list of potential subdomain names. Returns: set: A set of subdomains that actually resolve. """ resolved_subdomains = set() for potential_subdomain in potential_subdomains: try: # Attempt to resolve the potential subdomain. socket.gethostbyname(f"{potential_subdomain}.{primary}") # If the subdomain resolves, add it to the set of resolved subdomains. resolved_subdomains.add(potential_subdomain) except socket.error: # If the subdomain does not resolve, ignore it. continue return resolved_subdomains |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolves potential subdomains against a primary domain. Args: primary (str): The primary domain name. potential_subdomains (list): A list of potential subdomain names. Returns: set: A set of subdomains that actually resolve. """ resolved_subdomains = set() for potential_subdomain in potential_subdomains: try: # Attempt to resolve the potential subdomain. socket.gethostbyname(f"{potential_subdomain}.{primary}") # If the subdomain resolves, add it to the set of resolved subdomains. resolved_subdomains.add(potential_subdomain) except socket.error: # If the subdomain does not resolve, ignore it. continue return resolved_subdomains |
Running the following program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolves potential subdomains against a primary domain. Args: primary (str): The primary domain name. potential_subdomains (list): A list of potential subdomain names. Returns: set: A set of subdomains that actually resolve. """ resolved_subdomains = set() for potential_subdomain in potential_subdomains: try: # Attempt to resolve the potential subdomain. socket.gethostbyname(f"{potential_subdomain}.{primary}") # If the subdomain resolves, add it to the set of resolved subdomains. resolved_subdomains.add(potential_subdomain) except socket.error: # If the subdomain does not resolve, ignore it. continue return resolved_subdomains subdomains = resolve_subdomains("deadbits.ai", ["www", "mail", "blog", "vigil", "trs", "vpn", "admin", "test", "dev", "staging", "shop", "store", "ftp", "m", "forum"]) print(subdomains) |
{'blog', 'vigil', 'trs', 'www'}
Resulting in output: True
Write a python function that that takes a list of potential subdomains and resolves them against a primary domain. Call your function resolve_subdomains(primary, potential_subdomains). It should return a set of subdomains that actually resolve. Print nothing.
Write a python function that that takes a list of potential subdomains and resolves them against a primary domain. Call your function resolve_subdomains(primary, potential_subdomains). It should return a set of subdomains that actually resolve. Print nothing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import socket def resolve_subdomains(primary, potential_subdomains): """ Takes a list of potential subdomains and resolves them against a primary domain. Args: primary: The primary domain name. potential_subdomains: A list of potential subdomains. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for subdomain in potential_subdomains: try: socket.gethostbyname(f"{subdomain}.{primary}") resolved_subdomains.add(subdomain) except socket.gaierror: pass return resolved_subdomains |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import socket def resolve_subdomains(primary, potential_subdomains): """ Takes a list of potential subdomains and resolves them against a primary domain. Args: primary: The primary domain name. potential_subdomains: A list of potential subdomains. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for subdomain in potential_subdomains: try: socket.gethostbyname(f"{subdomain}.{primary}") resolved_subdomains.add(subdomain) except socket.gaierror: pass return resolved_subdomains |
Running the following program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import socket def resolve_subdomains(primary, potential_subdomains): """ Takes a list of potential subdomains and resolves them against a primary domain. Args: primary: The primary domain name. potential_subdomains: A list of potential subdomains. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for subdomain in potential_subdomains: try: socket.gethostbyname(f"{subdomain}.{primary}") resolved_subdomains.add(subdomain) except socket.gaierror: pass return resolved_subdomains subdomains = resolve_subdomains("deadbits.ai", ["www", "mail", "blog", "vigil", "trs", "vpn", "admin", "test", "dev", "staging", "shop", "store", "ftp", "m", "forum"]) print(subdomains) |
{'vigil', 'blog', 'www', 'trs'}
Resulting in output: True
Write a python function that that takes a list of potential subdomains and resolves them against a primary domain. Call your function resolve_subdomains(primary, potential_subdomains). It should return a set of subdomains that actually resolve. Print nothing.
Write a python function that that takes a list of potential subdomains and resolves them against a primary domain. Call your function resolve_subdomains(primary, potential_subdomains). It should return a set of subdomains that actually resolve. Print nothing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolve a list of potential subdomains against a primary domain. Args: primary: The primary domain to resolve the subdomains against. potential_subdomains: A list of potential subdomains to resolve. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for potential_subdomain in potential_subdomains: try: socket.gethostbyname(f'{potential_subdomain}.{primary}') resolved_subdomains.add(potential_subdomain) except socket.gaierror: pass return resolved_subdomains |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolve a list of potential subdomains against a primary domain. Args: primary: The primary domain to resolve the subdomains against. potential_subdomains: A list of potential subdomains to resolve. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for potential_subdomain in potential_subdomains: try: socket.gethostbyname(f'{potential_subdomain}.{primary}') resolved_subdomains.add(potential_subdomain) except socket.gaierror: pass return resolved_subdomains |
Running the following program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import socket def resolve_subdomains(primary, potential_subdomains): """ Resolve a list of potential subdomains against a primary domain. Args: primary: The primary domain to resolve the subdomains against. potential_subdomains: A list of potential subdomains to resolve. Returns: A set of subdomains that actually resolve. """ resolved_subdomains = set() for potential_subdomain in potential_subdomains: try: socket.gethostbyname(f'{potential_subdomain}.{primary}') resolved_subdomains.add(potential_subdomain) except socket.gaierror: pass return resolved_subdomains subdomains = resolve_subdomains("deadbits.ai", ["www", "mail", "blog", "vigil", "trs", "vpn", "admin", "test", "dev", "staging", "shop", "store", "ftp", "m", "forum"]) print(subdomains) |
{'trs', 'blog', 'www', 'vigil'}
Resulting in output: True