├── .travis.yml ├── .github └── workflows │ └── pythonapp.yml ├── LICENSE ├── README.md └── gam.py /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | jobs: 3 | include: 4 | - name: "Python 3.9 on Focal Linux" 5 | os: linux 6 | dist: focal 7 | python: 3.9 8 | - name: "Python 3.9.0 on Windows" 9 | os: windows # Windows 10.0.17134 N/A Build 17134 10 | language: shell # 'language: python' is an error on Travis CI Windows 11 | before_install: 12 | - choco install python --version 3.9.0 13 | - python -m pip install --upgrade pip 14 | env: PATH=/c/Python39:/c/Python39/Scripts:$PATH 15 | install: 16 | - pip3 install --upgrade pip 17 | - pip3 install --upgrade pyinstaller 18 | - pip3 install --upgrade flake8 19 | script: 20 | - flake8 . --count --max-complexity=12 --statistics 21 | - pyinstaller gam.py --onefile 22 | -------------------------------------------------------------------------------- /.github/workflows/pythonapp.yml: -------------------------------------------------------------------------------- 1 | name: Build GAM Frontend 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v1 12 | - name: Set up Python 3.7 13 | uses: actions/setup-python@v1 14 | with: 15 | python-version: 3.7 16 | - name: Install dependencies 17 | run: | 18 | python -m pip install --upgrade pip 19 | pip install --upgrade pyinstaller 20 | - name: Lint with flake8 21 | run: | 22 | pip install flake8 23 | # stop the build if there are Python syntax errors or undefined names 24 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics 25 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide 26 | flake8 . --count --max-complexity=12 --statistics 27 | - name: Setup GAM Frontend 28 | run: | 29 | pyinstaller gam.py --onefile 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Luke Strohm 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GAM-Frontend 2 | 3 | [![Build Status](https://travis-ci.com/strohmy86/GAM-Frontend.svg?branch=master)](https://travis-ci.com/strohmy86/GAM-Frontend) 4 | 5 | ## Front End Python program for [GAMADV-XTD3 by Ross Scroggs](https://github.com/taers232c/GAMADV-XTD3 "GAMADV-XTD3 by Ross Scroggs") 6 | 7 | **_You must first install and configure [GAMADV-XTD3 by Ross Scroggs](https://github.com/taers232c/GAMADV-XTD3 "GAMADV-XTD3 by Ross Scroggs")_**. I have included the installer for GAMADV-XTD3 in the [Release](https://github.com/strohmy86/GAM/releases "Releases"). 8 | 9 | This Python program is written in Python 3 and assumes that you are running Linux with the default install location (`~/bin/gamadv-xtd3/`) for GAMADV-XTD3. If your environment is different, you will need to change the code to meet your needs. 10 | 11 | This program does not yet contain all of GAMADV-XTD3's capabilities, but I am regularly adding functionality. Check back often for updates and added features. 12 | 13 | I am always looking for suggestions. Please feel free to add your suggestions for features that are not yet included in this program. 14 | 15 | ### Install Instructions 16 | 17 | If you wish to convert this python program to a single executable, follow the following instructions: 18 | 19 | 1. Make your domain-specific changes to `gam.py` as mentioned on line 28. 20 | 2. Make sure that you have the `pyinstaller` module installed: 21 | * `sudo pip3 install pyinstaller` 22 | * If already installed you should make sure it's up to date: `sudo pip3 install --upgrade pyinstaller` 23 | * In Windows run `pip install pyinstaller` from an Administrative PowerShell window. 24 | * If already installed you should make sure it's up to date: `pip install --upgrade pyinstaller` 25 | 26 | 3. CD to the `GAM-Frontend` directory 27 | 4. Run the following command: `pyinstaller gam.py --onefile` 28 | * This will create various directories and a `gam.spec` file. The executable will be in the `dist` directory. You can delete all other files and directories and the gam executable will still function fine. 29 | -------------------------------------------------------------------------------- /gam.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # MIT License 4 | 5 | # Copyright (c) 2020 Luke Strohm 6 | 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | 14 | # The above copyright notice and this permission notice shall be included in 15 | # all copies or substantial portions of the Software. 16 | 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | # SOFTWARE. 24 | 25 | # This program relies on GAMADV-XTD3 to function. You must install and 26 | # configure it before using this program. 27 | 28 | # See lines 689, 785, 1013, 1023, 1032, 1058, and 1067 29 | # for a domain specific setting that will need changed. 30 | 31 | 32 | import os 33 | import time 34 | 35 | 36 | class Color: 37 | PURPLE = "\033[95m" 38 | CYAN = "\033[96m" 39 | DARKCYAN = "\033[36m" 40 | BLUE = "\033[94m" 41 | GREEN = "\033[92m" 42 | YELLOW = "\033[93m" 43 | RED = "\033[91m" 44 | BOLD = "\033[1m" 45 | UNDERLINE = "\033[4m" 46 | END = "\033[0m" 47 | 48 | 49 | class Gam: # Various GAM arguments 50 | g = "~/bin/gamadv-xtd3/gam " 51 | u = "~/bin/gamadv-xtd3/gam user " 52 | gr = "~/bin/gamadv-xtd3/gam group " 53 | ou = "~/bin/gamadv-xtd3/gam ou " 54 | a = "~/bin/gamadv-xtd3/gam all users " 55 | up = "~/bin/gamadv-xtd3/gam update " 56 | add = "add" 57 | remove = "remove" 58 | de = "~/bin/gamadv-xtd3/gam delete " 59 | c = "~/bin/gamadv-xtd3/gam create " 60 | i = "~/bin/gamadv-xtd3/gam info " 61 | 62 | 63 | class Msgs: # Various repeated messages 64 | cont = "Press ENTER to Continue..." 65 | err = "Invalid Option Selected!" 66 | choose = "Please Choose an Option: " 67 | ent = "Entity to apply to: [user | group | ou | all users] " 68 | 69 | 70 | def cred(): 71 | print( 72 | Color.DARKCYAN 73 | + "\n" 74 | + "*********************************\n" 75 | + "* Python 3 Frontend for *\n" 76 | + "* GAMADV-XTD3 by Ross Scroggs *\n" 77 | + "* *\n" 78 | + "* Written and maintained by *\n" 79 | + "* Luke Strohm *\n" 80 | + "* strohm.luke@gmail.com *\n" 81 | + "* https://github.com/strohmy86 *\n" 82 | + "* *\n" 83 | + "*********************************\n" 84 | + "\n" 85 | + Color.END 86 | ) 87 | 88 | 89 | def main_menu(): # Main Menu 90 | while True: 91 | print(Color.PURPLE + "\nMain Menu:\n" + Color.END) 92 | print("1) User Management") 93 | print("2) Calendar Management") 94 | print("3) Drive Management") 95 | print("4) Group Management") 96 | print("5) Classroom Management") 97 | print("6) Device Management") 98 | print("7) Email Management") 99 | print("8) Bulk Operations") 100 | print("9) Vault Management") 101 | print("\n0) Exit\n") 102 | selection1 = input(Color.BOLD + Msgs.choose + Color.END) 103 | if selection1 == "0": 104 | exit() 105 | elif selection1 == "1": 106 | users() 107 | elif selection1 == "2": 108 | calendar() 109 | elif selection1 == "3": 110 | drive() 111 | elif selection1 == "4": 112 | groups() 113 | elif selection1 == "5": 114 | classroom() 115 | elif selection1 == "6": 116 | devices() 117 | elif selection1 == "7": 118 | email() 119 | elif selection1 == "8": 120 | bulk() 121 | elif selection1 == "9": 122 | vault() 123 | else: 124 | print(Color.RED + Msgs.err + "\n" + Color.END) 125 | time.sleep(1) 126 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 127 | 128 | 129 | def users(): # User Management Main Menu 130 | while True: 131 | print(Color.PURPLE + "\nUser Management Menu:\n" + Color.END) 132 | print("1) User Information") 133 | print("2) Export List of All Users") 134 | print("3) Activate Suspended User") 135 | print("4) Suspend User") 136 | print("5) Transfer Drive Files") 137 | print("6) Manage Verification Codes") 138 | print("7) Manage User(s) Photo") 139 | print("\n0) Back\n") 140 | selection = input(Color.BOLD + Msgs.choose + Color.END) 141 | if selection == "1": # User Info menu item 142 | username = input( 143 | Color.BOLD + "Please enter a username: " + Color.END 144 | ) 145 | cmd = Gam.g + "info user " + username 146 | os.system(cmd) 147 | time.sleep(2) 148 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 149 | users() 150 | elif selection == "2": # Export users menu item 151 | cmd = ( 152 | Gam.g 153 | + "redirect csv ~/Userlist.csv multiprocess print " 154 | + "users allfields" 155 | ) 156 | os.system(cmd) 157 | print(Color.YELLOW + "\nUserlist.csv saved." + Color.END) 158 | time.sleep(2) 159 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 160 | users() 161 | elif selection == "3": # Activate suspended user menu item 162 | username = input( 163 | Color.BOLD + "Please enter a username: " + Color.END 164 | ) 165 | cmd = Gam.g + " update user " + username + " suspended off" 166 | cmd2 = "~/bin/gamadv-xtd3/gam info user " + username 167 | os.system(cmd) 168 | time.sleep(2) 169 | os.system(cmd2) 170 | time.sleep(2) 171 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 172 | users() 173 | elif selection == "4": # Suspend a user menu item 174 | username = input(Color.BOLD + "Enter a username: " + Color.END) 175 | cmd = Gam.g + " update user " + username + " suspended on" 176 | os.system(cmd) 177 | time.sleep(2) 178 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 179 | users() 180 | elif selection == "5": # Transfer files from one user to another 181 | user = input( 182 | Color.BOLD 183 | + "Please enter username of source " 184 | + "drive: " 185 | + Color.END 186 | ) 187 | user2 = input( 188 | Color.BOLD 189 | + "Please enter username of destination" 190 | + " drive: " 191 | + Color.END 192 | ) 193 | cmd = ( 194 | Gam.c 195 | + "datatransfer " 196 | + user 197 | + " gdrive " 198 | + user2 199 | + " privacy_level shared,private" 200 | ) 201 | os.system(cmd) 202 | time.sleep(2) 203 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 204 | users() 205 | elif selection == "6": # Manage Verificaion Codes 206 | user = input(Color.BOLD + "Enter a username: " + Color.END) 207 | act = input( 208 | Color.BOLD 209 | + "Show or Delete Codes? [show | del] " 210 | + Color.END 211 | ) 212 | cmd = Gam.u + user + " " + act + " backupcodes" 213 | os.system(cmd) 214 | time.sleep(2) 215 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 216 | users() 217 | elif selection == "7": # Manage Photo 218 | users7() 219 | elif selection == "0": # Back to main menu 220 | main_menu() 221 | else: # Invalid selection. Return to this menu. 222 | print(Color.RED + Msgs.err + "\n" + Color.END) 223 | time.sleep(2) 224 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 225 | users() 226 | 227 | 228 | def users7(): # Photo Management 229 | while True: 230 | print(Color.PURPLE + "\nPhoto Management Menu:\n" + Color.END) 231 | print( 232 | "1) Upload Profile Photo(s) *Same photo for 1 or more " 233 | + "user(s)*" 234 | ) 235 | print("2) Mass Upload Photos *Different photos for multiple users*") 236 | print("3) Download User(s) Profile Photo") 237 | print("4) Delete User(s) Profile Photo") 238 | print("\n0) Back\n") 239 | selection = input(Color.BOLD + Msgs.choose + Color.END) 240 | if selection == "1": # Upload same photo to 1 or more users 241 | users7_1() 242 | elif selection == "2": # Upload different photos for multiple users 243 | users7_2() 244 | elif selection == "3": # Download photos of 1 or more users 245 | users7_3() 246 | elif selection == "4": # Delete photo of 1 or more users 247 | users7_4() 248 | elif selection == "0": 249 | users() 250 | else: 251 | print(Color.RED + Msgs.err + "\n" + Color.END) 252 | time.sleep(2) 253 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 254 | users7() 255 | 256 | 257 | def users7_1(): # Upload same photo to 1 or more users 258 | who = input(Color.BOLD + Msgs.ent + Color.END) 259 | photo = input( 260 | Color.BOLD + "Enter the full path of the photo: " + Color.END 261 | ) 262 | if who == "user" or who == "group": 263 | user = input(Color.BOLD + "Enter a name: " + Color.END) 264 | cmd = Gam.g + who + " update photo " + photo 265 | elif who == "ou": 266 | user = input( 267 | Color.BOLD 268 | + "Please enter an OU (Case Sensitive" 269 | + ", Full Path): " 270 | + Color.END 271 | ) 272 | cmd = Gam.ou + '"' + user + '" update photo ' + photo 273 | elif who == "all" or who == "all users": 274 | cmd = Gam.a + "update photo " + photo 275 | else: 276 | print(Color.RED + Msgs.err + "\n" + Color.END) 277 | time.sleep(2) 278 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 279 | users7_1() 280 | os.system(cmd) 281 | time.sleep(2) 282 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 283 | users7() 284 | 285 | 286 | def users7_2(): # Mass upload different photos for multiple users 287 | print( 288 | Color.YELLOW + "Photo names need to be formatted as such:" + Color.END 289 | ) 290 | print(Color.RED + Color.BOLD + "#username#.jpg\n" + Color.END) 291 | srcdir = input( 292 | Color.BOLD 293 | + "Enter the source directory containing the " 294 | + 'photos, with trailing "/": ' 295 | + Color.END 296 | ) 297 | who = input( 298 | Color.BOLD + "Entity to apply to: [ou | all users] " + Color.END 299 | ) 300 | if who == "ou": 301 | user = input( 302 | Color.BOLD 303 | + "Please enter an OU (Case Sensitive" 304 | + ", Full Path): " 305 | + Color.END 306 | ) 307 | cmd = ( 308 | Gam.ou 309 | + '"' 310 | + user 311 | + '" update photo sourcefolder ' 312 | + srcdir 313 | + " filename ./#username#.jpg" 314 | ) 315 | elif who == "all" or who == "all users": 316 | cmd = Gam.a + "update photo " + srcdir + " filename ./#username#.jpg" 317 | else: 318 | print(Color.RED + Msgs.err + "\n" + Color.END) 319 | time.sleep(2) 320 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 321 | users7_2() 322 | os.system(cmd) 323 | time.sleep(2) 324 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 325 | users7() 326 | 327 | 328 | def users7_3(): # Download photos of 1 or more users 329 | who = input(Color.BOLD + Msgs.ent + Color.END) 330 | destdir = input( 331 | Color.BOLD 332 | + "Enter the destination directory to save " 333 | + 'the photos, with trailing "/": ' 334 | + Color.END 335 | ) 336 | if who == "user" or who == "group": 337 | user = input(Color.BOLD + "Enter a name: " + Color.END) 338 | cmd = ( 339 | Gam.g 340 | + who 341 | + " get photo targetfolder " 342 | + destdir 343 | + " filename " 344 | + "./#username#.jpg noshow" 345 | ) 346 | elif who == "ou": 347 | user = input( 348 | Color.BOLD 349 | + "Please enter an OU (Case Sensitive" 350 | + ", Full Path): " 351 | + Color.END 352 | ) 353 | cmd = ( 354 | Gam.ou 355 | + '"' 356 | + user 357 | + '" get photo targetfolder ' 358 | + destdir 359 | + " filename ./#username#.jpg noshow" 360 | ) 361 | elif who == "all" or who == "all users": 362 | cmd = ( 363 | Gam.a 364 | + "get photo targetfolder " 365 | + destdir 366 | + " filename " 367 | + "./#username#.jpg noshow" 368 | ) 369 | else: 370 | print(Color.RED + Msgs.err + "\n" + Color.END) 371 | time.sleep(2) 372 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 373 | users7_3() 374 | os.system(cmd) 375 | time.sleep(2) 376 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 377 | users7() 378 | 379 | 380 | def users7_4(): # Delete photo of 1 or more users 381 | who = input(Color.BOLD + Msgs.ent + Color.END) 382 | if who == "user" or who == "group": 383 | user = input(Color.BOLD + "Enter a name: " + Color.END) 384 | cmd = Gam.g + who + " del photo" 385 | elif who == "ou": 386 | user = input( 387 | Color.BOLD 388 | + "Please enter an OU (Case Sensitive" 389 | + ", Full Path): " 390 | + Color.END 391 | ) 392 | cmd = Gam.ou + '"' + user + '" del photo' 393 | elif who == "all" or who == "all users": 394 | cmd = Gam.a + "del photo" 395 | else: 396 | print(Color.RED + Msgs.err + "\n" + Color.END) 397 | time.sleep(2) 398 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 399 | users7_4() 400 | os.system(cmd) 401 | time.sleep(2) 402 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 403 | users7() 404 | 405 | 406 | def calendar(): # Calendar Management Main Menu 407 | while True: 408 | print(Color.PURPLE + "\nCalendar Management Menu:\n" + Color.END) 409 | print("1) Show Permissions For a Calendar") 410 | print("2) Add or Remove Calendar Permissions") 411 | print("3) Delete a Calendar Event") 412 | print("4) List a User's Calendar(s)") 413 | print( 414 | "5) Delete a User's Calendar (Can't delete default " 415 | + "calendar)" 416 | ) 417 | print("6) Add a Calendar to a User") 418 | print("\n0) Back\n") 419 | selection = input(Color.BOLD + Msgs.choose + Color.END) 420 | if selection == "1": # Calendar permissions menu item 421 | cal = input( 422 | Color.BOLD 423 | + "Please enter a Google Calendar email" 424 | + " address:" 425 | + Color.END 426 | ) 427 | cmd = Gam.g + " calendar " + cal + " showacl" 428 | os.system(cmd) 429 | time.sleep(2) 430 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 431 | calendar() 432 | elif selection == "2": # Change permissions menu item 433 | calendar2() 434 | elif selection == "3": # Delete event menu item 435 | calendar3() 436 | elif selection == "4": # List calendars menu item 437 | calendar4() 438 | elif selection == "5": # Delete calendar menu item 439 | calendar5() 440 | elif selection == "6": # Add calendar to user menu item 441 | calendar6() 442 | elif selection == "0": # Back to main menu 443 | main_menu() 444 | else: # Invalid menu selection error. Returns to current menu 445 | print(Color.RED + Msgs.err + "\n" + Color.END) 446 | time.sleep(2) 447 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 448 | calendar() 449 | 450 | 451 | def calendar2(): # Calendar menu option 2 452 | cal = input( 453 | Color.BOLD 454 | + "Please enter a Google Calendar email " 455 | + "address: " 456 | + Color.END 457 | ) 458 | ar = input( 459 | Color.BOLD + "What would you like to do? [add | remove] " + Color.END 460 | ) 461 | user = input( 462 | Color.BOLD + "User to add to/remove from the Calendar: " + Color.END 463 | ) 464 | if ar == "add" or ar == "Add" or ar == "a": 465 | act = input( 466 | Color.BOLD 467 | + "What permission would you like to grant? " 468 | + "[read | edit | owner]" 469 | + Color.END 470 | ) 471 | cmd = Gam.g + " calendar " + cal + " add " + act + " " + user 472 | os.system(cmd) 473 | time.sleep(2) 474 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 475 | calendar() 476 | elif ( 477 | ar == "rem" 478 | or ar == "remove" 479 | or ar == "r" 480 | or ar == "Remove" 481 | or ar == "Rem" 482 | ): 483 | cmd = Gam.g + " calendar " + cal + " delete user " + user 484 | os.system(cmd) 485 | time.sleep(2) 486 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 487 | calendar() 488 | else: 489 | print(Color.RED + Msgs.err + "\n" + Color.END) 490 | time.sleep(2) 491 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 492 | calendar() 493 | 494 | 495 | def calendar3(): # Calendar menu option 3 496 | cal = input( 497 | Color.BOLD 498 | + "Please enter a Google Calendar email" 499 | + " address:" 500 | + Color.END 501 | ) 502 | ev = input(Color.BOLD + "Enter the event ID:" + Color.END) 503 | yn = input( 504 | Color.BOLD 505 | + "Are you sure? THIS CANNOT BE UNDONE!! " 506 | + "[y/N]" 507 | + Color.END 508 | ) 509 | if yn == "" or yn == "N" or yn == "n" or yn == "no" or yn == "No": 510 | calendar() 511 | elif yn == "y" or yn == "Y" or yn == "yes" or yn == "Yes": 512 | cmd = Gam.g + " calendar " + cal + " deleteevent " + ev + " doit" 513 | os.system(cmd) 514 | time.sleep(2) 515 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 516 | calendar() 517 | 518 | 519 | def calendar4(): # Calendar menu option 4 520 | who = input(Color.BOLD + Msgs.ent + Color.END) 521 | if who == "user": 522 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 523 | cmd = Gam.u + user + " show calendars" 524 | elif who == "group": 525 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 526 | cmd = Gam.gr + user + " show calendars" 527 | elif who == "ou": 528 | user = input( 529 | Color.BOLD 530 | + "Please enter an OU (Case Sensitive" 531 | + ", Full Path): " 532 | + Color.END 533 | ) 534 | cmd = Gam.ou + ' "' + user + '" show calendars' 535 | elif who == "all" or who == "all users": 536 | cmd = Gam.a + " show calendars" 537 | else: 538 | print(Color.RED + Msgs.err + "\n" + Color.END) 539 | time.sleep(2) 540 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 541 | calendar4() 542 | os.system(cmd) 543 | time.sleep(2) 544 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 545 | calendar() 546 | 547 | 548 | def calendar5(): # Calendar menu option 5 549 | cal = input( 550 | Color.BOLD 551 | + "Please enter a Google Calendar email " 552 | + "address:" 553 | + Color.END 554 | ) 555 | who = input(Color.BOLD + Msgs.ent + Color.END) 556 | if who == "user": 557 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 558 | cmd = Gam.u + user + " delete calendar " + cal 559 | elif who == "group": 560 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 561 | cmd = Gam.gr + user + " delete calendar " + cal 562 | elif who == "ou": 563 | user = input( 564 | Color.BOLD 565 | + "Please enter an OU (Case Sensitive" 566 | + ", Full Path): " 567 | + Color.END 568 | ) 569 | cmd = Gam.ou + ' "' + user + '" delete calendar ' + cal 570 | elif who == "all" or who == "all users": 571 | cmd = Gam.a + " delete calendar " + cal 572 | else: 573 | print(Color.RED + Msgs.err + "\n" + Color.END) 574 | time.sleep(2) 575 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 576 | calendar5() 577 | os.system(cmd) 578 | time.sleep(2) 579 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 580 | calendar() 581 | 582 | 583 | def calendar6(): # Calendar menu option 6 584 | cal = input( 585 | Color.BOLD 586 | + "Please enter a Google Calendar email " 587 | + "address:" 588 | + Color.END 589 | ) 590 | who = input(Color.BOLD + Msgs.ent + Color.END) 591 | if who == "user": 592 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 593 | cmd = ( 594 | Gam.u 595 | + user 596 | + " add calendar " 597 | + cal 598 | + " selected true hidden false" 599 | ) 600 | elif who == "group": 601 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 602 | cmd = ( 603 | Gam.gr 604 | + user 605 | + " add calendar " 606 | + cal 607 | + " selected true hidden false" 608 | ) 609 | elif who == "ou": 610 | user = input( 611 | Color.BOLD 612 | + "Please enter an OU (Case Sensitive" 613 | + ", Full Path): " 614 | + Color.END 615 | ) 616 | cmd = ( 617 | Gam.ou 618 | + ' "' 619 | + user 620 | + '" add calendar ' 621 | + cal 622 | + " selected true " 623 | + "hidden false" 624 | ) 625 | elif who == "all" or who == "all users": 626 | cmd = Gam.a + " add calendar " + cal + " selected true hidden false" 627 | else: 628 | print(Color.RED + Msgs.err + "\n" + Color.END) 629 | time.sleep(2) 630 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 631 | calendar6() 632 | os.system(cmd) 633 | time.sleep(2) 634 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 635 | calendar() 636 | 637 | 638 | def drive(): # Drive Management Main Menu 639 | while True: 640 | print(Color.PURPLE + "\nDrive Management Menu:\n" + Color.END) 641 | print("1) Export a List of a User(s) Drive Files") 642 | print("2) Upload a Local File To a Google Drive") 643 | print("3) Download File(s) from a Google Drive") 644 | print("4) Delete a User's Drive File") 645 | print("5) View a Shared Drive(s)") 646 | print("6) Create a Shared Drive") 647 | print("7) Delete a Shared Drive") 648 | print("\n0) Back\n") 649 | selection = input(Color.BOLD + Msgs.choose + Color.END) 650 | if selection == "1": # Export file list menu item 651 | drive1() 652 | elif selection == "2": # Upload file menu item 653 | drive2() 654 | elif selection == "3": # Download Drive File(s) 655 | drive3() 656 | elif selection == "4": # Delete User's drive file 657 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 658 | file = input( 659 | Color.BOLD 660 | + "Please enter the file ID to be " 661 | + "deleted: " 662 | + Color.END 663 | ) 664 | cmd = Gam.u + user + " delete drivefile " + file + " purge" 665 | os.system(cmd) 666 | time.sleep(2) 667 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 668 | drive() 669 | elif selection == "5": # View Shared Drives menu item 670 | drive5() 671 | elif selection == "6": # Create team drive for user menu item 672 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 673 | name = input( 674 | Color.BOLD 675 | + "What is the name of the Shared Drive?" 676 | + Color.END 677 | ) 678 | cmd = Gam.g + " user " + user + ' add teamdrive "' + name + '"' 679 | os.system(cmd) 680 | time.sleep(2) 681 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 682 | drive() 683 | elif selection == "7": # Delete user's Shared Drive menu item 684 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 685 | dr_id = input( 686 | Color.BOLD 687 | + "What is the Shared Drive ID? " 688 | + "(Not the name)" 689 | + Color.END 690 | ) 691 | cmd = Gam.g + " user " + user + " delete teamdrive " + dr_id 692 | os.system(cmd) 693 | time.sleep(2) 694 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 695 | drive() 696 | elif selection == "0": # Return to main menu 697 | main_menu() 698 | else: # Invalid selection. Returns to this menu 699 | print(Color.RED + Msgs.err + "\n" + Color.END) 700 | time.sleep(2) 701 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 702 | drive() 703 | 704 | 705 | def drive1(): # Drive menu option 1 706 | who = input(Color.BOLD + Msgs.ent + Color.END) 707 | if who == "user" or who == "group": 708 | user = input(Color.BOLD + "Enter a name: " + Color.END) 709 | user1 = user 710 | cmd = ( 711 | Gam.g 712 | + "redirect csv ~/" 713 | + user 714 | + "-filelist.csv " 715 | + "multiprocess " 716 | + who 717 | + " " 718 | + user 719 | + " print filelist allfields" 720 | ) 721 | elif who == "ou": 722 | user = input( 723 | Color.BOLD 724 | + "Please enter an OU (Case Sensitive" 725 | + ", Full Path): " 726 | + Color.END 727 | ) 728 | user1 = user.split("/")[-1] 729 | cmd = ( 730 | Gam.g 731 | + "redirect csv ~/" 732 | + user1 733 | + "-filelist.csv " 734 | + 'multiprocess ou "' 735 | + user 736 | + '" print filelist allfields' 737 | ) 738 | elif who == "all" or who == "all users": 739 | user1 = "AllUsers" 740 | cmd = ( 741 | Gam.g 742 | + "redirect csv ~/" 743 | + user1 744 | + "-filelist.csv " 745 | + "multiprocess all users print filelist allfields" 746 | ) 747 | else: 748 | print(Color.RED + Msgs.err + "\n" + Color.END) 749 | time.sleep(2) 750 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 751 | drive1() 752 | os.system(cmd) 753 | print( 754 | Color.YELLOW 755 | + "\nFile saved as " 756 | + user1 757 | + "-filelist.csv\n" 758 | + Color.END 759 | ) 760 | time.sleep(2) 761 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 762 | drive() 763 | 764 | 765 | def drive2(): # Drive menu option 2 766 | filename = input( 767 | Color.BOLD 768 | + "Please enter the full path to the" 769 | + " file you wish to upload: (Case Sensitive): " 770 | + Color.END 771 | ) 772 | who = input(Color.BOLD + Msgs.ent + Color.END) 773 | if who == "user": 774 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 775 | cmd = Gam.u + user + " add drivefile localfile " + filename 776 | elif who == "group": 777 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 778 | cmd = Gam.gr + user + " add drivefile localfile " + filename 779 | elif who == "ou": 780 | user = input( 781 | Color.BOLD 782 | + "Please enter an OU (Case Sensitive" 783 | + ", Full Path): " 784 | + Color.END 785 | ) 786 | cmd = Gam.ou + user + " add drivefile localfile " + filename 787 | elif who == "all" or who == "all users": 788 | cmd = Gam.a + " add drivefile localfile " + filename 789 | else: 790 | print(Color.RED + Msgs.err + "\n" + Color.END) 791 | time.sleep(2) 792 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 793 | drive() 794 | os.system(cmd) 795 | print("File uploaded successfully") 796 | time.sleep(2) 797 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 798 | drive() 799 | 800 | 801 | def drive3(): # Drive menu option 3 802 | who = input(Color.BOLD + Msgs.ent + Color.END) 803 | quant = input( 804 | Color.BOLD + "Single file or all files [single | all]: " + Color.END 805 | ) 806 | loc = input( 807 | Color.BOLD + "Enter the full path to the save location: " + Color.END 808 | ) 809 | if quant == "single": 810 | filename = input( 811 | Color.BOLD + "Please enter the filename to download: " + Color.END 812 | ) 813 | filename1 = 'drivefilename "' + filename + '"' 814 | elif quant == "all": 815 | filename = 'query "!me! in owners" ' 816 | filename1 = filename.replace("!", r"'") 817 | else: 818 | filename1 = None # To fix the possibility of an unbound variable 819 | print(Color.RED + Msgs.err + "\n" + Color.END) 820 | time.sleep(2) 821 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 822 | drive3() 823 | if who == "user": 824 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 825 | cmd = ( 826 | Gam.u 827 | + user 828 | + " get drivefile " 829 | + filename1 830 | + " targetfolder " 831 | + loc 832 | + " format microsoft" 833 | ) 834 | elif who == "group": 835 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 836 | cmd = ( 837 | Gam.gr 838 | + user 839 | + " get drivefile " 840 | + filename1 841 | + " targetfolder " 842 | + loc 843 | + " format microsoft" 844 | ) 845 | elif who == "ou": 846 | user = input( 847 | Color.BOLD 848 | + "Please enter an OU (Case Sensitive, Full " 849 | + "Path): " 850 | + Color.END 851 | ) 852 | cmd = ( 853 | Gam.ou 854 | + ' "' 855 | + user 856 | + '" get drivefile ' 857 | + filename1 858 | + " targetfolder " 859 | + loc 860 | + " format microsoft" 861 | ) 862 | elif who == "all" or who == "all users": 863 | cmd = ( 864 | Gam.a 865 | + " get drivefile " 866 | + filename1 867 | + " targetfolder " 868 | + loc 869 | + " format microsoft" 870 | ) 871 | else: 872 | cmd = None # To fix the possibility of an unbound variable 873 | print(Color.RED + Msgs.err + "\n" + Color.END) 874 | time.sleep(2) 875 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 876 | drive3() 877 | os.system(cmd) 878 | 879 | 880 | def drive5(): # Drive menu option 5 881 | who = input(Color.BOLD + Msgs.ent + Color.END) 882 | if who == "user": 883 | user = input(Color.BOLD + "Please enter username: " + Color.END) 884 | cmd = Gam.u + user + " show teamdrives" 885 | elif who == "group": 886 | user = input(Color.BOLD + "Please enter group name: " + Color.END) 887 | cmd = Gam.gr + user + " print teamdrives todrive" 888 | elif who == "ou": 889 | user = input( 890 | Color.BOLD 891 | + "Please enter an OU (Case Sensitive, Full " 892 | + "Path): " 893 | + Color.END 894 | ) 895 | cmd = Gam.ou + '"' + user + '" print teamdrives todrive' 896 | elif who == "all" or who == "all users": 897 | cmd = Gam.a + " print teamdrives todrive" 898 | else: 899 | print(Color.RED + Msgs.err + "\n" + Color.END) 900 | time.sleep(2) 901 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 902 | drive5() 903 | os.system(cmd) 904 | time.sleep(2) 905 | print( 906 | Color.RED 907 | + '\nIf you chose any entity other than "user", a file ' 908 | + "was uploaded to your Google Drive with the Shared Drive " 909 | + "information." 910 | + Color.END 911 | ) 912 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 913 | drive() 914 | 915 | 916 | def groups(): # Groups Management Main Menu 917 | while True: 918 | print(Color.PURPLE + "\nGroup Management Menu:\n" + Color.END) 919 | print("1) Create a Group") 920 | print("2) Rename a Group") 921 | print("3) Add or Remove Group Member") 922 | print("4) Update User Role in a Group") 923 | print("5) Get Group Information") 924 | print("6) Delete a Group") 925 | print("\n0) Back\n") 926 | selection = input(Color.BOLD + Msgs.choose + Color.END) 927 | if selection == "1": # Create group menu item 928 | name = input( 929 | Color.BOLD 930 | + "What is the name of the group to be " 931 | + "created?" 932 | + Color.END 933 | ) 934 | cmd = ( 935 | Gam.g + " create group " + name + "@madisonrams.net" 936 | ) # CHANGE THIS DOMAIN TO MATCH YOURS. 937 | os.system(cmd) 938 | time.sleep(2) 939 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 940 | groups() 941 | elif selection == "2": # Rename group menu item 942 | name = input( 943 | Color.BOLD 944 | + "What is the email address of the " 945 | + "group to be renamed?" 946 | + Color.END 947 | ) 948 | ren = input( 949 | Color.BOLD 950 | + "What is the new name(email address) of " 951 | + "the group?" 952 | + Color.END 953 | ) 954 | cmd = Gam.g + " update group " + name + " email " + ren 955 | os.system(cmd) 956 | time.sleep(2) 957 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 958 | groups() 959 | elif selection == "3": # Add/Remove group member menu item 960 | groups3() 961 | elif selection == "4": # Update user role menu item 962 | name = input( 963 | Color.BOLD + "What is the email address of the group?" 964 | ) 965 | user = input( 966 | Color.BOLD + "What user's role will be modified? " + Color.END 967 | ) 968 | perm = input( 969 | Color.BOLD 970 | + "New role to assign (Must be in Lower " 971 | + "Case): [owner | member | manager]" 972 | + Color.END 973 | ) 974 | cmd = ( 975 | Gam.g 976 | + " update group " 977 | + name 978 | + " update " 979 | + perm 980 | + " user " 981 | + user 982 | ) 983 | os.system(cmd) 984 | time.sleep(2) 985 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 986 | groups() 987 | elif selection == "5": # Group information menu item 988 | name = input( 989 | Color.BOLD + "What is the email address of the group?" 990 | ) 991 | cmd = Gam.g + " info group " + name 992 | os.system(cmd) 993 | time.sleep(2) 994 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 995 | groups() 996 | elif selection == "6": # Delete group menu item 997 | name = input( 998 | Color.BOLD + "What is the email address of the group?" 999 | ) 1000 | cmd = Gam.g + " delete group " + name 1001 | os.system(cmd) 1002 | time.sleep(2) 1003 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1004 | groups() 1005 | elif selection == "0": # Back to main menu 1006 | main_menu() 1007 | else: # Invalid selection. returns to current menu. 1008 | print(Color.RED + Msgs.err + "\n" + Color.END) 1009 | time.sleep(2) 1010 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1011 | groups() 1012 | 1013 | 1014 | def groups3(): # Groups menu option 3 1015 | name = input(Color.BOLD + "What is the email address of the group?") 1016 | ar = input(Color.BOLD + "Add or Remove user? [add | remove]" + Color.END) 1017 | user = input(Color.BOLD + "What user?" + Color.END) 1018 | if ar == "add" or ar == "a" or ar == "Add" or ar == "A": 1019 | cmd = Gam.g + " update group " + name + " add member user " + user 1020 | os.system(cmd) 1021 | time.sleep(2) 1022 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1023 | groups() 1024 | elif ( 1025 | ar == "remove" 1026 | or ar == "r" 1027 | or ar == "R" 1028 | or ar == "Remove" 1029 | or ar == "rem" 1030 | or ar == "Rem" 1031 | ): 1032 | cmd = Gam.g + " update group " + name + " remove user " + user 1033 | os.system(cmd) 1034 | time.sleep(2) 1035 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1036 | groups() 1037 | else: 1038 | print(Color.RED + Msgs.err + "\n" + Color.END) 1039 | time.sleep(2) 1040 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1041 | groups() 1042 | 1043 | 1044 | def classroom(): # Classroom Management Main Menu 1045 | while True: 1046 | print(Color.PURPLE + "\nClassroom Management Main Menu:\n" + Color.END) 1047 | print("1) Manage Courses") 1048 | print("2) Manage Course Participants") 1049 | print("3) Manage Guardians") 1050 | print("4) Reports") 1051 | print("\n0) Back\n") 1052 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1053 | # Manage courses menu item. Calls classroom1() function. 1054 | if selection == "1": 1055 | classroom1() 1056 | elif selection == "2": # Manage course participants menu item 1057 | al = input( 1058 | Color.BOLD + "What is the course ID or alias?" + Color.END 1059 | ) 1060 | act = input( 1061 | Color.BOLD 1062 | + "Do you want to Add or Remove? " 1063 | + "(Must be lower case) [add | remove]" 1064 | + Color.END 1065 | ) 1066 | who = input( 1067 | Color.BOLD 1068 | + "Is the person a student or a teacher? " 1069 | + "(Must be lower case) [student | teacher]" 1070 | + Color.END 1071 | ) 1072 | user = input( 1073 | Color.BOLD + "What is the person's username? " + Color.END 1074 | ) 1075 | cmd = ( 1076 | Gam.g 1077 | + " course " 1078 | + al 1079 | + " " 1080 | + act 1081 | + " " 1082 | + who 1083 | + " " 1084 | + user 1085 | + "@madisonrams.net" 1086 | ) # CHANGE THIS DOMAIN TO MATCH YOURS. 1087 | os.system(cmd) 1088 | time.sleep(2) 1089 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1090 | classroom() 1091 | # Manage guardians menu item. Calls classroom3() function. 1092 | elif selection == "3": 1093 | classroom3() 1094 | elif selection == "4": # Reports menu item. 1095 | classroom4() 1096 | elif selection == "0": # Back to main menu 1097 | main_menu() 1098 | else: # Invalid selection error. Returns to current menu. 1099 | print(Color.RED + Msgs.err + "\n" + Color.END) 1100 | time.sleep(2) 1101 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1102 | classroom() 1103 | 1104 | 1105 | def devices(): # Device Management Main Menu 1106 | while True: 1107 | print( 1108 | Color.PURPLE 1109 | + "\nChrome Device Management Main Menu:\n" 1110 | + Color.END 1111 | ) 1112 | print("1) Get Device ID of a Chrome OS Device") 1113 | print("2) Update Device Info") 1114 | print("3) Export Device Info") 1115 | print("4) Disable, De-provision, or Re-Enable a Device") 1116 | print("5) Print Chrome Device Activity to CSV file") 1117 | print("6) Move Chrome Device") 1118 | print("\n0) Back\n") 1119 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1120 | if selection == "1": # Get ID menu item 1121 | cr_id = input( 1122 | Color.BOLD 1123 | + "Please enter the Chrome Device " 1124 | + "Serial Number (Case sensitive):" 1125 | + Color.END 1126 | ) 1127 | cmd = Gam.g + "info cros cros_sn " + cr_id 1128 | os.system(cmd) 1129 | time.sleep(2) 1130 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1131 | devices() 1132 | elif selection == "2": # Update info menu item 1133 | cr_id = input( 1134 | Color.BOLD 1135 | + "Please enter the Chrome Device " 1136 | + "Serial Number:" 1137 | + Color.END 1138 | ) 1139 | time.sleep(1) 1140 | act = input( 1141 | Color.BOLD 1142 | + "What do you want to update? [location " 1143 | + "| asset id]" 1144 | + Color.END 1145 | ) 1146 | if ( 1147 | act == "location" 1148 | or act == "Location" 1149 | or act == "loc" 1150 | or act == "Loc" 1151 | or act == "L" 1152 | or act == "l" 1153 | ): 1154 | loc = input(Color.BOLD + "Enter new location:" + Color.END) 1155 | cmd2 = ( 1156 | Gam.g 1157 | + "update cros cros_sn " 1158 | + cr_id 1159 | + ' location "' 1160 | + loc 1161 | + '"' 1162 | ) 1163 | os.system(cmd2) 1164 | time.sleep(2) 1165 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1166 | os.system("rm -rf id.txt") 1167 | devices() 1168 | elif ( 1169 | act == "asset" 1170 | or act == "asset id" 1171 | or act == "assetid" 1172 | or act == "Asset" 1173 | or act == "Asset Id" 1174 | or act == "Asset ID" 1175 | or act == "Asset id" 1176 | or act == "A" 1177 | or act == "a" 1178 | ): 1179 | asset = input(Color.BOLD + "Enter new Asset ID:" + Color.END) 1180 | cmd2 = ( 1181 | Gam.g 1182 | + "update cros cros_sn " 1183 | + cr_id 1184 | + ' assetid "' 1185 | + asset 1186 | + '"' 1187 | ) 1188 | os.system(cmd2) 1189 | time.sleep(2) 1190 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1191 | os.system("rm -rf id.txt") 1192 | devices() 1193 | else: 1194 | print(Color.RED + Msgs.err + "\n" + Color.END) 1195 | time.sleep(1) 1196 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1197 | devices() 1198 | elif selection == "3": # Export device info menu item. 1199 | devices3() 1200 | elif selection == "4": # Disable/de-provision/re-enable menu item. 1201 | devices4() 1202 | elif selection == "5": # Export device activity to csv file. 1203 | devices5() 1204 | elif selection == "6": # Move Chrome Device 1205 | devices6() 1206 | elif selection == "0": # Back to main menu 1207 | main_menu() 1208 | else: # Invalid Selection. Returns to current menu 1209 | print(Color.RED + Msgs.err + "\n" + Color.END) 1210 | time.sleep(2) 1211 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1212 | devices() 1213 | 1214 | 1215 | def classroom1(): # Manage Courses 1216 | while True: 1217 | print(Color.CYAN + "Course Management Menu:" + Color.END) 1218 | print("1) Create Course") 1219 | print("2) Update Course") 1220 | print("3) Get Course Info") 1221 | print("4) Delete Course") 1222 | print("\n0) Back\n") 1223 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1224 | if selection == "1": # Create course menu item 1225 | al = input( 1226 | Color.BOLD 1227 | + "What is the course alias? (All lower lase" 1228 | + ", no spaces)" 1229 | ) 1230 | name = input(Color.BOLD + "What is the course name?" + Color.END) 1231 | sec = input( 1232 | Color.BOLD + "What is the course section?(Numbers only)" 1233 | ) 1234 | head = input(Color.BOLD + "What is the heading?" + Color.END) 1235 | room = input(Color.BOLD + "What room is the class in? (No spaces") 1236 | teach = input( 1237 | Color.BOLD + "What is the teacher's username? " + Color.END 1238 | ) 1239 | cmd = ( 1240 | Gam.g 1241 | + " create course alias " 1242 | + al 1243 | + ' name "' 1244 | + name 1245 | + '" section ' 1246 | + sec 1247 | + ' heading "' 1248 | + head 1249 | + '" room ' 1250 | + room 1251 | + " teacher " 1252 | + teach 1253 | + " status ACTIVE" 1254 | ) 1255 | os.system(cmd) 1256 | time.sleep(2) 1257 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1258 | classroom() 1259 | elif selection == "2": # Update course menu item. 1260 | classroom1_2() 1261 | elif selection == "3": # Course info menu item 1262 | al = input( 1263 | Color.BOLD + "What is the course ID or alias?" + Color.END 1264 | ) 1265 | cmd = Gam.g + " info course " + al 1266 | os.system(cmd) 1267 | time.sleep(2) 1268 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1269 | classroom() 1270 | elif selection == "4": # Delete course menu item 1271 | al = input( 1272 | Color.BOLD + "What is the course ID or alias?" + Color.END 1273 | ) 1274 | yn = input( 1275 | Color.BOLD 1276 | + "Are you sure? This action cannot be " 1277 | + "undone! [y/N]" 1278 | + Color.END 1279 | ) 1280 | if yn == "y" or yn == "yes" or yn == "Y" or yn == "Yes": 1281 | cmd = Gam.g + " delete course " + al 1282 | os.system(cmd) 1283 | time.sleep(2) 1284 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1285 | classroom() 1286 | elif ( 1287 | yn == "" or yn == "n" or yn == "no" or yn == "N" or yn == "No" 1288 | ): 1289 | classroom() 1290 | else: 1291 | print(Color.RED + Msgs.err + "\n" + Color.END) 1292 | time.sleep(1) 1293 | classroom() 1294 | elif selection == "0": # Back to classroom main menu 1295 | classroom() 1296 | else: # Invalid selection. Returns to current menu. 1297 | print(Color.RED + Msgs.err + "\n" + Color.END) 1298 | time.sleep(2) 1299 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1300 | classroom1() 1301 | 1302 | 1303 | def classroom1_2(): # Classroom main menu option 1, submenu 2 1304 | al = input( 1305 | Color.BOLD 1306 | + "What is the course ID or alias that will be " 1307 | + "updated?" 1308 | + Color.END 1309 | ) 1310 | while True: 1311 | print(Color.YELLOW + "\nUpdate What?\n" + Color.END) 1312 | print("1) Name") 1313 | print("2) Section") 1314 | print("3) Heading") 1315 | print("4) Room") 1316 | print("5) Status") 1317 | print("6) Teacher") 1318 | print("\n0) Back\n") 1319 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1320 | if selection == "1": # Update name menu item 1321 | name = input(Color.BOLD + "Enter the new name:" + Color.END) 1322 | cmd = Gam.g + " update course " + al + " name " + name 1323 | os.system(cmd) 1324 | time.sleep(2) 1325 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1326 | classroom1() 1327 | elif selection == "2": # Update section menu item 1328 | name = input(Color.BOLD + "Enter new section:" + Color.END) 1329 | cmd = Gam.g + " update course " + al + " section " + name 1330 | os.system(cmd) 1331 | time.sleep(2) 1332 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1333 | classroom1() 1334 | elif selection == "3": # Update heading menu item 1335 | name = input(Color.BOLD + "Enter new heading:" + Color.END) 1336 | cmd = Gam.g + " update course " + al + ' heading "' + name + '"' 1337 | os.system(cmd) 1338 | time.sleep(2) 1339 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1340 | classroom1() 1341 | elif selection == "4": # Update room menu item 1342 | name = input(Color.BOLD + "Enter new room:" + Color.END) 1343 | cmd = Gam.g + " update course " + al + " room " + name 1344 | os.system(cmd) 1345 | time.sleep(2) 1346 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1347 | classroom1() 1348 | elif selection == "5": # Update status menu item 1349 | name = input( 1350 | Color.BOLD 1351 | + "Enter new status (Must be uppercase): " 1352 | + "[ACTIVE | ARCHIVED | DECLINED]" 1353 | + Color.END 1354 | ) 1355 | cmd = Gam.g + " update course " + al + " status " + name 1356 | os.system(cmd) 1357 | time.sleep(2) 1358 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1359 | classroom1() 1360 | elif selection == "6": # Update teacher menu item 1361 | name = input( 1362 | Color.BOLD + "Enter new teacher username:" + Color.END 1363 | ) 1364 | cmd = Gam.g + " update course " + al + " owner " + name 1365 | os.system(cmd) 1366 | time.sleep(2) 1367 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1368 | classroom1() 1369 | elif selection == "0": # Back to previous menu 1370 | classroom1() 1371 | else: # Invalid selection. Returns to current menu. 1372 | print(Color.RED + Msgs.err + "\n" + Color.END) 1373 | time.sleep(2) 1374 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1375 | classroom1_2() 1376 | 1377 | 1378 | def classroom3(): # Classroom main menu option 3 submenu 1379 | while True: 1380 | print(Color.CYAN + "\nGuardian Management Menu:\n" + Color.END) 1381 | print("1) Invite Guardian") 1382 | print("2) Delete Guardian") 1383 | print("3) View a Student's Guardian(s)") 1384 | print("\n0) Back\n") 1385 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1386 | if selection == "1": # Invite guardian menu item 1387 | stu = input( 1388 | Color.BOLD + "What is the student's username? " + Color.END 1389 | ) 1390 | guard = input( 1391 | Color.BOLD 1392 | + "What is the guardian's email " 1393 | + "address? " 1394 | + Color.END 1395 | ) 1396 | cmd = ( 1397 | Gam.g 1398 | + " create guardianinvite " 1399 | + guard 1400 | + " " 1401 | + stu 1402 | + "@madisonrams.net" 1403 | ) # CHANGE THIS DOMAIN TO MATCH YOURS. 1404 | os.system(cmd) 1405 | time.sleep(2) 1406 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1407 | classroom3() 1408 | elif selection == "2": # Delete guardian menu item 1409 | stu = input( 1410 | Color.BOLD + "What is the student's username? " + Color.END 1411 | ) 1412 | guard = input( 1413 | Color.BOLD + "Guardian's email address? " + Color.END 1414 | ) 1415 | cmd = ( 1416 | Gam.g 1417 | + " delete guardian " 1418 | + guard 1419 | + " " 1420 | + stu 1421 | + "@madisonrams.net" 1422 | ) # CHANGE THIS DOMAIN TO MATCH YOURS. 1423 | os.system(cmd) 1424 | time.sleep(2) 1425 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1426 | classroom3() 1427 | elif selection == "3": # View a student's guardian(s) menu item 1428 | stu = input( 1429 | Color.BOLD + "What is the student's username? " + Color.END 1430 | ) 1431 | cmd = ( 1432 | Gam.g + " print guardians student " + stu + "@madisonrams.net" 1433 | ) # CHANGE THIS DOMAIN TO MATCH YOURS. 1434 | os.system(cmd) 1435 | time.sleep(2) 1436 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1437 | classroom3() 1438 | elif selection == "0": # Back to Classroom main menu 1439 | classroom() 1440 | else: # Invalid selection. Returns to current menu. 1441 | print(Color.RED + Msgs.err + "\n" + Color.END) 1442 | time.sleep(2) 1443 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1444 | classroom3() 1445 | 1446 | 1447 | def classroom4(): # Classroom main menu option 4 submenu 1448 | while True: 1449 | print(Color.CYAN + "\nClassroom Reports Menu:\n" + Color.END) 1450 | print("1) View a Teacher's Courses") 1451 | print("2) View a Student's Courses") 1452 | print("3) View a Course's Participants") 1453 | print("\n0) Back\n") 1454 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1455 | if selection == "1": # View teacher's courses menu item 1456 | user = input( 1457 | Color.BOLD + "What is the teacher's username? " + Color.END 1458 | ) 1459 | cmd = ( 1460 | Gam.g + " print courses teacher " + user + "@madisonrams.net" 1461 | ) # CHANGE THIS DOMAIN TO MATCH YOURS. 1462 | os.system(cmd) 1463 | time.sleep(2) 1464 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1465 | classroom4() 1466 | elif selection == "2": # View student's courses menu item 1467 | user = input( 1468 | Color.BOLD + "What is the student's username? " + Color.END 1469 | ) 1470 | cmd = ( 1471 | Gam.g + " print courses student " + user + "@madisonrams.net" 1472 | ) # CHANGE THIS DOMAIN TO MATCH YOURS. 1473 | os.system(cmd) 1474 | time.sleep(2) 1475 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1476 | classroom4() 1477 | elif selection == "3": # View course participants menu item 1478 | al = input( 1479 | Color.BOLD + "What is the course ID or alias?" + Color.END 1480 | ) 1481 | file = input(Color.BOLD + "Output to a CSV file? [Y/n]") 1482 | if ( 1483 | file == "" 1484 | or file == "y" 1485 | or file == "Y" 1486 | or file == "yes" 1487 | or file == "Yes" 1488 | ): 1489 | cmd = ( 1490 | Gam.g 1491 | + "redirect csv ~/" 1492 | + al 1493 | + "-participants.csv " 1494 | + "multiprocess print course-participants course " 1495 | + al 1496 | ) 1497 | os.system(cmd) 1498 | time.sleep(2) 1499 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1500 | classroom4() 1501 | elif file == "n" or file == "N" or file == "no" or file == "No": 1502 | cmd = Gam.g + " print course-participants course " + al 1503 | os.system(cmd) 1504 | time.sleep(2) 1505 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1506 | classroom4() 1507 | else: 1508 | print(Color.RED + Msgs.err + "\n" + Color.END) 1509 | time.sleep(2) 1510 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1511 | classroom4() 1512 | elif selection == "0": # Back to classroom main menu 1513 | classroom() 1514 | else: # Invalid selection. Returns to current menu 1515 | print(Color.RED + Msgs.err + "\n" + Color.END) 1516 | time.sleep(2) 1517 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1518 | classroom4() 1519 | 1520 | 1521 | def devices3(): # Devices main menu option 3 submenu 1522 | while True: 1523 | print(Color.CYAN + "\nChrome Device Info Menu:\n" + Color.END) 1524 | print("1) View Single Device Info") 1525 | print("2) Export All Devices in an OU") 1526 | print("3) Export All Devices") 1527 | print("\n0) Back\n") 1528 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1529 | if selection == "1": # View device info menu item 1530 | cr_id = input( 1531 | Color.BOLD 1532 | + "Enter the Chrome Device Serial " 1533 | + "Number (Case sensitive):" 1534 | + Color.END 1535 | ) 1536 | cmd2 = Gam.g + "info cros cros_sn " + cr_id + " full" 1537 | os.system(cmd2) 1538 | time.sleep(2) 1539 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1540 | devices3() 1541 | elif selection == "2": # Export devices in ou menu item 1542 | ou = input( 1543 | Color.BOLD 1544 | + "Please enter the full path of the OU you " 1545 | + "wish to export (Case Sensitive):" 1546 | + Color.END 1547 | ) 1548 | ou2 = ou.split("/")[-1] 1549 | cmd = ( 1550 | Gam.g 1551 | + "redirect csv ~/" 1552 | + ou2 1553 | + "-export.csv multiprocess " 1554 | + 'print cros full limit_to_ou "' 1555 | + ou 1556 | + '"' 1557 | ) 1558 | os.system(cmd) 1559 | time.sleep(1) 1560 | print("Exported as " + ou2 + "-export.csv") 1561 | time.sleep(2) 1562 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1563 | devices3() 1564 | elif selection == "3": # Export all devices menu item 1565 | cmd = Gam.g + " print cros full > all-devices.csv" 1566 | os.system(cmd) 1567 | time.sleep(1) 1568 | print("Device list exported as all-devices.csv") 1569 | time.sleep(2) 1570 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1571 | devices3() 1572 | elif selection == "0": # Back to devices main menu 1573 | devices() 1574 | else: # Invalid selection. Returns to current menu. 1575 | print(Color.RED + Msgs.err + "\n" + Color.END) 1576 | time.sleep(2) 1577 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1578 | devices3() 1579 | 1580 | 1581 | def devices4(): # Devices main menu option 4 submenu 1582 | while True: 1583 | print( 1584 | Color.CYAN + "\nDisable/De-Provision/Re-Enable Menu:\n" + Color.END 1585 | ) 1586 | print("1) Disable") 1587 | print("2) Re-Enable") 1588 | print("3) De-Provision") 1589 | print("\n0) Back\n") 1590 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1591 | if selection == "1": # Disable menu item 1592 | cr_id = input( 1593 | Color.BOLD 1594 | + "Please enter the Chrome Device " 1595 | + "Serial Number (Case sensitive):" 1596 | + Color.END 1597 | ) 1598 | cmd2 = ( 1599 | Gam.g 1600 | + "update cros cros_sn " 1601 | + cr_id 1602 | + " action disable " 1603 | + "acknowledge_device_touch_requirement" 1604 | ) 1605 | os.system(cmd2) 1606 | time.sleep(2) 1607 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1608 | devices4() 1609 | elif selection == "2": # Re-enable menu item 1610 | cr_id = input( 1611 | Color.BOLD 1612 | + "Enter the Chrome Device Serial " 1613 | + "Number (Case sensitive):" 1614 | + Color.END 1615 | ) 1616 | cmd2 = ( 1617 | Gam.up 1618 | + "cros cros_sn " 1619 | + cr_id 1620 | + " action reenable " 1621 | + "acknowledge_device_touch_requirement" 1622 | ) 1623 | os.system(cmd2) 1624 | time.sleep(2) 1625 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1626 | devices4() 1627 | elif selection == "3": # Deprovision menu item. 1628 | devices4_3() 1629 | elif selection == "0": # Back to devices main menu 1630 | devices() 1631 | else: # Invalid selection. Returns to current menu. 1632 | print(Color.RED + Msgs.err + "\n" + Color.END) 1633 | time.sleep(2) 1634 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1635 | devices4() 1636 | 1637 | 1638 | def devices4_3(): # Devices Main menu option 4. submenu 3 1639 | while True: 1640 | print(Color.DARKCYAN + "\nDe-Provision Menu:\n" + Color.END) 1641 | print("1) De-Provision to Replace With Same Model") 1642 | print("2) De-Provision to Replace With Different Model") 1643 | print("3) De-Provision to Retire") 1644 | print("\n0) Back\n") 1645 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1646 | if selection == "1": # Replace with same model menu item 1647 | cr_id = input( 1648 | Color.BOLD 1649 | + "Please enter the Chrome Device " 1650 | + "Serial Number (Case sensitive):" 1651 | + Color.END 1652 | ) 1653 | cmd2 = ( 1654 | Gam.up 1655 | + "cros cros_sn " 1656 | + cr_id 1657 | + " action deprovision_same_model_" 1658 | + "replace acknowledge_device_touch_requirement" 1659 | ) 1660 | os.system(cmd2) 1661 | time.sleep(2) 1662 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1663 | devices4_3() 1664 | elif selection == "2": # Replace with diff model menu item 1665 | cr_id = input( 1666 | Color.BOLD 1667 | + "Please enter the Chrome Device Serial " 1668 | + "Number (Case sensitive):" 1669 | + Color.END 1670 | ) 1671 | cmd2 = ( 1672 | Gam.up 1673 | + "cros cros_sn " 1674 | + cr_id 1675 | + " action deprovision_different_model_" 1676 | + "replace acknowledge_device_touch_requirement" 1677 | ) 1678 | os.system(cmd2) 1679 | time.sleep(2) 1680 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1681 | devices4_3() 1682 | elif selection == "3": # Retire menu item 1683 | cr_id = input( 1684 | Color.BOLD 1685 | + "Please enter the Chrome Device Serial " 1686 | + "Number (Case sensitive):" 1687 | + Color.END 1688 | ) 1689 | cmd2 = ( 1690 | Gam.up 1691 | + "cros cros_sn " 1692 | + cr_id 1693 | + " action deprovision_retiring_device " 1694 | + "acknowledge_device_touch_requirement" 1695 | ) 1696 | os.system(cmd2) 1697 | time.sleep(2) 1698 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1699 | devices4_3() 1700 | elif selection == "0": # Return to previous menu 1701 | devices4() 1702 | else: # Invalid selection. Returns to current menu. 1703 | print(Color.RED + Msgs.err + "\n" + Color.END) 1704 | time.sleep(2) 1705 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1706 | devices4_3() 1707 | 1708 | 1709 | def devices5(): # Print Chrome Device Activity to CSV file. 1710 | action = input( 1711 | Color.BOLD + "Entity to apply to: [single | ou | all]: " + Color.END 1712 | ) 1713 | if action == "single": 1714 | cr_id = input( 1715 | Color.BOLD 1716 | + "Please enter the Chrome Device Serial " 1717 | + "Number (Case sensitive): " 1718 | + Color.END 1719 | ) 1720 | cmd = ( 1721 | Gam.g 1722 | + "redirect csv ~/" 1723 | + cr_id 1724 | + "-activity.csv multiprocess cros cros_sn " 1725 | + cr_id 1726 | + " print crosactivity all" 1727 | ) 1728 | os.system(cmd) 1729 | print( 1730 | Color.CYAN 1731 | + "\nFile saved as ~/" 1732 | + cr_id 1733 | + "activity.csv" 1734 | + Color.END 1735 | ) 1736 | time.sleep(1) 1737 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1738 | devices() 1739 | elif action == "ou": 1740 | ou = input( 1741 | Color.BOLD 1742 | + "Please enter the entire OU path (Case sensitive): " 1743 | + Color.END 1744 | ) 1745 | cmd = ( 1746 | Gam.g 1747 | + "redirect csv ~/" 1748 | + ou.replace("/", "_").lstrip("_") 1749 | + "-cros_activity.csv multiprocess cros_ou_and_children " 1750 | + ou 1751 | + " print crosactivity all" 1752 | ) 1753 | os.system(cmd) 1754 | print( 1755 | Color.CYAN 1756 | + "\nFile saved as ~/" 1757 | + ou.replace("/", "_").lstrip("_") 1758 | + "-cros_activity.csv" 1759 | + Color.END 1760 | ) 1761 | time.sleep(1) 1762 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1763 | devices() 1764 | elif action == "all": 1765 | cmd = ( 1766 | Gam.g 1767 | + "redirect csv ~/All_cros_activity.csv multiprocess print \ 1768 | crosactivity all" 1769 | ) 1770 | os.system(cmd) 1771 | print( 1772 | Color.CYAN + "\nFile saved as ~/All_cros_activity.csv" + Color.END 1773 | ) 1774 | time.sleep(1) 1775 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1776 | devices() 1777 | else: 1778 | print(Color.RED + Msgs.err + "\n" + Color.END) 1779 | time.sleep(2) 1780 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1781 | devices() 1782 | 1783 | 1784 | def devices6(): # Move Chrome Device 1785 | cr_id = input( 1786 | Color.BOLD 1787 | + "Please enter the Chrome Device Serial " 1788 | + "Number (Case sensitive): " 1789 | + Color.END 1790 | ) 1791 | ou = input( 1792 | Color.BOLD 1793 | + "Please enter the entire OU path (Case sensitive): " 1794 | + Color.END 1795 | ) 1796 | cmd = ( 1797 | Gam.g 1798 | + "update cros cros_sn " 1799 | + cr_id 1800 | + " ou " 1801 | + ou 1802 | + " quickcrosmove true" 1803 | ) 1804 | os.system(cmd) 1805 | time.sleep(1) 1806 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1807 | devices() 1808 | 1809 | 1810 | def email(): # Email Management main menu 1811 | while True: 1812 | print(Color.PURPLE + "\nEmail Management Menu:\n" + Color.END) 1813 | print("1) User Signature and Vacation Message") 1814 | print("2) Labels and Filters") 1815 | print("3) IMAP and POP Settings") 1816 | print("4) Send As Settings") 1817 | print("5) Show User(s) Gmail Profile") 1818 | print("\n0) Back\n") 1819 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1820 | if selection == "1": # Edit User's signature 1821 | email1() 1822 | elif selection == "2": # Edit a user's labels and filters 1823 | email2() 1824 | elif selection == "3": # IMAP and POP settings 1825 | email3() 1826 | elif selection == "4": # Send As address settings 1827 | email4() 1828 | elif selection == "5": # Profile Settings 1829 | email5() 1830 | elif selection == "0": # Back to main menu 1831 | main_menu() 1832 | else: # Invalid selection. returns to current menu. 1833 | print(Color.RED + Msgs.err + "\n" + Color.END) 1834 | time.sleep(2) 1835 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1836 | email() 1837 | 1838 | 1839 | def email1(): # Email main menu option 1 submenu 1840 | while True: 1841 | print(Color.CYAN + "\nUser Signature Management Menu:\n" + Color.END) 1842 | print("1) Set User Signature From Text File") 1843 | print("2) Set User Signature From HTML File") 1844 | print("3) Set User Signature Manually") 1845 | print("4) View a User(s) Signature") 1846 | print("5) Set a User(s) Vacation Responder") 1847 | print("6) Turn off a User(s) Vacation Responder") 1848 | print("\n0) Back\n") 1849 | selection = input(Color.BOLD + Msgs.choose + Color.END) 1850 | if selection == "1": # Set sig from txt file 1851 | email1_1() 1852 | elif selection == "2": # Set sig from html file 1853 | email1_2() 1854 | elif selection == "3": # Set sig manually 1855 | email1_3() 1856 | elif selection == "4": # View user's signature 1857 | email1_4() 1858 | elif selection == "5": # Set vacation responder 1859 | email1_5() 1860 | elif selection == "6": # Turn off responder 1861 | email1_6() 1862 | elif selection == "0": # Back to main menu 1863 | email() 1864 | else: # Invalid selection. returns to current menu. 1865 | print(Color.RED + Msgs.err + "\n" + Color.END) 1866 | time.sleep(2) 1867 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1868 | email1() 1869 | 1870 | 1871 | def email1_1(): # Email1 menu option 1 1872 | txt = input( 1873 | Color.BOLD 1874 | + "Please enter the full path to the text " 1875 | + "file to read:" 1876 | + Color.END 1877 | ) 1878 | who = input(Color.BOLD + Msgs.ent + Color.END) 1879 | if who == "user": 1880 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 1881 | cmd = Gam.u + user + " signature file " + txt 1882 | elif who == "group": 1883 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 1884 | cmd = Gam.gr + user + " signature file " + txt 1885 | elif who == "ou": 1886 | user = input( 1887 | Color.BOLD 1888 | + "Please enter an OU (Case Sensitive" 1889 | + ", Full Path): " 1890 | + Color.END 1891 | ) 1892 | cmd = Gam.ou + ' "' + user + '" signature file ' + txt 1893 | elif who == "all" or who == "all users": 1894 | cmd = Gam.a + " signature file " + txt 1895 | else: 1896 | print(Color.RED + Msgs.err + "\n" + Color.END) 1897 | time.sleep(1) 1898 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1899 | email1_1() 1900 | os.system(cmd) 1901 | time.sleep(1) 1902 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1903 | email1() 1904 | 1905 | 1906 | def email1_2(): # Email1 menu option 2 1907 | txt = input( 1908 | Color.BOLD 1909 | + "Please enter the full path to the html " 1910 | + "file to read:" 1911 | + Color.END 1912 | ) 1913 | who = input(Color.BOLD + Msgs.ent + Color.END) 1914 | if who == "user": 1915 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 1916 | cmd = Gam.u + user + " signature file " + txt + " html" 1917 | elif who == "group": 1918 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 1919 | cmd = Gam.gr + user + " signature file " + txt + " html" 1920 | elif who == "ou": 1921 | user = input( 1922 | Color.BOLD 1923 | + "Please enter an OU (Case Sensitive" 1924 | + ", Full Path): " 1925 | + Color.END 1926 | ) 1927 | cmd = Gam.ou + ' "' + user + '" signature file ' + txt + " html" 1928 | elif who == "all" or who == "all users": 1929 | cmd = Gam.a + " signature file " + txt + " html" 1930 | else: 1931 | print(Color.RED + Msgs.err + "\n" + Color.END) 1932 | time.sleep(2) 1933 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1934 | email1_2() 1935 | os.system(cmd) 1936 | time.sleep(2) 1937 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1938 | email1() 1939 | 1940 | 1941 | def email1_3(): # Email1 menu option 3 1942 | print( 1943 | Color.YELLOW 1944 | + "Line breaks must be designated by
. EX: Acme " 1945 | + "Inc
123 Main Ave
http://www.acme.com" 1946 | + Color.END 1947 | ) 1948 | time.sleep(1) 1949 | txt = input( 1950 | Color.BOLD + "Please enter the full text of the signature:" + Color.END 1951 | ) 1952 | who = input(Color.BOLD + Msgs.ent + Color.END) 1953 | if who == "user": 1954 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 1955 | cmd = Gam.u + user + ' signature "' + txt + '"' 1956 | elif who == "group": 1957 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 1958 | cmd = Gam.gr + user + ' signature "' + txt + '"' 1959 | elif who == "ou": 1960 | user = input( 1961 | Color.BOLD 1962 | + "Please enter an OU (Case Sensitive" 1963 | + ", Full Path): " 1964 | + Color.END 1965 | ) 1966 | cmd = Gam.ou + ' "' + user + '" signature "' + txt + '"' 1967 | elif who == "all" or who == "all users": 1968 | cmd = Gam.a + ' signature "' + txt + '"' 1969 | else: 1970 | print(Color.RED + Msgs.err + "\n" + Color.END) 1971 | time.sleep(2) 1972 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1973 | email1_3() 1974 | os.system(cmd) 1975 | time.sleep(2) 1976 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 1977 | email1() 1978 | 1979 | 1980 | def email1_4(): # Email1 menu option 4 1981 | who = input(Color.BOLD + Msgs.ent + Color.END) 1982 | if who == "user": 1983 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 1984 | cmd = Gam.u + user + " show signature format" 1985 | elif who == "group": 1986 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 1987 | cmd = Gam.gr + user + " show signature format" 1988 | elif who == "ou": 1989 | user = input( 1990 | Color.BOLD 1991 | + "Please enter an OU (Case Sensitive" 1992 | + ", Full Path): " 1993 | + Color.END 1994 | ) 1995 | cmd = Gam.ou + ' "' + user + '" show signature format' 1996 | elif who == "all" or who == "all users": 1997 | cmd = Gam.a + " show signature format" 1998 | else: 1999 | print(Color.RED + Msgs.err + "\n" + Color.END) 2000 | time.sleep(2) 2001 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2002 | email1_4() 2003 | os.system(cmd) 2004 | time.sleep(2) 2005 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2006 | email1() 2007 | 2008 | 2009 | def email1_5(): # Email1 menu option 5 2010 | sub = input(Color.BOLD + "Please enter a message subject: " + Color.END) 2011 | print( 2012 | Color.YELLOW 2013 | + r'Line breaks must be designated using "\n".' 2014 | + Color.END 2015 | ) 2016 | mes = input(Color.BOLD + "Please enter the vacation message: " + Color.END) 2017 | who = input(Color.BOLD + Msgs.ent + Color.END) 2018 | if who == "user": 2019 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2020 | cmd = ( 2021 | Gam.u 2022 | + user 2023 | + ' vacation on subject "' 2024 | + sub 2025 | + '" message "' 2026 | + mes 2027 | + '"' 2028 | ) 2029 | elif who == "group": 2030 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2031 | cmd = ( 2032 | Gam.gr 2033 | + user 2034 | + ' vacation on subject "' 2035 | + sub 2036 | + '" message "' 2037 | + mes 2038 | + '"' 2039 | ) 2040 | elif who == "ou": 2041 | user = input( 2042 | Color.BOLD 2043 | + "Please enter an OU (Case Sensitive" 2044 | + ", Full Path): " 2045 | + Color.END 2046 | ) 2047 | cmd = ( 2048 | Gam.ou 2049 | + ' "' 2050 | + user 2051 | + '" vacation on subject "' 2052 | + sub 2053 | + '" message "' 2054 | + mes 2055 | + '"' 2056 | ) 2057 | elif who == "all" or who == "all users": 2058 | cmd = ( 2059 | Gam.a + ' vacation on subject "' + sub + '" message "' + mes + '"' 2060 | ) 2061 | else: 2062 | print(Color.RED + Msgs.err + "\n" + Color.END) 2063 | time.sleep(2) 2064 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2065 | email1_5() 2066 | os.system(cmd) 2067 | time.sleep(2) 2068 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2069 | email1() 2070 | 2071 | 2072 | def email1_6(): # Email1 menu option 6 2073 | who = input(Color.BOLD + Msgs.ent + Color.END) 2074 | if who == "user": 2075 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2076 | cmd = Gam.u + user + " vacation off" 2077 | elif who == "group": 2078 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2079 | cmd = Gam.gr + user + " vacation off" 2080 | elif who == "ou": 2081 | user = input( 2082 | Color.BOLD 2083 | + "Please enter an OU (Case Sensitive" 2084 | + ", Full Path): " 2085 | + Color.END 2086 | ) 2087 | cmd = Gam.ou + ' "' + user + '" vacation off' 2088 | elif who == "all" or who == "all users": 2089 | cmd = Gam.a + " vacation off" 2090 | else: 2091 | print(Color.RED + Msgs.err + "\n" + Color.END) 2092 | time.sleep(2) 2093 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2094 | email1_6() 2095 | os.system(cmd) 2096 | time.sleep(2) 2097 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2098 | email1() 2099 | 2100 | 2101 | def email2(): # Email main menu option 2 menu 2102 | while True: 2103 | print(Color.CYAN + "\nLabels and Filters Menu:\n" + Color.END) 2104 | print("1) Create a Label") 2105 | print("2) View User(s) Labels") 2106 | print("3) Delete a Label") 2107 | print("4) Create a Filter") 2108 | print("5) View User(s) Filters") 2109 | print("\n0) Back\n") 2110 | selection = input(Color.BOLD + Msgs.choose + Color.END) 2111 | if selection == "1": # Create a label 2112 | email2_1() 2113 | elif selection == "2": # View labels 2114 | email2_2() 2115 | elif selection == "3": # Delete Label 2116 | email2_3() 2117 | elif selection == "4": # Create Filter 2118 | email2_4() 2119 | elif selection == "5": # View user's filters 2120 | email2_5() 2121 | elif selection == "0": # Back to main menu 2122 | email() 2123 | else: # Invalid selection. returns to current menu. 2124 | print(Color.RED + Msgs.err + "\n" + Color.END) 2125 | time.sleep(2) 2126 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2127 | email2() 2128 | 2129 | 2130 | def email2_1(): # Email2 menu option 1 2131 | lab = input(Color.BOLD + "Please enter a name for the label: " + Color.END) 2132 | who = input(Color.BOLD + Msgs.ent + Color.END) 2133 | if who == "user": 2134 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2135 | cmd = Gam.u + user + ' label "' + lab + '"' 2136 | elif who == "group": 2137 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2138 | cmd = Gam.gr + user + ' label "' + lab + '"' 2139 | elif who == "ou": 2140 | user = input( 2141 | Color.BOLD 2142 | + "Please enter an OU (Case Sensitive" 2143 | + ", Full Path): " 2144 | + Color.END 2145 | ) 2146 | cmd = Gam.ou + ' "' + user + '" label "' + lab + '"' 2147 | elif who == "all" or who == "all users": 2148 | cmd = Gam.a + ' label "' + lab + '"' 2149 | else: 2150 | print(Color.RED + Msgs.err + "\n" + Color.END) 2151 | time.sleep(2) 2152 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2153 | email2_1() 2154 | os.system(cmd) 2155 | time.sleep(2) 2156 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2157 | email2() 2158 | 2159 | 2160 | def email2_2(): # Email2 menu option 2 2161 | who = input(Color.BOLD + Msgs.ent + Color.END) 2162 | if who == "user": 2163 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2164 | cmd = Gam.u + user + " show labels" 2165 | elif who == "group": 2166 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2167 | cmd = Gam.gr + user + " show labels" 2168 | elif who == "ou": 2169 | user = input( 2170 | Color.BOLD 2171 | + "Please enter an OU (Case Sensitive" 2172 | + ", Full Path): " 2173 | + Color.END 2174 | ) 2175 | cmd = Gam.ou + ' "' + user + '" show labels' 2176 | elif who == "all" or who == "all users": 2177 | cmd = Gam.a + " show labels" 2178 | else: 2179 | print(Color.RED + Msgs.err + "\n" + Color.END) 2180 | time.sleep(2) 2181 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2182 | email2_2() 2183 | os.system(cmd) 2184 | time.sleep(2) 2185 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2186 | email2() 2187 | 2188 | 2189 | def email2_3(): # Email2 menu option 3 2190 | lab = input(Color.BOLD + "Please enter the label name: " + Color.END) 2191 | who = input(Color.BOLD + Msgs.ent + Color.END) 2192 | if who == "user": 2193 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2194 | cmd = Gam.u + user + ' delete label "' + lab + '"' 2195 | elif who == "group": 2196 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2197 | cmd = Gam.gr + user + ' delete label "' + lab + '"' 2198 | elif who == "ou": 2199 | user = input( 2200 | Color.BOLD 2201 | + "Please enter an OU (Case Sensitive" 2202 | + ", Full Path): " 2203 | + Color.END 2204 | ) 2205 | cmd = Gam.ou + ' "' + user + '" delete label "' + lab + '"' 2206 | elif who == "all" or who == "all users": 2207 | cmd = Gam.a + ' delete label "' + lab + '"' 2208 | else: 2209 | print(Color.RED + Msgs.err + "\n" + Color.END) 2210 | time.sleep(2) 2211 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2212 | email2_3() 2213 | os.system(cmd) 2214 | time.sleep(2) 2215 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2216 | email2() 2217 | 2218 | 2219 | def email2_4(): # create filter menu 2220 | while True: 2221 | print(Color.DARKCYAN + "\nFilter Criteria:\n" + Color.END) 2222 | print('1) "FROM" Address Only') 2223 | print('2) "FROM" Address and Subject') 2224 | print("3) Subject Only") 2225 | print("\n0) Back\n") 2226 | selection = input(Color.BOLD + Msgs.choose + Color.END) 2227 | if selection == "1": # Filter by from address only 2228 | email2_4_1() 2229 | elif selection == "2": # Filter by address and subject 2230 | email2_4_2() 2231 | elif selection == "3": # Filter by subject 2232 | email2_4_3() 2233 | elif selection == "0": # Back to main menu 2234 | email2() 2235 | else: # Invalid selection. returns to current menu. 2236 | print(Color.RED + Msgs.err + "\n" + Color.END) 2237 | time.sleep(2) 2238 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2239 | email2_4() 2240 | 2241 | 2242 | def email2_4_1(): # Email2_4 menu option 1 2243 | eml = input( 2244 | Color.BOLD 2245 | + "Please enter an email address to filter " 2246 | + "on: " 2247 | + Color.END 2248 | ) 2249 | print("Separate action using a space") 2250 | act = input( 2251 | Color.BOLD 2252 | + "What action to take? [markread | archive | star" 2253 | + " | trash | neverspam] " 2254 | + Color.END 2255 | ) 2256 | lab = input( 2257 | Color.BOLD 2258 | + "Please enter a label for the filtered messages: " 2259 | + Color.END 2260 | ) 2261 | who = input(Color.BOLD + Msgs.ent + Color.END) 2262 | if who == "user": 2263 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2264 | cmd = ( 2265 | Gam.u 2266 | + user 2267 | + " filter from " 2268 | + eml 2269 | + ' label "' 2270 | + lab 2271 | + '" ' 2272 | + act 2273 | ) 2274 | elif who == "group": 2275 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2276 | cmd = ( 2277 | Gam.gr 2278 | + user 2279 | + " filter from " 2280 | + eml 2281 | + ' label "' 2282 | + lab 2283 | + '" ' 2284 | + act 2285 | ) 2286 | elif who == "ou": 2287 | user = input( 2288 | Color.BOLD 2289 | + "Please enter an OU (Case Sensitive" 2290 | + ", Full Path): " 2291 | + Color.END 2292 | ) 2293 | cmd = ( 2294 | Gam.ou 2295 | + ' "' 2296 | + user 2297 | + '" filter from ' 2298 | + eml 2299 | + ' label "' 2300 | + lab 2301 | + '" ' 2302 | + act 2303 | ) 2304 | elif who == "all" or who == "all users": 2305 | cmd = Gam.a + " filter from " + eml + ' label "' + lab + '" ' + act 2306 | else: 2307 | print(Color.RED + Msgs.err + "\n" + Color.END) 2308 | time.sleep(2) 2309 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2310 | email2_4_1() 2311 | os.system(cmd) 2312 | time.sleep(2) 2313 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2314 | email2_4() 2315 | 2316 | 2317 | def email2_4_2(): # Email2_4 menu option 2 2318 | eml = input( 2319 | Color.BOLD + "Please enter an email address to filter on: " + Color.END 2320 | ) 2321 | sub = input( 2322 | Color.BOLD + "Please enter a subject to filter on: " + Color.END 2323 | ) 2324 | print("Separate action using a space") 2325 | act = input( 2326 | Color.BOLD 2327 | + "What action to take? [markread | archive | star" 2328 | + " | trash | neverspam] " 2329 | + Color.END 2330 | ) 2331 | lab = input( 2332 | Color.BOLD + "Enter a label for the filtered messages: " + Color.END 2333 | ) 2334 | who = input(Color.BOLD + Msgs.ent + Color.END) 2335 | if who == "user": 2336 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2337 | cmd = ( 2338 | Gam.u 2339 | + user 2340 | + " filter from " 2341 | + eml 2342 | + ' subject "' 2343 | + sub 2344 | + '" label "' 2345 | + lab 2346 | + '" ' 2347 | + act 2348 | ) 2349 | elif who == "group": 2350 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2351 | cmd = ( 2352 | Gam.gr 2353 | + user 2354 | + " filter from " 2355 | + eml 2356 | + ' subject "' 2357 | + sub 2358 | + '" label "' 2359 | + lab 2360 | + '" ' 2361 | + act 2362 | ) 2363 | elif who == "ou": 2364 | user = input( 2365 | Color.BOLD 2366 | + "Please enter an OU (Case Sensitive" 2367 | + ", Full Path): " 2368 | + Color.END 2369 | ) 2370 | cmd = ( 2371 | Gam.ou 2372 | + ' "' 2373 | + user 2374 | + '" filter from ' 2375 | + eml 2376 | + ' subject "' 2377 | + sub 2378 | + '" label "' 2379 | + lab 2380 | + '" ' 2381 | + act 2382 | ) 2383 | elif who == "all" or who == "all users": 2384 | cmd = ( 2385 | Gam.a 2386 | + " filter from " 2387 | + eml 2388 | + ' subject "' 2389 | + sub 2390 | + '" label "' 2391 | + lab 2392 | + '" ' 2393 | + act 2394 | ) 2395 | else: 2396 | print(Color.RED + Msgs.err + "\n" + Color.END) 2397 | time.sleep(2) 2398 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2399 | email2_4_2() 2400 | os.system(cmd) 2401 | time.sleep(2) 2402 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2403 | email2_4() 2404 | 2405 | 2406 | def email2_4_3(): # Email2_4 menu option 3 2407 | sub = input(Color.BOLD + "Enter a subject to filter on: " + Color.END) 2408 | print(Color.YELLLOW + "\nSeparate action using a space\n" + Color.END) 2409 | act = input( 2410 | Color.BOLD 2411 | + "What action to take? [markread | archive | star" 2412 | + " | trash | neverspam] " 2413 | + Color.END 2414 | ) 2415 | lab = input( 2416 | Color.BOLD + "Enter a label for the filtered messages: " + Color.END 2417 | ) 2418 | who = input(Color.BOLD + Msgs.ent + Color.END) 2419 | if who == "user": 2420 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2421 | cmd = ( 2422 | Gam.u 2423 | + user 2424 | + " filter subject " 2425 | + sub 2426 | + ' label "' 2427 | + lab 2428 | + '" ' 2429 | + act 2430 | ) 2431 | elif who == "group": 2432 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2433 | cmd = ( 2434 | Gam.gr 2435 | + user 2436 | + " filter subject " 2437 | + sub 2438 | + ' label "' 2439 | + lab 2440 | + '" ' 2441 | + act 2442 | ) 2443 | elif who == "ou": 2444 | user = input( 2445 | Color.BOLD 2446 | + "Please enter an OU (Case Sensitive" 2447 | + ", Full Path): " 2448 | + Color.END 2449 | ) 2450 | cmd = ( 2451 | Gam.ou 2452 | + ' "' 2453 | + user 2454 | + '" filter subject ' 2455 | + sub 2456 | + ' label "' 2457 | + lab 2458 | + '" ' 2459 | + act 2460 | ) 2461 | elif who == "all" or who == "all users": 2462 | cmd = Gam.a + " filter subject " + sub + ' label "' + lab + '" ' + act 2463 | else: 2464 | print(Color.RED + Msgs.err + "\n" + Color.END) 2465 | time.sleep(2) 2466 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2467 | email2_4_3() 2468 | os.system(cmd) 2469 | time.sleep(2) 2470 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2471 | email2_4() 2472 | 2473 | 2474 | def email2_5(): # Email2 menu option 5 2475 | who = input(Color.BOLD + Msgs.ent + Color.END) 2476 | if who == "user": 2477 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2478 | cmd = Gam.u + user + " show filters" 2479 | elif who == "group": 2480 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2481 | cmd = Gam.gr + user + " show filters" 2482 | elif who == "ou": 2483 | user = input( 2484 | Color.BOLD 2485 | + "Please enter an OU (Case Sensitive" 2486 | + ", Full Path): " 2487 | + Color.END 2488 | ) 2489 | cmd = Gam.ou + ' "' + user + '" show filters' 2490 | elif who == "all" or who == "all users": 2491 | cmd = Gam.a + " show filters" 2492 | else: 2493 | print(Color.RED + Msgs.err + "\n" + Color.END) 2494 | time.sleep(2) 2495 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2496 | email2_5() 2497 | os.system(cmd) 2498 | time.sleep(2) 2499 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2500 | email2() 2501 | 2502 | 2503 | def email3(): # Pop and imap settings 2504 | while True: 2505 | print(Color.CYAN + "\nIMAP and POP Settings:\n" + Color.END) 2506 | print("1) Turn IMAP/POP On or Off for a User") 2507 | print("2) Show IMAP/POP status for a User") 2508 | print("\n0) Back\n") 2509 | selection = input(Color.BOLD + Msgs.choose + Color.END) 2510 | if selection == "1": # IMAP/POP on/off 2511 | email3_1() 2512 | elif selection == "2": # IMAP/POP status 2513 | email3_2() 2514 | elif selection == "0": # Back to main menu 2515 | email() 2516 | else: # Invalid selection. returns to current menu. 2517 | print(Color.RED + Msgs.err + "\n" + Color.END) 2518 | time.sleep(2) 2519 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2520 | email3() 2521 | 2522 | 2523 | def email3_1(): # Email3 menu option 1 2524 | prot = input(Color.BOLD + "What protocol? [pop | imap] " + Color.END) 2525 | act = input(Color.BOLD + "Turn ON or OFF? [on | off] " + Color.END) 2526 | who = input(Color.BOLD + Msgs.ent + Color.END) 2527 | if who == "user": 2528 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2529 | cmd = Gam.u + user + " " + prot + " " + act 2530 | elif who == "group": 2531 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2532 | cmd = Gam.gr + user + " " + prot + " " + act 2533 | elif who == "ou": 2534 | user = input( 2535 | Color.BOLD 2536 | + "Please enter an OU (Case Sensitive" 2537 | + ", Full Path): " 2538 | + Color.END 2539 | ) 2540 | cmd = Gam.ou + ' "' + user + '" ' + prot + " " + act 2541 | elif who == "all" or who == "all users": 2542 | cmd = Gam.a + " " + prot + " " + act 2543 | else: 2544 | print(Color.RED + Msgs.err + "\n" + Color.END) 2545 | time.sleep(2) 2546 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2547 | email3_1() 2548 | os.system(cmd) 2549 | time.sleep(2) 2550 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2551 | email3() 2552 | 2553 | 2554 | def email3_2(): # Email3 menu option 2 2555 | prot = input(Color.BOLD + "What protocol? [pop | imap] " + Color.END) 2556 | who = input(Color.BOLD + Msgs.ent + Color.END) 2557 | if who == "user": 2558 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2559 | cmd = Gam.u + user + " show " + prot 2560 | elif who == "group": 2561 | user = input(Color.BOLD + "Please enter a group name: " + Color.END) 2562 | cmd = Gam.gr + user + " show " + prot 2563 | elif who == "ou": 2564 | user = input( 2565 | Color.BOLD 2566 | + "Please enter an OU (Case Sensitive" 2567 | + ", Full Path): " 2568 | + Color.END 2569 | ) 2570 | cmd = Gam.ou + ' "' + user + '" show ' + prot 2571 | elif who == "all" or who == "all users": 2572 | cmd = Gam.a + " show " + prot 2573 | else: 2574 | print(Color.RED + Msgs.err + "\n" + Color.END) 2575 | time.sleep(2) 2576 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2577 | email3_2() 2578 | os.system(cmd) 2579 | time.sleep(2) 2580 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2581 | email3() 2582 | 2583 | 2584 | def email4(): # Send As settings 2585 | while True: 2586 | print(Color.CYAN + "\nSend As Settings Menu:\n" + Color.END) 2587 | print("1) Add Send As Address") 2588 | print("2) Update Send As Address") 2589 | print("3) Delete Send As Address") 2590 | print("4) Show Send As Addresses for a User") 2591 | print("\n0) Back\n") 2592 | selection = input(Color.BOLD + Msgs.choose + Color.END) 2593 | if selection == "1": # Add send as address 2594 | email4_1() 2595 | elif selection == "2": # Update send as 2596 | email4_2() 2597 | elif selection == "3": # delete send as 2598 | email4_3() 2599 | elif selection == "4": # View send as 2600 | email4_4() 2601 | elif selection == "0": # Back to main menu 2602 | email() 2603 | else: # Invalid selection. returns to current menu. 2604 | print(Color.RED + Msgs.err + "\n" + Color.END) 2605 | time.sleep(2) 2606 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2607 | email4() 2608 | 2609 | 2610 | def email4_1(): # Email4 menu option 1 2611 | usr = input(Color.BOLD + "Please enter a username: " + Color.END) 2612 | eml = input( 2613 | Color.BOLD + "Please enter an email address to send as: " + Color.END 2614 | ) 2615 | nm = input( 2616 | Color.BOLD 2617 | + "Please Enter a name for the email address" 2618 | + " (ex. John Smith): " 2619 | + Color.END 2620 | ) 2621 | cmd = ( 2622 | Gam.g 2623 | + " user " 2624 | + usr 2625 | + " sendas " 2626 | + eml 2627 | + " " 2628 | + nm 2629 | + " replyto " 2630 | + eml 2631 | + " treatasalias true" 2632 | ) 2633 | os.system(cmd) 2634 | time.sleep(2) 2635 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2636 | email4() 2637 | 2638 | 2639 | def email4_2(): # Email4 menu option 2 2640 | usr = input(Color.BOLD + "Please enter a username: " + Color.END) 2641 | eml = input( 2642 | Color.BOLD + "Please enter the send as email address: " + Color.END 2643 | ) 2644 | nm = input( 2645 | Color.BOLD 2646 | + "Please Enter an updated name for the " 2647 | + "email address (ex. John Smith): " 2648 | + Color.END 2649 | ) 2650 | cmd = ( 2651 | Gam.g 2652 | + " user " 2653 | + usr 2654 | + " update sendas " 2655 | + eml 2656 | + " name " 2657 | + nm 2658 | + " replyto " 2659 | + eml 2660 | + " treatasalias true" 2661 | ) 2662 | os.system(cmd) 2663 | time.sleep(2) 2664 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2665 | email4() 2666 | 2667 | 2668 | def email4_3(): # Email4 menu option 3 2669 | usr = input(Color.BOLD + "Please enter a username: " + Color.END) 2670 | eml = input(Color.BOLD + "Enter the send as email address: " + Color.END) 2671 | cmd = Gam.g + " user " + usr + " delete sendas " + eml 2672 | os.system(cmd) 2673 | time.sleep(2) 2674 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2675 | email4() 2676 | 2677 | 2678 | def email4_4(): # Email4 menu option 4 2679 | who = input(Color.BOLD + Msgs.ent + Color.END) 2680 | if who == "user" or who == "group": 2681 | user = input(Color.BOLD + "Please enter a username: " + Color.END) 2682 | user1 = user 2683 | cmd = ( 2684 | Gam.g 2685 | + "redirect csv ~/" 2686 | + user1 2687 | + "-sendas.csv multiprocess " 2688 | + who 2689 | + user 2690 | + " print sendas" 2691 | ) 2692 | elif who == "ou": 2693 | user = input( 2694 | Color.BOLD 2695 | + "Please enter an OU (Case Sensitive" 2696 | + ", Full Path): " 2697 | + Color.END 2698 | ) 2699 | user1 = user.split("/")[-1] 2700 | cmd = ( 2701 | Gam.g 2702 | + "redirect csv ~/" 2703 | + user1 2704 | + '-sendas.csv multiprocess ou "' 2705 | + user 2706 | + '" print sendas' 2707 | ) 2708 | elif who == "all" or who == "all users": 2709 | user1 = "AllUsers" 2710 | cmd = ( 2711 | Gam.g 2712 | + "redirect csv ~/" 2713 | + user1 2714 | + "-sendas.csv multiprocess all " 2715 | + "users print sendas" 2716 | ) 2717 | else: 2718 | print(Color.RED + Msgs.err + "\n" + Color.END) 2719 | time.sleep(2) 2720 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2721 | email4_4() 2722 | os.system(cmd) 2723 | print( 2724 | Color.YELLOW + "\nFile saved as " + user1 + "-sendas.csv\n" + Color.END 2725 | ) 2726 | time.sleep(2) 2727 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2728 | email4() 2729 | 2730 | 2731 | def email5(): # Email5 menu option 4 2732 | who = input(Color.BOLD + Msgs.ent + Color.END) 2733 | if who == "user" or who == "group": 2734 | user = input(Color.BOLD + "Please enter a name: " + Color.END) 2735 | cmd = ( 2736 | Gam.g 2737 | + "redirect csv ~/" 2738 | + user 2739 | + "-gmail-profile.csv multiprocess" 2740 | + who 2741 | + " " 2742 | + user 2743 | + " print gmailprofile" 2744 | ) 2745 | user1 = user 2746 | elif who == "ou": 2747 | user = input( 2748 | Color.BOLD 2749 | + "Please enter an OU (Case Sensitive" 2750 | + ", Full Path): " 2751 | + Color.END 2752 | ) 2753 | user1 = user.split("/")[-1] 2754 | cmd = ( 2755 | Gam.g 2756 | + "redirect csv ~/" 2757 | + user1 2758 | + "-gmail-profile.csv " 2759 | + 'multiprocess ou "' 2760 | + user 2761 | + '" print gmailprofile' 2762 | ) 2763 | elif who == "all" or who == "all users": 2764 | user1 = "AllUsers" 2765 | cmd = ( 2766 | Gam.g 2767 | + "redirect csv ~/" 2768 | + user1 2769 | + "-gmail-profile.csv " 2770 | + "multiprocess all users print gmailprofile" 2771 | ) 2772 | else: 2773 | print(Color.RED + Msgs.err + "\n" + Color.END) 2774 | time.sleep(2) 2775 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2776 | email5() 2777 | os.system(cmd) 2778 | print( 2779 | Color.YELLOW 2780 | + "\nFile saved as " 2781 | + user1 2782 | + "-gmail-profile.csv\n" 2783 | + Color.END 2784 | ) 2785 | time.sleep(2) 2786 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2787 | email() 2788 | 2789 | 2790 | def bulk(): # Bulk operations main menu 2791 | while True: 2792 | print(Color.PURPLE + "\nBulk Operations Menu:\n" + Color.END) 2793 | print( 2794 | Color.RED 2795 | + "WARNING: Using these will affect multiple users. " 2796 | + "Some actions are unrecoverable. PROCEED WITH CAUTION!" 2797 | + Color.END 2798 | ) 2799 | print("1) GAM Batch Mode Using CSV Files") 2800 | print("2) GAM Batch Mode Using Text Files") 2801 | print("\n0) Back\n") 2802 | selection = input(Color.BOLD + Msgs.choose + Color.END) 2803 | if selection == "1": # CSV Batch Mode 2804 | csv() 2805 | elif selection == "2": # Batch file mode 2806 | batch() 2807 | elif selection == "0": # Back to main menu 2808 | main_menu() 2809 | else: # Invalid selection. returns to current menu. 2810 | print(Color.RED + Msgs.err + "\n" + Color.END) 2811 | time.sleep(2) 2812 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2813 | bulk() 2814 | 2815 | 2816 | def batch(): # GAM batch file commands 2817 | print( 2818 | Color.YELLOW 2819 | + "\nThe file to be used in this batch mode must have " 2820 | + "a GAM command, one per line, with correct syntax\n" 2821 | + Color.END 2822 | ) 2823 | print( 2824 | Color.RED 2825 | + "If the syntax in your file is incorrect, the entire " 2826 | + "operation will fail.\n" 2827 | + Color.END 2828 | ) 2829 | file = input( 2830 | Color.BOLD 2831 | + "Please enter the full path of the file to be " 2832 | + "used: " 2833 | + Color.END 2834 | ) 2835 | cmd = Gam.g + " batch " + file 2836 | os.system(cmd) 2837 | time.sleep(2) 2838 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2839 | bulk() 2840 | 2841 | 2842 | def csv(): # GAM CSV file batch mode 2843 | print(Color.UNDERLINE + "\nCOMING SOON!\n" + Color.END) 2844 | time.sleep(2) 2845 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2846 | bulk() 2847 | 2848 | 2849 | def vault(): # Vault Management 2850 | while True: 2851 | print(Color.PURPLE + "\nVault Management Menu:\n" + Color.END) 2852 | print("1) Create Matter") 2853 | print("2) Update Matter") 2854 | print("3) Retrieve Matter Info") 2855 | print("4) Create Hold") 2856 | print("5) Update Hold") 2857 | print("6) Retrieve Hold Info") 2858 | print("\n0) Back\n") 2859 | selection = input(Color.BOLD + Msgs.choose + Color.END) 2860 | if selection == "1": # Create Matter 2861 | vault1() 2862 | elif selection == "2": # Update Matter 2863 | vault2() 2864 | elif selection == "3": # Retrieve Matter Info 2865 | name = input( 2866 | Color.BOLD + "Please enter the matter name: " + Color.END 2867 | ) 2868 | cmd = Gam.i + ' vaultmatter "' + name + '"' 2869 | os.system(cmd) 2870 | time.sleep(2) 2871 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2872 | vault() 2873 | elif selection == "4": # Create Hold 2874 | vault4() 2875 | elif selection == "5": # Update Hold 2876 | vault5() 2877 | elif selection == "6": # Hold Info 2878 | matname = input( 2879 | Color.BOLD + "Please enter the matter name: " + Color.END 2880 | ) 2881 | name = input( 2882 | Color.BOLD + "Please enter the hold name: " + Color.END 2883 | ) 2884 | cmd = Gam.i + 'vaulthold "' + name + '" matter "' + matname + '"' 2885 | os.system(cmd) 2886 | time.sleep(2) 2887 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2888 | vault() 2889 | elif selection == "0": # Back to main menu 2890 | main_menu() 2891 | else: # Invalid selection. returns to current menu. 2892 | print(Color.RED + Msgs.err + "\n" + Color.END) 2893 | time.sleep(2) 2894 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2895 | vault() 2896 | 2897 | 2898 | def vault1(): # Create Matter 2899 | name = input(Color.BOLD + "Enter a name for the matter: " + Color.END) 2900 | desc = input( 2901 | Color.BOLD + "Enter a short description for the matter: " + Color.END 2902 | ) 2903 | collab = input(Color.BOLD + "Add collaborators [y/N]? " + Color.END) 2904 | if collab == "n" or collab == "no": 2905 | cmd = ( 2906 | Gam.c 2907 | + 'vaultmatter name "' 2908 | + name 2909 | + '" description "' 2910 | + desc 2911 | + '"' 2912 | ) 2913 | elif collab == "y" or collab == "yes": 2914 | collab1 = input( 2915 | Color.BOLD 2916 | + "Enter collaborator email address(es), " 2917 | + "separated by commas without spaces: " 2918 | ) 2919 | cmd = ( 2920 | Gam.c 2921 | + 'vaultmatter name "' 2922 | + name 2923 | + '" description "' 2924 | + desc 2925 | + '" collaborators "' 2926 | + collab1 2927 | + '"' 2928 | ) 2929 | else: # Invalid selection. returns to current menu. 2930 | print(Color.RED + Msgs.err + "\n" + Color.END) 2931 | time.sleep(2) 2932 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2933 | vault() 2934 | os.system(cmd) 2935 | time.sleep(2) 2936 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2937 | vault() 2938 | 2939 | 2940 | def vault2(): # Update Vault matter menu 2941 | while True: 2942 | print(Color.CYAN + "\nUpdate Matter Menu:\n" + Color.END) 2943 | print("1) Update Collaborators") 2944 | print("2) Update Description") 2945 | print("3) Close/Re-open Matter ") 2946 | print("4) Delete/Undelete Matter") 2947 | print("\n0) Back\n") 2948 | selection = input(Color.BOLD + Msgs.choose + Color.END) 2949 | if selection == "1": # Update Collaborators 2950 | name = input( 2951 | Color.BOLD + "Please enter the matter name: " + Color.END 2952 | ) 2953 | ar = input( 2954 | Color.BOLD 2955 | + "Add or remove collaborators [add | " 2956 | + "remove]? " 2957 | + Color.END 2958 | ) 2959 | coll = input( 2960 | Color.BOLD 2961 | + " Collaborator(s) to add/remove, comma " 2962 | + "separated(no spaces): " 2963 | + Color.END 2964 | ) 2965 | cmd = ( 2966 | Gam.up 2967 | + 'vaultmatter "' 2968 | + name 2969 | + '" ' 2970 | + ar 2971 | + 'collaborators "' 2972 | + coll 2973 | + '"' 2974 | ) 2975 | os.system(cmd) 2976 | time.sleep(2) 2977 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2978 | vault2() 2979 | elif selection == "2": # Update description 2980 | name = input( 2981 | Color.BOLD + "Please enter the matter name: " + Color.END 2982 | ) 2983 | desc = input( 2984 | Color.BOLD + "Please enter a short description: " + Color.END 2985 | ) 2986 | cmd = ( 2987 | Gam.up 2988 | + 'vaultmatter "' 2989 | + name 2990 | + '" description "' 2991 | + desc 2992 | + '"' 2993 | ) 2994 | os.system(cmd) 2995 | time.sleep(2) 2996 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 2997 | vault2() 2998 | elif selection == "3": # Close/Reopen matter 2999 | name = input( 3000 | Color.BOLD + "Please enter the matter name: " + Color.END 3001 | ) 3002 | co = input( 3003 | Color.BOLD 3004 | + "Close or Re-open matter [close | reopen]?" 3005 | + " " 3006 | + Color.END 3007 | ) 3008 | cmd = Gam.up + 'vaultmatter "' + name + '" action ' + co 3009 | os.system(cmd) 3010 | time.sleep(2) 3011 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 3012 | vault2() 3013 | elif selection == "4": # Delete/Undelete matter 3014 | print( 3015 | Color.RED 3016 | + "Matters must be closed before they can be " 3017 | + "deleted!\n" 3018 | + Color.END 3019 | ) 3020 | name = input( 3021 | Color.BOLD + "Please enter the matter name: " + Color.END 3022 | ) 3023 | co = input( 3024 | Color.BOLD 3025 | + "Delete or Undelete matter [delete | " 3026 | + "undelete]? " 3027 | + Color.END 3028 | ) 3029 | cmd = Gam.up + 'vaultmatter "' + name + '" action ' + co 3030 | os.system(cmd) 3031 | time.sleep(2) 3032 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 3033 | vault2() 3034 | elif selection == "0": # Back to previous menu 3035 | vault() 3036 | else: # Invalid selection. returns to current menu. 3037 | print(Color.RED + Msgs.err + "\n" + Color.END) 3038 | time.sleep(2) 3039 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 3040 | vault2() 3041 | 3042 | 3043 | def vault4(): # Create Hold 3044 | matname = input(Color.BOLD + "Enter the matter name: " + Color.END) 3045 | name = input(Color.BOLD + "Enter a name for the hold: " + Color.END) 3046 | corpus = input( 3047 | Color.BOLD + "Hold what items? [mail | drive] " + Color.END 3048 | ) 3049 | wt = input( 3050 | Color.BOLD + "Individual users or OU [user | ou]? " + Color.END 3051 | ) 3052 | start = input(Color.BOLD + "Start time [YYYY-MM-DD]? " + Color.END) 3053 | end = input(Color.BOLD + "End time [YYYY-MM-DD]? " + Color.END) 3054 | if wt == "user": 3055 | user = input( 3056 | Color.BOLD 3057 | + "Enter 1 or more email addresses separated " 3058 | + "by commas (no spaces): " 3059 | + Color.END 3060 | ) 3061 | cmd = ( 3062 | Gam.c 3063 | + 'vaulthold matter "' 3064 | + matname 3065 | + '" name "' 3066 | + name 3067 | + '" corpus ' 3068 | + corpus 3069 | + ' accounts "' 3070 | + user 3071 | + '" starttime ' 3072 | + start 3073 | + " endtime " 3074 | + end 3075 | ) 3076 | elif wt == "ou": 3077 | ou = input(Color.BOLD + "Enter an ou (Case Sensitive): " + Color.END) 3078 | cmd = ( 3079 | Gam.c 3080 | + 'vaulthold matter "' 3081 | + matname 3082 | + '" name "' 3083 | + name 3084 | + '" corpus ' 3085 | + corpus 3086 | + ' orgunit "' 3087 | + ou 3088 | + '" starttime ' 3089 | + start 3090 | + " endtime " 3091 | + end 3092 | ) 3093 | else: # Invalid selection. returns to current menu. 3094 | print(Color.RED + Msgs.err + "\n" + Color.END) 3095 | time.sleep(2) 3096 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 3097 | vault() 3098 | os.system(cmd) 3099 | time.sleep(2) 3100 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 3101 | vault() 3102 | 3103 | 3104 | def vault5(): # Update vault hold menu 3105 | while True: 3106 | print(Color.CYAN + "\nUpdate Hold Menu:\n" + Color.END) 3107 | print("1) Update Org Unit/User Account(s)") 3108 | print("2) Update Start/End time") 3109 | print("3) Delete Hold") 3110 | print("\n0) Back\n") 3111 | selection = input(Color.BOLD + Msgs.choose + Color.END) 3112 | if selection == "1": # Update ou 3113 | matname = input( 3114 | Color.BOLD + "Please enter the matter name: " + Color.END 3115 | ) 3116 | name = input( 3117 | Color.BOLD + "Please enter the hold name: " + Color.END 3118 | ) 3119 | wt = input( 3120 | Color.BOLD 3121 | + "Individual user(s) or OU [user | ou]? " 3122 | + Color.END 3123 | ) 3124 | if wt == "user": 3125 | user = input( 3126 | Color.BOLD 3127 | + "Please enter 1 or more email " 3128 | + "addresses separated by commas (no spaces): " 3129 | + Color.END 3130 | ) 3131 | ar = input( 3132 | Color.BOLD + "Add or remove [add | remove]? " + Color.END 3133 | ) 3134 | cmd = ( 3135 | Gam.up 3136 | + 'vaulthold "' 3137 | + name 3138 | + '" matter "' 3139 | + matname 3140 | + '" ' 3141 | + ar 3142 | + 'accounts "' 3143 | + user 3144 | + '"' 3145 | ) 3146 | elif wt == "ou": 3147 | ou = input( 3148 | Color.BOLD 3149 | + "Please enter an ou (Case Sensitive): " 3150 | + Color.END 3151 | ) 3152 | cmd = ( 3153 | Gam.up 3154 | + 'vaulthold "' 3155 | + name 3156 | + '" matter "' 3157 | + matname 3158 | + '" ' 3159 | + 'orgunit "' 3160 | + ou 3161 | + '"' 3162 | ) 3163 | else: # Invalid selection. returns to current menu. 3164 | print(Color.RED + Msgs.err + "\n" + Color.END) 3165 | time.sleep(2) 3166 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 3167 | vault5() 3168 | os.system(cmd) 3169 | time.sleep(2) 3170 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 3171 | vault5() 3172 | elif selection == "2": # Update start/end 3173 | matname = input( 3174 | Color.BOLD + "Please enter the matter name: " + Color.END 3175 | ) 3176 | name = input( 3177 | Color.BOLD + "Please enter the hold name: " + Color.END 3178 | ) 3179 | start = input( 3180 | Color.BOLD 3181 | + "What is the new start time " 3182 | + "[YYYY-MM-DD]? " 3183 | + Color.END 3184 | ) 3185 | end = input( 3186 | Color.BOLD 3187 | + "What is the new end time [YYYY-MM-DD]? " 3188 | + Color.END 3189 | ) 3190 | cmd = ( 3191 | Gam.up 3192 | + 'vaulthold "' 3193 | + name 3194 | + '" matter "' 3195 | + matname 3196 | + '" starttime ' 3197 | + start 3198 | + " endtime " 3199 | + end 3200 | ) 3201 | os.system(cmd) 3202 | time.sleep(2) 3203 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 3204 | vault5() 3205 | elif selection == "3": # Delete Hold 3206 | matname = input( 3207 | Color.BOLD + "Please enter the matter name: " + Color.END 3208 | ) 3209 | name = input( 3210 | Color.BOLD + "Please enter the hold name: " + Color.END 3211 | ) 3212 | cmd = Gam.de + 'vaulthold "' + name + '" matter "' + matname + '"' 3213 | os.system(cmd) 3214 | time.sleep(2) 3215 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 3216 | vault5() 3217 | elif selection == "0": # Back to previous menu 3218 | vault() 3219 | else: # Invalid selection. returns to current menu. 3220 | print(Color.RED + Msgs.err + "\n" + Color.END) 3221 | time.sleep(2) 3222 | input(Color.GREEN + "\n" + Msgs.cont + Color.END) 3223 | vault5() 3224 | 3225 | 3226 | cred() 3227 | main_menu() 3228 | --------------------------------------------------------------------------------