Wednesday, April 26, 2023

 Getting ip address using python

Script to get the ip address from domain name. Here's the code

import socket

# fungsi untuk semak dns
def check_dns(hostname):
    try:
        # menyemak dns
        ip = socket.gethostbyname(hostname)
        print(hostname, " IP ditemui:", ip)
        print("Address Info: ", trace)
    except socket.gaierror:
        # jika dns tidak ditemui
        print("DNS tidak ditemui")

# menjalankan fungsi
check_dns("www.google.com")
check_dns("www.example.com")
check_dns("www.mynic.my")

No comments:

 Simple Python Calculator This script will allows your to calculate the integers given with the chosen operation. You can add, substract, mu...