- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIP_manager.py
More file actions
Latest commit
64 lines (51 loc) · 1.84 KB
/
Copy pathIP_manager.py
File metadata and controls
64 lines (51 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
IP_list= ["192.105.50.1", "255.255.255.0"]
stale_IP="Toad"
fresh_IP="Frog"
defadd_ip():
new_IP=input("Please enter the IP address you wish to add\n")
IP_list.append(new_IP)
main()
defremove_ip():
print(IP_list)
deleted_IP=int(input("What number of the IP you'd like to remove?\n(1 for the first, 2 for the second etc.)\n"))
IP_list.pop(deleted_IP-1)
main()
defreplace_ip():
action_counter=0
stale_IP=input("What IP would you like to replace?\n")
fresh_IP=input("What IP would you like to put instead?\n")
foreinrange(len(IP_list)):
ifIP_list[e] ==stale_IP:
IP_list[e] =fresh_IP
action_counter+=1
print(f"{stale_IP} was replaced with {fresh_IP}, {action_counter} times.")
main()
defshow_list():
print(f"The current list of IP addresses is\n{IP_list}")
main()
defshow_menu():
print("OPTIONS ~\n1. Add a new IP address to your list\n2. Remove an existing IP address according to its position on the list\n3. Replace all instances of an existing IP address with a new one\n4. Show the current IP list\n5. Show this menu\n6. Exit the program")
main()
defend_program():
print("Goodbye")
exit()
defmain():
choice=int(input("\nWhat would you like to do?\n(Enter a number between 1-6 to make your choice, press 5 for help)\n"))
ifchoice==1:
add_ip()
elifchoice==2:
remove_ip()
elifchoice==3:
replace_ip()
elifchoice==4:
show_list()
elifchoice==5:
show_menu()
else:
end_program()
# Initial call to start the program
print('''$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n
\tWelcome to the Shadow Wizard IP Address Manager\n
\t\t ~-We love Managing IP Addresses-~
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n''')
main()