Below is a simple Python code that accepts IP Address as input and check or ping the IP Address and shows an output whether its up or down. Some network disable ICMP request, so no matter how you try the system will not reply to the ping request. Code below is great when you're getting hands wet on simple Python script. Here's the code: #!/usr/bin/python3 import subprocess as subps import sys def ipcheck(check_ice): status,result = subps.getstatusoutput("ping -c1 -w2 " + str(check_ice)) if status == 0: print("Device " + str(check_ice) + " is UP!") print(status,result) else: print("Device " + str(check_ice) + " is DOWN!") ipcheck(str(sys.argv[1])) #================ Works great on Linux system. For Windows, run on WSL environment. Type: wsl to enable WSL Then change directory to: /mnt/c/Users/<username>/Documents Or cd /mnt/c/<browse to wh...
Make the world a better place by sharing knowledge, ideas and anything that you can give that comes from the heart.