doy / rbw

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

[Feature request] Filter list by existing TOTP #119

Open tasmo opened 1 year ago

tasmo commented 1 year ago

I wish to get just names/IDs of entries with an existing TOTP code.

rbw list just can list the fields Name, ID, User and Folder.

https://github.com/doy/rbw/blob/8aa7e36a4f2746b314b0a582f3c59cc8b6b03ca2/src/bin/rbw/commands.rs#L592-L604

Neither it can list the full JSON in raw format to get filtered by advanced gojq/jq. This is just possible for single entries.

rjc commented 1 year ago

@tasmo Only yesterday I had the need for the very same functionality - had to run this instead:

 $ for i in $(rbw ls) ; do rbw get --full $i 2>/dev/null | awk -v totp=$i '/TOTP/ { print totp }' ; done | sed 's/\n/ /'

sed is optional, of course, but I need to format the list for OpenBSD's ksh autocomplete.

tasmo commented 1 year ago

@rjc Your solution is working and a good approach. Although the command took in my case much too long:

for i in $(rbw ls); do; rbw get --full $i 2> /dev/null | awk -v totp=$i ; done  19,68s user 33,36s system 64% cpu 1:22,21 total
sed 's/\n/ /'  0,00s user 0,00s system 0% cpu 1:22,21 total
rjc commented 1 year ago

For me it's:

     0m13.34s real     0m02.99s user     0m05.45s system

Is #11 related by any chance?

tasmo commented 1 year ago

Is #11 related by any chance?

I cannot tell. To get single passwords filtered with skim is quite fast here.