diff --git a/LICENSE b/LICENSE index 2071b23..8dab4d2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) +Copyright (c) 2023 Morgan McMillian Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/bwui b/bwui new file mode 100755 index 0000000..9f82fd9 --- /dev/null +++ b/bwui @@ -0,0 +1,45 @@ +#!/bin/bash + +# Prompt for master password +PASS=$(yad --title "Master Password" --width=400 --entry --hide-text) +RC=$? +if [[ $RC -eq 1 ]]; then + exit 0 +fi + +# Unlock the session +export BW_SESSION=$(bw unlock $PASS --raw) +if [[ ${#BW_SESSION} -eq 0 ]]; then + yad --title "Error" --text="Invalid master password." --button="Close" + exit 1 +fi + +# Prompt for a search +SEARCH=$(yad --form --title "Search Bitwarden" --width=400 --entry) +RC=$? +if [[ $RC -eq 1 ]]; then + exit 0 +fi + +# Display the results +SID=$(bw list items --search "$SEARCH" | \ + jq '.[] | {id, name, username: .login.username, url: .login.url}' | \ + jq '.id,.name,.username,.url' | \ + yad --title "Bitwarden Entries" --list --width=600 --height=600 \ + --column="ID" --column="Name" --column="Username" --column="URL" \ + --hide-column=1 | cut -d '|' -f 1 | tr -d '"') +if [[ ${#SID} -eq 0 ]]; then + exit 0 +fi + +# Fetch the password for a selected entry +PW=$(bw get password "$SID") + +yad --title "BW" --text="Password ready." --button="Copy:2" --button="Close:1" +RC=$? +if [[ $RC -eq 2 ]]; then + echo $PW | wl-copy + yad --title "BW" --button="Close:1" +fi + +wl-copy --clear diff --git a/bwui.desktop b/bwui.desktop new file mode 100644 index 0000000..373ba26 --- /dev/null +++ b/bwui.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=BW UI +Type=Application +Icon=applications-utilities +Exec=bwui +Categories=Utility;