doy / rbw

unofficial bitwarden cli
https://git.tozt.net/rbw
Other
611 stars 84 forks source link

`rbw gen` - password length not respected and differs depending on options used #54

Closed rjc closed 3 years ago

rjc commented 3 years ago

Hello,

I just noticed that the length of a generated password is not respected and is limited depending on what option has been used, i.e.:

Attached is an output of:

for i in $(jot 100)
do
        echo $i characters
        rbw gen $i | wc -m
        rbw gen $i --no-symbols | wc -m
        rbw gen $i --nonconfusables | wc -m
        rbw gen $i --only-numbers | wc -m
done > rbw-pass

GNU coreutils users will need to replace jot(1) with seq(1). The results are off by one due to newline character being present and counted.

Also, while we're at it, options are doubled on error, i.e.:

$ rbw gen --only-numbers
error: The following required arguments were not provided:
    <len>

USAGE:
    rbw generate <len> <--no-symbols|--only-numbers|--nonconfusables|--diceware|--no-symbols|--only-numbers|--nonconfusables|--diceware>

For more information try --help
doy commented 3 years ago

fixed in c248016, thanks!

doy commented 3 years ago

(the second issue is https://github.com/clap-rs/clap/issues/1487 which will hopefully be resolved once clap 3 is eventually released)