This python program is used to identify the provided the IP address is private or public:
First = int(input("Enter the First Octet Value:"))
Second = int(input("Enter the Second Octet Value:"))
Third = int(input("Enter the Third Octet Value:"))
Fourth = int(input("Enter the Fourth Octet Value:"))
if First==10 and Second<=255 and Third<=255 and Fourth<=255:
print("IP address is Private and in the range of Class-A")
elif First==172 and Second in range(16,31) and Third<=255 and Fourth<=255:
print("IP address is Private and in the range of Class-B")
elif First==192 and Second==168 and Third<=255 and Fourth<=255:
print("IP address is Private and in the range of Class-C")
else:
print("The IP address is Public")
0 comments:
Post a Comment