-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPythonTools_V2.py
63 lines (53 loc) · 1.76 KB
/
PythonTools_V2.py
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
#Tools
import subprocess
import os
def menu():
print("\n--- Main Menu ---")
print("1. System info")
print("2. Network Tools")
print("3. Admin Tools")
print("4. File Share")
print("5. Exit")
def menu_system():
os.system('clear')
while True:
print("1. Display OS Information")
print("2. Display Users with UID >= 1000")
print("3. Show Network Connections")
print("4. Exit")
choice = input("Choose an option (1-4): ")
if choice == '1':
# Run the command to display OS information
subprocess.run(["cat", "/etc/os-release"])
elif choice == '2':
# Run the awk command to filter users with UID >= 1000
subprocess.run(["awk", "-F:", "$3 >= 1000 { print $1 }", "/etc/passwd"])
elif choice == '3':
# Run the command to display network information
subprocess.run(["nmcli"])
elif choice == '4':
print("Exiting the program. Goodbye!")
break
else:
print("Invalid choice. Please choose a number between 1 and 4.")
#================================-Main-=========================================================
def main():
while True:
menu()
choice = input("Choose an option (1-5): ")
if choice == '1':
menu_system()
elif choice == '2':
add_numbers()
elif choice == '3':
subtract_numbers()
elif choice == '4':
multiply_numbers()
elif choice == '5':
print("Exiting the program. Goodbye!")
break
else:
print("Invalid choice. Please choose a number between 1 and 5.")
# Run the program
if __name__ == "__main__":
main()