Skip to content

Instantly share code, notes, and snippets.

@joshtrichards
Last active February 22, 2023 16:57
Show Gist options
  • Save joshtrichards/a060b79001426e524a5335035f468d6f to your computer and use it in GitHub Desktop.
Save joshtrichards/a060b79001426e524a5335035f468d6f to your computer and use it in GitHub Desktop.

Revisions

  1. joshtrichards revised this gist Feb 22, 2023. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions bw-cli-tidbits.md
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,12 @@ Calculate how many entries have had their password changed since a particular da

    `bw list items | jq '.[] | select(.login.passwordRevisionDate >= "2023-01-01")' | jq -s length`

    Calculate how many entries have had their password changed in the last "X days":

    ```
    DAYS_AGO=`date -d"30 days ago" +%Y-%m-%d` bw list items | jq -r --arg DAYS_AGO "$DAYS_AGO" '.[] | select(.login.passwordRevisionDate >= $DAYS_AGO)' | jq -s length
    ```

    Sort all entries by revisionDate:

    `bw list items | jq '. |= sort_by(.revisionDate)'`
  2. joshtrichards revised this gist Feb 22, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bw-cli-tidbits.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ Find all entries that have integrated TOTP configured:

    Calculate how many entries have integrated TOTP configured:

    bw list items | jq '.[] | select(.login.totp != null)' | jq -s length
    `bw list items | jq '.[] | select(.login.totp != null)' | jq -s length`

    Find all entries that *don't* have integrated TOTP configured:

  3. joshtrichards created this gist Feb 22, 2023.
    39 changes: 39 additions & 0 deletions bw-cli-tidbits.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    Find all entries that have integrated TOTP configured:

    `bw list items | jq '.[] | select(.login.totp != null)'`

    Calculate how many entries have integrated TOTP configured:

    bw list items | jq '.[] | select(.login.totp != null)' | jq -s length

    Find all entries that *don't* have integrated TOTP configured:

    `bw list items | jq '.[] | select(.login.totp == null)'`

    Calculate how many entries *don't* have integrated TOTP configured:

    `bw list items | jq '.[] | select(.login.totp == null)' | jq -s length`

    Find all entries that had their password changed since a particular date:

    `bw list items | jq '.[] | select(.login.passwordRevisionDate >= "2023-01-01")'`

    Calculate how many entries have had their password changed since a particular date:

    `bw list items | jq '.[] | select(.login.passwordRevisionDate >= "2023-01-01")' | jq -s length`

    Sort all entries by revisionDate:

    `bw list items | jq '. |= sort_by(.revisionDate)'`

    Find all entries with a particular username (login):

    `bw list items | jq '.[] | select(.login.username == "[email protected]")'`

    Find all entries that have notes specified:

    `bw list items | jq '.[] | select(.notes != null)'`

    Find all entries that have notes specified and spit out just the notes:

    `bw list items | jq '.[] | select(.notes != null)' | jq .notes`