Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doha mahmood #86

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
def solution():
pass

def solution(ip_address1):
ip = ip_address1
ip_address1 = input("Enter Ip Address:")
ip_address1=ip_address1.split('.')
ip_address1 = [int (i) for i in ip_address1]
if ip_address1.__len__ <4:
print("ip address is false value! rewrite:")
solution(ip)
elif ip_address1[0] <0 or ip_address1[1] <0 or ip_address1[2] <0 or ip_address1[3] <0 :
print("ip address is false value! rewrate:")
solution(ip)

# ip class type
if ip_address1[0] in range(0, 128):
print("The Class Type Is A")
elif ip_address1[0] in range(127, 192):
print("The Class Type Is B")
elif ip_address1[0] in range(191, 224):
print("The Class Type Is C")
elif ip_address1[0] in range(223, 240):
print("The Class Type Is D")


# Designation
if ip_address1[0] == 10 or ip_address1[0]==169 and ip_address1[1]==254 or ip_address1[0] == 172 and ip_address1[1] > 15 and ip_address1[1] < 30 or ip_address1[0] == 192 and ip_address1[1] == 168:
print("The Designation Is : Private")

elif ip_address1[0] == 127 and ip_address1[3] > 0:
print("The Designation Is : Special")

else:
print("The Designation Is : Public")
if __name__ == '__main__':
pass
in_ip="127.0.0.1/24"
solution(in_ip)