Yubico / yubikey-manager

Python library and command line tool for configuring any YubiKey over all USB interfaces.
https://developers.yubico.com/yubikey-manager/
BSD 2-Clause "Simplified" License
862 stars 125 forks source link

unable to have - in password for command line static password #629

Closed farmtyr closed 2 days ago

farmtyr commented 3 weeks ago

Usage: ykman otp static [OPTIONS] {1|2} [PASSWORD] Try 'ykman otp static -h' for help.

Error: No such option: -t

Steps to reproduce

Open terminal enter ykman otp (either slot) -restofpassword get error even if using escape keys that option does not exist

Expected result

Save the static password like ykman gui does

[What did you expect to happen when you did the above?]

Actual results and logs

ykman -l debug otp static -f 2 -\testpassword INFO 10:04:46.889 [ykman.logging.set_log_level:60] Logging at level: DEBUG WARNING 10:04:46.889 [ykman.logging.set_log_level:64] #############################################################################

WARNING: Sensitive data may be logged!

Some personally identifying information may be logged, such as usernames!

############################################################################# INFO 10:04:46.889 [ykman._cli.main.cli:355] System info: ykman: 5.5.1 Python: 3.12.5 (main, Aug 6 2024, 19:08:49) [Clang 15.0.0 (clang-1500.3.9.4)] Platform: darwin Arch: x86_64 System date: 2024-08-16 Running as admin: False

Usage: ykman otp static [OPTIONS] {1|2} [PASSWORD] Try 'ykman otp static -h' for help.

Error: No such option: -t

Other info

[Anything else you would like to add?]

dainnilsson commented 3 weeks ago

For any string argument that begins with a dash you'll have to explicitly specify that it should not be interpreted as an option by sending a -- to separate options from arguments. This is the case with many CLI tools.

ykman otp static 2 -k us -- -mypassword