pwss 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.textile +9 -5
- data/bin/pwss +14 -8
- data/lib/pwss.rb +17 -8
- data/lib/pwss/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beca8e8821633787a38795eeff8ede8471aae201
|
4
|
+
data.tar.gz: 5fe7c3c6926bd4646af646cf5f5b6d94110263bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81f03cb7c8c3d1fc9f5c5cd43be63039a1d916f1d4ef107df38fb13953c82bde320db9b95b3147e95ed0dacda5f200e651517552f0f332e48e000c2557e189ac
|
7
|
+
data.tar.gz: c5189e3f75c9b4fcf0aa2ce05aa79330c19e7e4c0de790e0ba8e0995e25c100bc08fe881238a045a6d9bbed1f257524d57a64dea10bed009d0d15f46662dac5b
|
data/README.textile
CHANGED
@@ -2,7 +2,7 @@ h1. Pwss
|
|
2
2
|
|
3
3
|
A password manager in the spirit of "pws":https://github.com/janlelis/pws.
|
4
4
|
|
5
|
-
PWSS can store multiple entries in a file and
|
5
|
+
PWSS can store multiple entries in a file and it allows user to specify various types of entries (e.g., BankAccount) and different infos for each entry (e.g., URL for Internet passwords).
|
6
6
|
|
7
7
|
Features:
|
8
8
|
|
@@ -62,9 +62,9 @@ A typical usage scenario is the following:
|
|
62
62
|
|
63
63
|
*Using multiple safes.* If you want to create multiple password files or store a password file in a non-standard location, use the @-f@ (@--filename@) option:
|
64
64
|
|
65
|
-
# @pwss -f MYFILE
|
66
|
-
# @pwss -f MYFILE
|
67
|
-
# @pwss -f MYFILE
|
65
|
+
# @pwss init -f MYFILE@
|
66
|
+
# @pwss add -f MYFILE@
|
67
|
+
# @pwss get -f MYFILE@
|
68
68
|
|
69
69
|
*Do not forget to use the extension @.enc@, if your password file to be encrypted.* (See "Encrypted and Plain files", below.)
|
70
70
|
|
@@ -72,7 +72,7 @@ A typical usage scenario is the following:
|
|
72
72
|
|
73
73
|
bc. $ pwss get my_email -w 3
|
74
74
|
|
75
|
-
will retrieve entry whose title is @my_email@ and make the password available in the clipboard for @
|
75
|
+
will retrieve entry whose title is @my_email@ and make the password available in the clipboard for @3@ seconds.
|
76
76
|
|
77
77
|
Use @0@ to keep the password in the clipboard till a key is pressed.
|
78
78
|
|
@@ -163,6 +163,10 @@ Notice that only @title@ and @password@ are required.
|
|
163
163
|
|
164
164
|
h2. Changelog
|
165
165
|
|
166
|
+
* *Release 0.4.0*
|
167
|
+
** New @--stdout@ option will output password to standard output (useful for integration with other applications)
|
168
|
+
** New @--select N@ option will automatically select the @N@th entry (rather than asking the user to select an entry).
|
169
|
+
|
166
170
|
* *Release 0.3.0*
|
167
171
|
** internal refactoring: CLI parsing is now based on "Slop":https://github.com/leejarvis/slop. The documentation has been revised and should now be simpler to understand.
|
168
172
|
** added some controls to avoid overwriting existing files (in particular: init, encrypt, and decrypt). The command is now less Unix-like, but I hope you will appreciate a bit more safety.
|
data/bin/pwss
CHANGED
@@ -165,20 +165,26 @@ opts = Slop.parse :help => true do
|
|
165
165
|
banner "pwss get [options] string"
|
166
166
|
description "Get password for entry matching <string> in the title field"
|
167
167
|
|
168
|
-
on "-f", "--filename=", "Password file to use
|
169
|
-
on "-w", "--wait=", "Seconds password is available in the clipboard (0 = interactive)
|
168
|
+
on "-f", "--filename=", "Password file to use"
|
169
|
+
on "-w", "--wait=", "Seconds password is available in the clipboard (0 = interactive)", as: Integer
|
170
|
+
on "--stdout", "Output the password to standard output"
|
171
|
+
on "--select=", "Select the N-th matching entry", as: Integer
|
170
172
|
|
171
173
|
run do |opts, args|
|
172
174
|
filename = opts.to_hash[:filename] || DEFAULT_FILENAME
|
173
175
|
waiting = opts.to_hash[:wait] || DEFAULT_SECS
|
176
|
+
stdout_opt = opts.to_hash[:stdout]
|
177
|
+
entry_no = opts.to_hash[:select] || nil
|
174
178
|
|
175
179
|
string, _ = file2string filename
|
176
180
|
entries = YAML::load(string) || Array.new
|
177
181
|
|
178
|
-
password = Pwss::get args.join(" "), entries
|
179
|
-
|
180
|
-
|
182
|
+
password = Pwss::get args.join(" "), entries, entry_no
|
183
|
+
|
184
|
+
if password then
|
185
|
+
stdout_opt ? printf("%s", password) : Cipher.password_to_clipboard(password, waiting)
|
181
186
|
end
|
187
|
+
|
182
188
|
end
|
183
189
|
end
|
184
190
|
|
@@ -189,12 +195,12 @@ opts = Slop.parse :help => true do
|
|
189
195
|
description "Add an entry and copy its password in the clipboard"
|
190
196
|
|
191
197
|
on "-f", "--filename=", "Password file to use."
|
192
|
-
on "-w", "--wait=", "Seconds password is available in the clipboard (0 = interactive)
|
198
|
+
on "-w", "--wait=", "Seconds password is available in the clipboard (0 = interactive)", as: Integer
|
193
199
|
|
194
|
-
on "-e", "--entry=", "Create an entry of type TYPE (Entry, CreditCard, BankAccount, SoftwareLicense).\n Default to 'Entry', which is good enough for websites credentials
|
200
|
+
on "-e", "--entry=", "Create an entry of type TYPE (Entry, CreditCard, BankAccount, SoftwareLicense).\n Default to 'Entry', which is good enough for websites credentials"
|
195
201
|
|
196
202
|
on "-g", "--generate=", "Generate a random password of given length.", as: Integer
|
197
|
-
on "-a", "--alnum", "Use only alphanumeric chars for the randomly generated password
|
203
|
+
on "-a", "--alnum", "Use only alphanumeric chars for the randomly generated password"
|
198
204
|
|
199
205
|
run do |opts, args|
|
200
206
|
filename = opts.to_hash[:filename] || DEFAULT_FILENAME
|
data/lib/pwss.rb
CHANGED
@@ -7,8 +7,11 @@ require 'yaml'
|
|
7
7
|
|
8
8
|
module Pwss
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
# entry_no is the relative id of an entry, specified by the user from the command line
|
11
|
+
# (useful when the search criteria returns more than one match, in an order which is known
|
12
|
+
# to the user)
|
13
|
+
def self.get search_string, entries, entry_no = nil
|
14
|
+
id = choose_entry search_string, entries, false, entry_no
|
12
15
|
|
13
16
|
entries[id]["password"]
|
14
17
|
end
|
@@ -60,7 +63,7 @@ module Pwss
|
|
60
63
|
# Let the user select an entry from data
|
61
64
|
# (data is a YAML string with an array of entries)
|
62
65
|
#
|
63
|
-
def self.choose_entry search_string, entries, confirm_even_if_one = false
|
66
|
+
def self.choose_entry search_string, entries, confirm_even_if_one = false, entry_no = nil
|
64
67
|
# here we have a nuisance: we want the user to choose one entry
|
65
68
|
# by relative id (e.g. the third found), but we need to return
|
66
69
|
# the absolute id (to update the right entry in the safe)
|
@@ -68,14 +71,11 @@ module Pwss
|
|
68
71
|
# ... so we just keep track of the real ids with an array
|
69
72
|
# the relative id is the index in the array
|
70
73
|
|
71
|
-
index = 0
|
72
74
|
found = Array.new
|
73
|
-
entries.
|
75
|
+
entries.each_with_index do |entry, index|
|
74
76
|
if entry["title"].downcase.include?(search_string.downcase)
|
75
|
-
print_entry found.size, entry
|
76
77
|
found << index
|
77
78
|
end
|
78
|
-
index += 1
|
79
79
|
end
|
80
80
|
|
81
81
|
if found.size == 0 then
|
@@ -83,7 +83,15 @@ module Pwss
|
|
83
83
|
exit -1
|
84
84
|
end
|
85
85
|
|
86
|
-
if
|
86
|
+
if entry_no then
|
87
|
+
# accept entry_no even if there is one entry
|
88
|
+
id = entry_no
|
89
|
+
elsif found.size > 1 or confirm_even_if_one then
|
90
|
+
# print the entry or the entries found together with their relative ids
|
91
|
+
found.each_with_index do |absolute_index, relative_index|
|
92
|
+
print_entry relative_index, entries[absolute_index]
|
93
|
+
end
|
94
|
+
|
87
95
|
printf "\nVarious matches." if found.size > 1
|
88
96
|
printf "\nSelect entry by ID (0..#{found.size-1}); -1 or empty string to exit: "
|
89
97
|
|
@@ -98,6 +106,7 @@ module Pwss
|
|
98
106
|
end
|
99
107
|
else
|
100
108
|
id = 0
|
109
|
+
print_entry 0, entries[found[id]]
|
101
110
|
end
|
102
111
|
|
103
112
|
found[id]
|
data/lib/pwss/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adolfo Villafiorita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|