-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.py
253 lines (229 loc) · 10.5 KB
/
menu.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# Welcome to the scripting project for the Linux Server course.
from UsersGroups import creat_user, creat_group, delete_user, delete_group, creat_user_en, creat_group_en, delete_user_en, delete_group_en
from PasswordMgm import password_change, block_access, unblock_access, password_change_en, block_access_en, unblock_access_en
from FileFolMgm import file_permission, folder_permission, change_filepermission, change_folderpermission, file_permission_en, folder_permission_en, change_filepermission_en, change_folderpermission_en
from GestionService import service_status, service_start, service_stop, service_restart, service_status_en, service_start_en ,service_stop_en ,service_restart_en
from ProcessusMgm import affiche_processus, stop_processus, affiche_processus_en, stop_processus_en
print("############################################################")
print("Project Owner : Nader Sipahy")
print("Owner Contact : [email protected]")
print("Date : 03/12/2024")
print("############################################################")
print("")
print("")
print("")
print ("Veuillez vous utiliser le script dans la langue francaise (option 1) / Would you like to use the script in english language (option 2) ")
languageOption = input("Veuillez choisir la langues de votre choix : ")
while True:
if languageOption == "1":
print("Veuillez choisir l'une des options suivantes: ")
print("Option 1 : Gestion des utilisateurs et des groupes")
print("Option 2 : Gestion des mots de passe (réinitialiser, modifier, bloquer l'accès)")
print("Option 3 : Gestion des permissions des dossiers et fichiers")
print("Option 4 : Gestion des services")
print("Option 5 : Gestion des processus")
print("Option 6 : Quitter")
option = input("Veuillez sélectionner l'une des options: ")
while True:
if option == "1":
print("Option 1 : Créer un utilisateur")
print("Option 2 : Créer un groupe")
print("Option 3 : Supprimer un utilisateur")
print("Option 4 : Supprimer un groupe")
print("Option 5 : Quitter")
subOption = input("Veuillez sélectionner l'une des options: ")
if subOption == "1":
creat_user()
elif subOption == "2":
creat_group()
elif subOption == "3":
delete_user()
elif subOption == "4":
delete_group()
elif subOption == "5":
print("Quitter")
break
else:
print ("Option invalide")
elif option == "2":
print("Option 1 : Changement de mot de passe")
print("Option 2 : Bloquer l'accès")
print("Option 3 : Debloquer l'accès")
print("Option 4 : Quitter")
subOption = input("Veuillez sélectionner l'une des options: ")
if subOption == "1":
password_change()
elif subOption == "2":
block_access()
elif subOption == "3":
unblock_access()
elif subOption == "4":
print("Quitter")
break
else:
print ("Option invalide")
elif option == "3":
print("Option 1 : Afficher les permissions d'un fichier")
print("Option 2 : Afficher les permissions d'un dossier")
print("Option 3 : Changer les permissions d'un fichier")
print("Option 4 : Changer les permissions d'un dossier")
print("Option 5 : Quitter")
subOption = input("Veuillez sélectionner l'une des options: ")
if subOption == "1":
file_permission()
elif subOption == "2":
folder_permission()
elif subOption == "3":
change_filepermission()
elif subOption == "4":
change_folderpermission()
elif subOption == "5":
print("Quitter")
break
else:
print ("Option invalide")
elif option == "4":
print("Option 1 : Afficher le statut d'un service")
print("Option 2 : Démarrer un service")
print("Option 3 : Arrêter un service")
print("Option 4 : Redémarrer un service")
print("Option 5 : Quitter")
subOption = input("Veuillez sélectionner l'une des options: ")
if subOption == "1":
service_status()
elif subOption == "2":
service_start()
elif subOption == "3":
service_stop()
elif subOption == "4":
service_restart()
elif subOption == "5":
print("Quitter")
break
else:
print ("Option invalide")
elif option == "5":
print("Option 1 : Afficher les processus")
print("Option 2 : Arrêter un processus")
print("Option 3 : Quitter")
subOption = input("Veuillez sélectionner l'une des options: ")
if subOption == "1":
affiche_processus()
elif subOption == "2":
affiche_processus()
stop_processus()
elif subOption == "3":
print("Quitter")
else:
print ("Option invalide")
elif option == "6":
break
if option == "6":
break
#English version
if languageOption == "2":
print("Please choose one of the following options : ")
print("Option 1 : User and Group Management")
print("Option 2 : Password Management (reset, modify, block access)")
print("Option 3 : Management of Folder and File Permissions")
print("Option 4 : Service Management")
print("Option 5 : Process Management")
print("Option 6 : Exit")
option = input("Please select one of the options:")
while True:
if option == "1":
print("Option 1 : Create a user")
print("Option 2 : Create a group")
print("Option 3 : Delete a user")
print("Option 4 : Delete a group")
print("Option 5 : Exit")
subOption = input("Please select one of the options : ")
if subOption == "1":
creat_user_en()
elif subOption == "2":
creat_group_en()
elif subOption == "3":
delete_user_en()
elif subOption == "4":
delete_group_en()
elif subOption == "5":
print("Exit")
break
else:
print ("Invalid option")
elif option == "2":
print("Option 1 : Change password")
print("Option 2 : Block access")
print("Option 3 : Unblock access")
print("Option 4 : Exit")
subOption = input("Please select one of the options : ")
if subOption == "1":
password_change_en()
elif subOption == "2":
block_access_en()
elif subOption == "3":
unblock_access_en()
elif subOption == "4":
print("Exit")
break
else:
print ("Invalid option")
elif option == "3":
print("Option 1: Display file permissions")
print("Option 2: Display folder permissions")
print("Option 3: Change file permissions")
print("Option 4: Change folder permissionsns")
print("Option 5 : Exit")
subOption = input("Please select one of the options : ")
if subOption == "1":
file_permission_en()
elif subOption == "2":
folder_permission_en()
elif subOption == "3":
change_filepermission_en()
elif subOption == "4":
change_folderpermission_en()
elif subOption == "5":
print("Exit")
break
else:
print ("Invalid option")
elif option == "4":
print("Option 1: Display the status of a service")
print("Option 2: Start a service")
print("Option 3: Stop a service")
print("Option 4: Restart a service")
print("Option 5 : Exit")
subOption = input("Please select one of the options : ")
if subOption == "1":
service_status_en()
elif subOption == "2":
service_start_en()
elif subOption == "3":
service_stop_en()
elif subOption == "4":
service_restart_en()
elif subOption == "5":
print("Quitter")
break
else:
print ("Invalid option")
elif option == "5":
print("Option 1: Display processes")
print("Option 2: Stop a process")
print("Option 3 : Exit")
subOption = input("Please select one of the options : ")
if subOption == "1":
affiche_processus_en()
elif subOption == "2":
affiche_processus_en()
stop_processus()
elif subOption == "3":
print("Exit")
break
else:
print ("Invalid option")
elif option == "6":
break
if option == "6":
break