This Python script retrieves the IP address and hostname of a given website URL using the socket library.
The script prompts the user to enter a website address (URL). It then attempts to fetch and display the corresponding hostname and IP address using the socket.gethostbyname() function. If the hostname is invalid or cannot be resolved, it catches and prints a socket.gaierror.
No additional modules are required beyond the standard Python library.
No installation of additional modules is needed
- Clone the Repository:
git clone https://github.com/yourusername/get-website-ip.git
cd get-website-ip
- Run the Script:
python3 get_website_ip.py