Exemple #1
0
def main(args=sys.argv[1:]):
    args = parse_args(args)
    if args.version:
        print(__version__)
        sys.exit(0)
    error, help_message = validate_args(args)
    if args.help:
        print_help(help_message, long=True)
        sys.exit(0)
    if error:
        print_help(help_message)
        sys.exit(0)
    profile, master_password = create_profile(args)
    if not master_password:
        master_password = getpass.getpass("Master Password: "******"Copied to clipboard")
        except Exception as e:
            print("Copy failed, we are sorry")
            print("Can you send us an email at [email protected]\n")
            print("-" * 80)
            print("Object: [LessPass][cli] Copy issue on %s" %
                  platform.system())
            print("Hello,")
            print("I got an issue with LessPass cli software.\n")
            traceback.print_exc()
            print("-" * 80)
    else:
        print(generated_password)
Exemple #2
0
def main(args=sys.argv[1:]):
    args = parse_args(args)
    if args.clipboard and not get_system_copy_command():
        print(
            "error: To use the option -c (--copy) you need pbcopy on OSX, "
            + "xsel, xclip, or wl-clipboard on Linux, and clip on Windows"
        )
        sys.exit(3)

    if args.save_path:
        return save_password_profiles(args.config_home_path, args.url, args.save_path)

    if args.load_path:
        return load_password_profiles(args.config_home_path, args.url, args.load_path)

    if args.prompt:
        if not args.site:
            args.site = getpass.getpass("Site: ")
        if not args.login:
            args.login = getpass.getpass("Login: "******"error: argument SITE is required but was not provided.")
        sys.exit(4)

    if not args.master_password:
        prompt = "Master Password: "******"error: argument MASTER_PASSWORD is required but was not provided")
        sys.exit(5)

    profile, master_password = create_profile(args)
    try:
        generated_password = generate_password(profile, master_password)
    except exceptions.ExcludeAllCharsAvailable:
        print("error: you can't exclude all chars available")
        sys.exit(6)

    if args.clipboard:
        try:
            copy(generated_password)
            print("Copied to clipboard")
        except Exception:
            print("Copy failed, we are sorry")
            print("Can you send us an email at [email protected]\n")
            print("-" * 80)
            print("Object: [LessPass][cli] Copy issue on %s" % platform.system())
            print("Hello,")
            print("I got an issue with LessPass cli software.\n")
            traceback.print_exc()
            print("-" * 80)
    else:
        print(generated_password)
Exemple #3
0
def main(args=sys.argv[1:]):
    args = parse_args(args)
    if args.clipboard and not get_system_copy_command():
        print("ERROR To use the option -c (--copy) you need pbcopy " +
              "on OSX, xsel or xclip on Linux, and clip on Windows")
        sys.exit(3)

    if args.prompt:
        args.site = getpass.getpass("Site: ")
        args.login = getpass.getpass("Login: "******"ERROR argument SITE is required but was not provided.")
        sys.exit(4)

    if not args.master_password:
        args.master_password = getpass.getpass("Master Password: "******"ERROR argument MASTER_PASSWORD is required but was not provided")
        sys.exit(5)

    profile, master_password = create_profile(args)
    generated_password = generate_password(profile, master_password)

    if args.clipboard:
        try:
            copy(generated_password)
            print("Copied to clipboard")
        except Exception as e:
            print("Copy failed, we are sorry")
            print("Can you send us an email at [email protected]\n")
            print("-" * 80)
            print("Object: [LessPass][cli] Copy issue on %s" %
                  platform.system())
            print("Hello,")
            print("I got an issue with LessPass cli software.\n")
            traceback.print_exc()
            print("-" * 80)
    else:
        print(generated_password)
Exemple #4
0
def main(args=sys.argv[1:]):
    args = parse_args(args)
    if args.clipboard and not get_system_copy_command():
        print(
            "ERROR To use the option -c (--copy) you need pbcopy "
            + "on OSX, xsel or xclip on Linux, and clip on Windows"
        )
        sys.exit(3)

    if args.prompt_all:
        args.site = getpass.getpass("Site: ")
        args.login = getpass.getpass("Login: "******"Counter: ")
        if counter.isdigit():
            args.counter = int(counter)
        else:
            print("ERROR argument COUNTER must be an integer.")
            sys.exit(4)
            
        length = getpass.getpass("Length [5-35]: ")
        try:
            length = int(length)
            if length >= 5 and length <= 35:
                args.length = length
            else:
                raise
        except:
            print("ERROR argument LENGTH must be an integer in range [5-35].")
            sys.exit(4)
            
        args.nl = True if getpass.getpass("Lowercase (Y/n): ") == 'n' else False
        args.nu = True if getpass.getpass("Uppercase (Y/n): ") == 'n' else False
        args.nd = True if getpass.getpass("Digits (Y/n): ") == 'n' else False
        args.ns = True if getpass.getpass("Symbols (Y/n): ") == 'n' else False
        
    elif args.prompt:
        args.site = getpass.getpass("Site: ")
        args.login = getpass.getpass("Login: "******"ERROR argument SITE is required but was not provided.")
        sys.exit(4)

    if not args.master_password:
        args.master_password = getpass.getpass("Master Password: "******"ERROR argument MASTER_PASSWORD is required but was not provided")
        sys.exit(5)

    profile, master_password = create_profile(args)
    generated_password = generate_password(profile, master_password)

    if args.clipboard:
        try:
            copy(generated_password)
            print("Copied to clipboard")
        except Exception as e:
            print("Copy failed, we are sorry")
            print("Can you send us an email at [email protected]\n")
            print("-" * 80)
            print("Object: [LessPass][cli] Copy issue on %s" % platform.system())
            print("Hello,")
            print("I got an issue with LessPass cli software.\n")
            traceback.print_exc()
            print("-" * 80)
    else:
        print(generated_password)