aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoviuro <moviuro+git@gmail.com>2017-12-05 20:56:39 +0100
committerMoviuro <moviuro+git@gmail.com>2017-12-05 20:56:39 +0100
commit1b62f92dfb4fe89b7590049b3abe635c71775a9d (patch)
tree7e086f7f5788a8805e839483981d618ba8fe31ed
parent9b3cafc678dce43558d57ebe7164e6e330e9e0ee (diff)
parent91a0829b690767b1734487f4af8766a586d7b1b7 (diff)
downloadrofi-pass-1b62f92dfb4fe89b7590049b3abe635c71775a9d.tar.gz
Merge remote-tracking branch 'upstream/master' into otp
-rw-r--r--README.md88
-rwxr-xr-xrofi-pass25
2 files changed, 68 insertions, 45 deletions
diff --git a/README.md b/README.md
index b989ef6..27c4ce9 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,11 @@
# rofi-pass
-#### bash script to handle pass storages in a convenient way
+A bash script to handle [Simple Password Store](http://www.passwordstore.org/)
+in a convenient way using [rofi](https://github.com/DaveDavenport/rofi).
![rofi-pass](https://53280.de/rofi/rofi-pass.png "rofi-pass in action")
-## Features:
+## Features
* Open URLs of entries with hotkey
* Add new Entries to Password Storage
@@ -12,34 +13,41 @@
* Generate new passwords for entries
* Inline view, which can copy/type individual entries
* Move/Delete existing entries
-* Support for multiple roots for password-store (e.g. separate work from private passwords)
+* Support for different password stores (roots), e.g. to separate passwords for
+ work from private passwords
* Type any field from entry
-* Auto Type User and Password. Format of password files are expected to be like:
-* Bookmarks mode (default: Alt+x)
-* Share common used passwords between several entries (with different URLS,usernames etc)
-```
-foobarmysecurepassword
-user: MyUser
-url: http://my.url.foo
-```
-* Auto Typing of more than one field. This expects a autotype field in password file.
-```
-foobarmysecurepassword
----
-user: MyUser
-SomeField: foobar
-AnotherField: barfoo
-url: http://my.url.foo
-autotype: SomeField :tab UserName :tab AnotherField :tab pass
-```
-The `:tab` field has a special meaning. this will hit the tab key, obviously.<br>
-Same for `:space`, which will hit the space key, can be used to activate checkboxes.
-In addition to those `:enter` and `:delay` are available.
-
-* All Hotkeys are configurable in config file
-* user, url and autotype field names are also configurable
+* Auto-typing of user and/or password fields.
+ The format for password files should look like:
+
+ ```
+ foobarmysecurepassword
+ user: MyUser
+ url: http://my.url.foo
+ ```
+
+* Auto-typing of more than one field, using the `autotype` entry:
+
+ ```
+ foobarmysecurepassword
+ ---
+ user: MyUser
+ SomeField: foobar
+ AnotherField: barfoo
+ url: http://my.url.foo
+ autotype: SomeField :tab UserName :tab AnotherField :tab pass
+ ```
+
+ You can use `:tab`, `:enter`, or `:space` here to type <kbd>Tab</kbd>,
+ <kbd>Enter</kbd>, or <kbd>Space</kbd> (useful for toggling checkboxes)
+ respectively.
+ `:delay` will trigger a delay (2 seconds by default).
+* All hotkeys are configurable in the config file
+* The field names for `user`, `url` and `autotype` are configurable
+* Bookmarks mode (open stored URLs in browser, default: Alt+x)
+* Share common used passwords between several entries (with different URLs, usernames etc)
## Requirements
+
* pass (http://www.passwordstore.org/)
* sed
* rofi (https://github.com/DaveDavenport/rofi)
@@ -49,14 +57,19 @@ In addition to those `:enter` and `:delay` are available.
* pwgen
### BSD
+
* gnugrep
* gawk
## Configuration
+
rofi-pass may read its configuration values from `/etc/rofi-pass` and/or `$HOME/.config/rofi-pass/config`.
For an example configuration please take a look at the included `config.example` file.
## Extras
+
+### addpass
+
rofi-pass comes with a tiny helper script, which makes it easier to create new pass entries.
Just run it with
@@ -69,11 +82,17 @@ addpass --name "My new Site" +user "zeltak" +branch "branch" +custom "foobar" +a
* `--root` can also be a colon separated list of directories, in which case you can navigate between them on the main menu with Shift+Left and Shift+Right.
* Fieldnames are defined with `+` and the actual value is defined inside the quotations. You can add as many fields as you like
+### keepass2 import script
+
Also included is an import script for keepass2 databases. It's the same script that can be downloaded from the pass homepage, with some minor modifications to match rofi-pass structure.
+### csv exporter
+
+Finally a script to export your pass database to csv is included. The resulting csv was tested in keepassxc.
+
## Sharing passwords
-Rofi-pass allows you to easily share common used passwords across multiple entries.
+Rofi-pass allows you to easily share common used passwords across multiple entries.
For example, if you have an academic account which includes several services (such as a library, Salary, Student portal etc), all with different URL's, login forms etc. you can share one password across all of them. This is very handy when the passwords change annually.
To use this function you need to add the following line instead of the password, referencing a pass file which holds the password.
@@ -86,10 +105,15 @@ where PATH is relative to your password-store.
## FAQ
-* rofi pass prints garbage instead of my actual passes <br>Make sure to run `setxkbmap <language> <variant>` at the start of your Xorg session.
+### rofi pass prints garbage instead of my actual passes
+
+Make sure to run `setxkbmap <language> <variant>` at the start of your Xorg
+session.
## Alternative
-jreinert has written the roughly compatible tool [autopass](https://github.com/jreinert/autopass). It has less features, but definately saner code.
-Also he provided a nice little script called `passed` to change your fieldnames. [link](https://github.com/jreinert/passed)
-And finally it ships with a script "pass2csv.py", which can export your pass store to csv format.
+jreinert has written the roughly compatible tool
+[autopass](https://github.com/jreinert/autopass). It has less features, but
+definately saner code.
+Also he provided a nice little script called `passed` to change your
+fieldnames. [link](https://github.com/jreinert/passed)
diff --git a/rofi-pass b/rofi-pass
index 9c395b4..adf53bc 100755
--- a/rofi-pass
+++ b/rofi-pass
@@ -66,8 +66,7 @@ doClip () {
}
checkIfPass () {
- rm -f "$HOME/.cache/rofi-pass/last_used"
- printf '%s\n' "${root}: $selected_password" > "$HOME/.cache/rofi-pass/last_used"
+ printf '%s\n' "${root}: $selected_password" >| "$HOME/.cache/rofi-pass/last_used"
}
@@ -335,11 +334,11 @@ mainMenu () {
26) ${basecommand} --bmarks; return;;
esac
- mapfile -t password_temp < <(PASSWORD_STORE_DIR="${root}" pass "$selected_password")
+ mapfile -t password_temp < <(PASSWORD_STORE_DIR="${root}" pass show "$selected_password")
password=${password_temp[0]}
if [[ ${password} == "#FILE="* ]]; then
pass_file="${password#*=}"
- mapfile -t password_temp < <(PASSWORD_STORE_DIR="${root}" pass "${pass_file}")
+ mapfile -t password_temp < <(PASSWORD_STORE_DIR="${root}" pass show "${pass_file}")
password=${password_temp[0]}
fi
fields=$(printf '%s\n' "${password_temp[@]:1}" | awk '$1 ~ /:$/ || /otpauth:\/\// {$1=$1;print}')
@@ -419,7 +418,7 @@ clearUp () {
}
helpMenu () {
- helptext=$(printf '%s' "${autotype}: Autotype
+ printf '%s' "${autotype}: Autotype
${type_user}: Type Username
${type_pass}: Type Password
---
@@ -436,7 +435,7 @@ ${switch}: Switch Pass/Bookmark Mode
---
${previous_root}: Switch to previous password store (--roots)
${next_root}: Switch to next password store (--roots)
-" | _rofi -dmenu -mesg "Hint: All hotkeys are configurable in config file" -p "Help > ")
+" | _rofi -dmenu -mesg "Hint: All hotkeys are configurable in config file" -p "Help > "
help_val=$?
if [[ $help_val -eq 1 ]]; then exit;
else unset helptext; mainMenu; fi
@@ -450,13 +449,13 @@ typeMenu () {
local -a keys=(${!stuff[@]})
keys=(${keys[@]/$AUTOTYPE_field})
typefield=$({ echo ${AUTOTYPE_field} ; printf '%s\n' "${keys[@]}" | sort; } | _rofi -dmenu -p "Choose Field to type > ")
- val=$?
- if [[ $val -eq 1 ]]; then
+ typefield_exit=$?
+ if [[ $typefield_exit -eq 1 ]]; then
exit
fi
case "$typefield" in
- "") exit;;
- "password") sleep $wait; typePass;;
+ '') exit;;
+ 'password') sleep $wait; typePass;;
"${AUTOTYPE_field}") sleep $wait; autopass;;
*) sleep $wait; typeField
esac
@@ -515,7 +514,7 @@ actionMenu () {
showEntry () {
if [[ -z $pass_content ]]; then
- password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password")
+ password_temp=$(PASSWORD_STORE_DIR="${root}" pass show "$selected_password")
password="${password_temp%%$'\n'*}"
pass_key_value=$(printf '%s' "${password_temp}" | tail -n+2 | grep ': ')
declare -A stuff
@@ -623,7 +622,7 @@ insertPass () {
url=$(xclip --selection clipboard -o)
if [[ "${url:0:4}" == "http" ]]
then
- domain_name="$(printf '%s\n' "${url}" | awk -F \/ '{l=split($3,a,"."); print (a[l-1]=="com"?a[l-2] OFS:X) a[l-1] OFS a[l]}' OFS=".")"
+ domain_name="$(printf '%s\n' "${url}" | awk -F / '{l=split($3,a,"."); print (a[l-1]=="com"?a[l-2] OFS:X) a[l-1] OFS a[l]}' OFS=".")"
help_content="Domain: ${domain_name}
Type name, make sure it is unique"
else
@@ -705,7 +704,7 @@ Usage:
--root set custom root directories (colon separated)
--last-used highlight last used item
--show-last show details of last used Entry
- --bmarks run bookmarks Mode
+ --bmarks start in bookmarks mode
rofi-pass version 1.5.3
EOF