I am trying to do sub-domain enumeration in my organization. Part of the python code is to get the IPs of the already enumerated sub-domains which are included in a text file . Used the below code
import socket
file = open(r'C:\Users****\Downloads\sublist.txt')
domain_list = []
for x in file.readlines(): domain_list.append(x.rstrip())
for y in domain_list: print(y + ' -> ' + socket.gethostbyname(y))
The script doesn't seem to work and giving me the error "socket.gaierror: [Errno 11001] getaddrinfo failed" when i included my organization's sub-domains in the txt file "sublist.txt". But it gives me the proper IP addresses when any other public domains are used in the list such as google.com
Note - simply running the command socket.gethostbyname('organization sub-domain name' ) gives me the proper result and I am connected via VPN to my org