From 73777495a81caa2ac08e5dec5a0aafb27c89f249 Mon Sep 17 00:00:00 2001 From: "Emily Rye (ryee2)" Date: Tue, 30 Nov 2021 18:25:30 +0000 Subject: [PATCH] Update leap.py added comments --- src/leap.py | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/leap.py b/src/leap.py index 834d3ffc..4fe1225c 100644 --- a/src/leap.py +++ b/src/leap.py @@ -30,12 +30,17 @@ def enum_2(): def enum_3(): print("enum-3: Get operating system by: Webb") + # get OS name opsys_name = platform.system() + # display Mac OS as "Mac" if opsys_name == "Darwin": opsys_name = "Mac" + # get OS version opsys_release = platform.release() + + # return OS name and version return f"{opsys_name} {opsys_release}" @@ -87,12 +92,12 @@ def privesc_1(): if AdminTest(): #checks the value of admintest print("you are running in admin.") #confirms that they are using admin print("press enter to view all your network configs") #shows the user what will happen - input() + input() os.system("ipconfig/all") #runs the command into the shell and displays the network configs input() else: #this is the fail safe if python isn't launched as admin. print("you are not running as admin, press enter to run as admin") #informs the user they are not admin - input() + input() ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1) #this runs the application as admin allowing us to use OS.System commands that need admin rights print("press enter to view all your network configs") #shows the user what will happen input() @@ -101,19 +106,25 @@ def privesc_1(): def privesc_2(): print("priv-esc-2 by: Webb") + + # open windows cmd as administrator os.system("""powershell -Command "Start-Process cmd -Verb RunAs""""") def privesc_3(): print("priv-esc-3 by: Webb") + + # open root terminal os.system("sudo x-terminal-emulator") def menu(sys): quit = False + # display windows menu if sys == "Windows": - print("1Which line of code would you like to try? (Enter a number):\n" + # print menu + print("Which line of code would you like to try? (Enter a number):\n" "1: Get current user by: Tazmin\n" "2: Get user domain by: Jacob\n" "3: Get operating system by: Webb\n" @@ -125,6 +136,7 @@ def menu(sys): "10: priv-esc-2 by: Webb\n" "12: Quit program\n") + # handle invalid inputs try: start = int(input()) except: @@ -133,7 +145,9 @@ def menu(sys): if (start == 6) or (start == 11): start = 13 + # display mac menu elif sys == "Darwin": + # print menu print("Which line of code would you like to try? (Enter a number):\n" "1: Get current user by: Tazmin\n" "2: Get user domain by: Jacob\n" @@ -145,9 +159,10 @@ def menu(sys): "8: Get MAC address by: Reece\n" "9: priv-esc-1 by: Tazmin and Webb\n" "10: priv-esc-2 by: Webb\n" - "11: priv-esc-3 by:\n" + "11: priv-esc-3 by: Webb\n" "12: Quit program\n") + # handle invalid inputs try: start = int(input()) except: @@ -156,16 +171,19 @@ def menu(sys): #if start == : # start = + # display linux menu elif sys == "Linux": + # print menu print("Which line of code would you like to try? (Enter a number):\n" "1: Get current user by: Tazmin\n" "3: Get operating system by: Webb\n" "5: Port scanning by: Jacob\n" "6: Get group ID by: Joe and Tazmin\n" "8: Get MAC address by: Reece\n" - "11: priv-esc-3 by:\n" + "11: priv-esc-3 by: Webb\n" "12: Quit program\n") + # handle invalid inputs try: start = int(input()) except: @@ -174,6 +192,7 @@ def menu(sys): if (start == 2) or (start == 4) or (start == 7) or (start == 9) or (start == 10): start = 13 + # go to function chosen by user if start == 1: print(enum_1()) input() @@ -219,29 +238,39 @@ def menu(sys): input() elif start == 12: + # if user wants to quit quit = True else: print("Invalid Input") input() + # return whether user wants to quit return quit +# continue to display menu while 1 == 1: + # find operating system opsys = platform.system() if opsys == "Windows": + # clear screen os.system("cls") + # open menu stop = menu(opsys) + # if user wants to quit, break loop if stop is True: break elif (opsys == "Darwin") or (opsys == "Linux"): + # clear screen os.system("clear") + # open menu stop = menu(opsys) + # if user wants to quit, break loop if stop is True: break