Exemplo n.º 1
0
    def addPass():
        # ask the user what catagory the password is in, and where the password is used
        if PasswordManager.mstrPWStor.keys().__str__() == "dict_keys([])":
            catagory = input("What do you want to call your first catagory? ")
            passFor = input("Where is this password going to be used? ")
        else:
            while True:
                catagory = input(f"What category is this password; {useful.Strings.lstToStr(PasswordManager.mstrPWStor, ', ', False)}, or enter a new name to create a new catagory? ")
                passFor = input("Where is this password going to be used? ")
                break

        # ask the user what the password is, or generate one for them
        ui = getpass("Type a password, or put a number 1 to 3 for a password with that strength to be generated, 1 being super weak, 3 being super strong: ")
        while True:
            useful.Terminal.clear()
            if ui.isdigit():
                if 3 <= int(ui) + 2 <= 5:
                    if not catagory in PasswordManager.mstrPWStor:
                        PasswordManager.mstrPWStor[catagory] = {}
                    randPass = Password( Generator.genPass(int(ui) + 2) )
                    PasswordManager.mstrPWStor[catagory][passFor] = randPass.getPass()
                    break
            else:
                passTemp = Password(ui)
                if passTemp.check():
                    if not catagory in PasswordManager.mstrPWStor:
                        PasswordManager.mstrPWStor[catagory] = {}
                    PasswordManager.mstrPWStor[catagory][passFor] = passTemp.getPass()
                    break
            ui = getpass("That password was insecure, type a password, or put a number 1 to 3 for a password with that strength to be generated, 1 being super weak, 3 being super strong: ")
Exemplo n.º 2
0
    def edit():
        # ask the user what catagory the password is in
        PasswordManager.listPass()
        cat = input(f"What category is the password in ")
        while not cat in PasswordManager.mstrPWStor:
            useful.Terminal.clear()
            PasswordManager.listPass()
            cat = input("That's not a category, try again ")

        # ask the user where the password gets used
        useful.Terminal.clear()
        PasswordManager.listPass()
        place = input("What is the password to ")
        while not place in PasswordManager.mstrPWStor[cat]:
            useful.Terminal.clear()
            PasswordManager.listPass()
            place = input("That place isn't in the records, try again ")

        # ask the user what they want the new password to be, or generate one for them
        ui = getpass(
            "Type a password, or put a number 1 to 3 for a password with that strength to be generated, 1 being super weak, 3 being super strong: "
        )
        while True:
            useful.Terminal.clear()
            if ui.isdigit():
                if 3 <= int(ui) + 2 <= 5:
                    if not cat in PasswordManager.mstrPWStor:
                        PasswordManager.mstrPWStor[cat] = {}
                    randPass = Password(Generator.genPass(int(ui) + 2))
                    PasswordManager.mstrPWStor[cat][place] = randPass.getPass()
                    break
            else:
                passTemp = Password(ui)
                if passTemp.check():
                    if not cat in PasswordManager.mstrPWStor:
                        PasswordManager.mstrPWStor[cat] = {}
                    PasswordManager.mstrPWStor[cat][place] = passTemp.getPass()
                    break
            ui = getpass(
                "That password was insecure, type a password, or put a number 1 to 3 for a password with that strength to be generated, 1 being super weak, 3 being super strong: "
            )