pwss 0.6.0 → 0.7.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/ChangeLog.md +138 -0
- data/README.md +7 -108
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/lib/pwss/cli/command_semantics.rb +23 -14
- data/lib/pwss/cli/command_syntax.rb +7 -7
- data/lib/pwss/generators/fields.rb +6 -5
- data/lib/pwss/password.rb +25 -11
- data/lib/pwss/safe.rb +0 -2
- data/lib/pwss/version.rb +1 -1
- data/pwss.gemspec +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ca47c01a0f75c8a829d71ebeb0e8013b5cd1751
|
4
|
+
data.tar.gz: 8f5adb90c33c21aee7c5abff0cb0d339fbb43367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66359f3eaf3ce918a74e96b75755150260da081f143e9c9786bcdff25e59f7a3133cdcb72f5e6f90592a8ae53513eb994e1e7487a3b65628a7b1067cb738b3a7
|
7
|
+
data.tar.gz: 44d4af096257c9733f2ab57246df181abb3f931fac7627de0e993be083bce942a2dac5715a917606128fe73ed62d0ffc89a25654318fcfcebabfa2f0f7de9a50
|
data/ChangeLog.md
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
- **Release 0.7.0** changes the default for sensitive
|
4
|
+
data, improves password generation, and adds the '--id' option for getting
|
5
|
+
an entry:
|
6
|
+
- Sensitive data is not shown by default. If you want to show sensitive
|
7
|
+
data, use the `--show` option. The `--hide` option (now obsolete) has
|
8
|
+
been removed
|
9
|
+
- When updating a field, the old value of the field is now printed to the
|
10
|
+
standard output. This simplifies updating passwords when the "old" password
|
11
|
+
has to be specified. Now you can start by updating the password field with pwss,
|
12
|
+
paste the new password using the clipboard, and then copy-and-paste the old
|
13
|
+
password which is shown in the standard output.
|
14
|
+
- A new password generation strategy "strong" generates a random password on a subset
|
15
|
+
of all printable characters, ensuring there are neither ambiguous
|
16
|
+
character (i.e., 0, O, l, I), nor symbols which might not be
|
17
|
+
accepted in passwords (e.g., \, ", [, ], <, >).
|
18
|
+
- The strong and random strategies ensure there is at least one
|
19
|
+
symbol and one digit in the password
|
20
|
+
- The '--id' option allows to get an entry by ID. It can be useful for automating
|
21
|
+
operations with pwss or to quickly get an entry, if you remember its ID.
|
22
|
+
Use `pwss get` to get the ID and title of all entries in your password store.
|
23
|
+
- The `--stdout` option has been implemented right. If you
|
24
|
+
specify `--stdout` only the looked-up field is printed to
|
25
|
+
stdout. In conjunction with the `--id` option, this allows to
|
26
|
+
use `pwss` in scripts and pipes. For instance:
|
27
|
+
|
28
|
+
DB_USER=adolfo
|
29
|
+
DB_PASSWORD=$(pwss get --id 123 --stdout)
|
30
|
+
rails s
|
31
|
+
|
32
|
+
- **Release 0.6.0** introduces some major changes to functions, command syntax,
|
33
|
+
and code structure.
|
34
|
+
More in details:
|
35
|
+
- `pwss` can now use **GPG** asymmetric encryption, if you wish so.
|
36
|
+
To enable `gpg` follow the instructions above. The advantage: no
|
37
|
+
need to enter a password for adding data.
|
38
|
+
- `pwss` will try different default files, before giving up (in order:
|
39
|
+
`~/.pwss.yaml.gpg`, `.pwss.yaml.enc`, `.pwss.yaml`). If
|
40
|
+
you are in doubt about which command `pwss` is operating on,
|
41
|
+
use the `pwss default` command.
|
42
|
+
- added a **console**, which allows to perform multiple operations on the
|
43
|
+
same file. When using symmetric encryption, one of the advantages is
|
44
|
+
that the password is entered only once. (Similarly for GPG, but in
|
45
|
+
this case GPG has password caching built-in.)
|
46
|
+
- added a `describe` command to list the entry types and their fields
|
47
|
+
- by default a random password is generated when adding
|
48
|
+
new entries. Use `--ask` to enter the password interactively
|
49
|
+
- added a new option `pwgen`, which uses the
|
50
|
+
`pwgen` command line utility for generating password
|
51
|
+
- `get` now accepts a specification of the field to copy to the
|
52
|
+
clipboard
|
53
|
+
- the `get` command now presents only basic fields of the matching
|
54
|
+
entries. This hides any sensitive field from view when searching for
|
55
|
+
entries. The full entry is shown when chosen, unless the `--hide` option
|
56
|
+
is used.
|
57
|
+
- a new `--hide` option of the `get` command allows to hide
|
58
|
+
sensitive data after a match. In this case you can still
|
59
|
+
copy a field using the `--field` option.
|
60
|
+
- the ids shown in the list generated by the get command are
|
61
|
+
absolute (i.e., the index of the entry in the file). This will
|
62
|
+
allow to add a command which gets an entry by ID.
|
63
|
+
- new type SIM for SIM cards (fields: title, pin, and puk)
|
64
|
+
- new type Code for a secret code (e.g., locker; fields: title and code)
|
65
|
+
- dropped support for `created_at` and `updated_at`. No problem if
|
66
|
+
an entry has them: `pwss` won't touch them. If you want to remove
|
67
|
+
these fields from your entries, use the `--clean-timestamp` option.
|
68
|
+
For instance: `pwss list --clean-timestamps > .new-pwss.yaml`
|
69
|
+
|
70
|
+
Bug fixes:
|
71
|
+
- the `list` command now shows the fields of all records always
|
72
|
+
in the same order. This fixes a readability problem with
|
73
|
+
manually entered fields ... and with the order in which recent
|
74
|
+
versions of `pwss` stored fields. If you want to clean your
|
75
|
+
password file, use `pwss list`.
|
76
|
+
- fixed a long-standing bug when updating the description field.
|
77
|
+
Now the field is correctly recognized as multiline and the
|
78
|
+
update function works as it should
|
79
|
+
- fixed a long-standing bug which stored the closing dot in
|
80
|
+
multiline fields
|
81
|
+
- fixed some typos in messages
|
82
|
+
|
83
|
+
- **Release 0.5.1** fixes a bug of the "add" command, which threw an
|
84
|
+
error if the title was not supplied on the command line. When adding
|
85
|
+
an entry, now it is possible to specify the title on the command
|
86
|
+
line or just wait for the title prompt
|
87
|
+
|
88
|
+
- **Release 0.5.0** This is a release mainly focused on
|
89
|
+
improving interaction. It includes small changes to the command
|
90
|
+
syntax and improved exit conditions. In details:
|
91
|
+
- **add** now accepts the title in the command line. For instance
|
92
|
+
`pwss add New Entry`
|
93
|
+
- **new** is now an alias for the **add** command
|
94
|
+
- **update** now requires to specify the field: use `-p`,
|
95
|
+
`--password`, or `--field password`, if you want to update the
|
96
|
+
password
|
97
|
+
- `pwss` now shows usage summary, if no arguments are given
|
98
|
+
- **C-c** is now trapped and properly managed (clearing
|
99
|
+
the clipboard)
|
100
|
+
- decryption errors are now properly managed
|
101
|
+
- the content of the clipboard is now restored after the waiting
|
102
|
+
period
|
103
|
+
|
104
|
+
- **Release 0.4.0**
|
105
|
+
- New `--stdout` option will output password to standard output
|
106
|
+
(useful for integration with other applications)
|
107
|
+
- New `--select N` option will automatically select the `N`th
|
108
|
+
entry (rather than asking the user to select an entry).
|
109
|
+
|
110
|
+
- **Release 0.3.0**
|
111
|
+
- internal refactoring: CLI parsing is now based on
|
112
|
+
[Slop](https://github.com/leejarvis/slop). The documentation has
|
113
|
+
been revised and should now be simpler to understand.
|
114
|
+
- added some controls to avoid overwriting existing files (in
|
115
|
+
particular: init, encrypt, and decrypt). The command is now less
|
116
|
+
Unix-like, but I hope you will appreciate a bit more safety.
|
117
|
+
|
118
|
+
- **Release 0.2.0** (never really made it to the public -- use
|
119
|
+
version 0.3.0)
|
120
|
+
- it is now possible to add entries of various types (= with
|
121
|
+
different fields). The supported types include: CreditCard,
|
122
|
+
BankAccount, SoftwareLicense. Use the -e (--entry) option to
|
123
|
+
specify the type of entry to add
|
124
|
+
- an empty string can now be used to exit (instead of -1) when
|
125
|
+
multiple matches are found
|
126
|
+
|
127
|
+
- **Release 0.1.0**
|
128
|
+
- the update command now allows one to update the password or any
|
129
|
+
other field of existing entries
|
130
|
+
- a simple password generator allows pwss to generate a random
|
131
|
+
password
|
132
|
+
- most commands make the password of the selected entry available
|
133
|
+
in the clipboard (useful, for instance, if you automatically
|
134
|
+
generate a password)
|
135
|
+
- a destroy command allows one to delete an entry from a password
|
136
|
+
file. Similar to get, all entries matching a query are shown. The user
|
137
|
+
is then asked to select which entry has to be deleted or stop.
|
138
|
+
User confirmation is required even in case of a single match.
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
Pwss
|
2
2
|
====
|
3
3
|
|
4
|
-
A password manager in the spirit of
|
4
|
+
A multi-platform password manager in the spirit of
|
5
|
+
[pws](https://github.com/janlelis/pws) and
|
5
6
|
[pass](https://www.passwordstore.org/).
|
6
7
|
|
7
8
|
Different from pws and pass, PWSS manages password **files**. Each file can
|
@@ -24,6 +25,10 @@ so.
|
|
24
25
|
Password files can be encrypted and commands allow to operate directly on
|
25
26
|
them.
|
26
27
|
|
28
|
+
`pwss` has been reported to work on OSX and Linux; it should also work
|
29
|
+
on Windows. **If you are working on Linux, you need to install `xclip`,
|
30
|
+
to be able to use the clipboard.**
|
31
|
+
|
27
32
|
|
28
33
|
Installation
|
29
34
|
------------
|
@@ -331,113 +336,7 @@ will show the man page.
|
|
331
336
|
Changelog
|
332
337
|
---------
|
333
338
|
|
334
|
-
|
335
|
-
and code structure.
|
336
|
-
More in details:
|
337
|
-
- `pwss` can now use **GPG** asymmetric encryption, if you wish so.
|
338
|
-
To enable `gpg` follow the instructions above. The advantage: no
|
339
|
-
need to enter a password for adding data.
|
340
|
-
- `pwss` will try different default files, before giving up (in order:
|
341
|
-
`~/.pwss.yaml.gpg`, `.pwss.yaml.enc`, `.pwss.yaml`). If
|
342
|
-
you are in doubt about which command `pwss` is operating on,
|
343
|
-
use the `pwss default` command.
|
344
|
-
- added a **console**, which allows to perform multiple operations on the
|
345
|
-
same file. When using symmetric encryption, one of the advantages is
|
346
|
-
that the password is entered only once. (Similarly for GPG, but in
|
347
|
-
this case GPG has password caching built-in.)
|
348
|
-
- added a `describe` command to list the entry types and their fields
|
349
|
-
- by default a random password is generated when adding
|
350
|
-
new entries. Use `--ask` to enter the password interactively
|
351
|
-
- added a new option `pwgen`, which uses the
|
352
|
-
`pwgen` command line utility for generating password
|
353
|
-
- `get` now accepts a specification of the field to copy to the
|
354
|
-
clipboard
|
355
|
-
- the `get` command now presents only basic fields of the matching
|
356
|
-
entries. This hides any sensitive field from view when searching for
|
357
|
-
entries. The full entry is shown when chosen, unless the `--hide` option
|
358
|
-
is used.
|
359
|
-
- a new `--hide` option of the `get` command allows to hide
|
360
|
-
sensitive data after a match. In this case you can still
|
361
|
-
copy a field using the `--field` option.
|
362
|
-
- the ids shown in the list generated by the get command are
|
363
|
-
absolute (i.e., the index of the entry in the file). This will
|
364
|
-
allow to add a command which gets an entry by ID.
|
365
|
-
- new type SIM for SIM cards (fields: title, pin, and puk)
|
366
|
-
- new type Code for a secret code (e.g., locker; fields: title and code)
|
367
|
-
- dropped support for `created_at` and `updated_at`. No problem if
|
368
|
-
an entry has them: `pwss` won't touch them. If you want to remove
|
369
|
-
these fields from your entries, use the `--clean-timestamp` option.
|
370
|
-
For instance: `pwss list --clean-timestamps > .new-pwss.yaml`
|
371
|
-
|
372
|
-
Bug fixes:
|
373
|
-
- the `list` command now shows the fields of all records always
|
374
|
-
in the same order. This fixes a readability problem with
|
375
|
-
manually entered fields ... and with the order in which recent
|
376
|
-
versions of `pwss` stored fields. If you want to clean your
|
377
|
-
password file, use `pwss list`.
|
378
|
-
- fixed a long-standing bug when updating the description field.
|
379
|
-
Now the field is correctly recognized as multiline and the
|
380
|
-
update function works as it should
|
381
|
-
- fixed a long-standing bug which stored the closing dot in
|
382
|
-
multiline fields
|
383
|
-
- fixed some typos in messages
|
384
|
-
|
385
|
-
- **Release 0.5.1** fixes a bug of the "add" command, which threw an
|
386
|
-
error if the title was not supplied on the command line. When adding
|
387
|
-
an entry, now it is possible to specify the title on the command
|
388
|
-
line or just wait for the title prompt
|
389
|
-
|
390
|
-
- **Release 0.5.0** This is a release mainly focused on
|
391
|
-
improving interaction. It includes small changes to the command
|
392
|
-
syntax and improved exit conditions. In details:
|
393
|
-
- **add** now accepts the title in the command line. For instance
|
394
|
-
`pwss add New Entry`
|
395
|
-
- **new** is now an alias for the **add** command
|
396
|
-
- **update** now requires to specify the field: use `-p`,
|
397
|
-
`--password`, or `--field password`, if you want to update the
|
398
|
-
password
|
399
|
-
- `pwss` now shows usage summary, if no arguments are given
|
400
|
-
- **C-c** is now trapped and properly managed (clearing
|
401
|
-
the clipboard)
|
402
|
-
- decryption errors are now properly managed
|
403
|
-
- the content of the clipboard is now restored after the waiting
|
404
|
-
period
|
405
|
-
|
406
|
-
- **Release 0.4.0**
|
407
|
-
- New `--stdout` option will output password to standard output
|
408
|
-
(useful for integration with other applications)
|
409
|
-
- New `--select N` option will automatically select the `N`th
|
410
|
-
entry (rather than asking the user to select an entry).
|
411
|
-
|
412
|
-
- **Release 0.3.0**
|
413
|
-
- internal refactoring: CLI parsing is now based on
|
414
|
-
[Slop](https://github.com/leejarvis/slop). The documentation has
|
415
|
-
been revised and should now be simpler to understand.
|
416
|
-
- added some controls to avoid overwriting existing files (in
|
417
|
-
particular: init, encrypt, and decrypt). The command is now less
|
418
|
-
Unix-like, but I hope you will appreciate a bit more safety.
|
419
|
-
|
420
|
-
- **Release 0.2.0** (never really made it to the public -- use
|
421
|
-
version 0.3.0)
|
422
|
-
- it is now possible to add entries of various types (= with
|
423
|
-
different fields). The supported types include: CreditCard,
|
424
|
-
BankAccount, SoftwareLicense. Use the -e (--entry) option to
|
425
|
-
specify the type of entry to add
|
426
|
-
- an empty string can now be used to exit (instead of -1) when
|
427
|
-
multiple matches are found
|
428
|
-
|
429
|
-
- **Release 0.1.0**
|
430
|
-
- the update command now allows one to update the password or any
|
431
|
-
other field of existing entries
|
432
|
-
- a simple password generator allows pwss to generate a random
|
433
|
-
password
|
434
|
-
- most commands make the password of the selected entry available
|
435
|
-
in the clipboard (useful, for instance, if you automatically
|
436
|
-
generate a password)
|
437
|
-
- a destroy command allows one to delete an entry from a password
|
438
|
-
file. Similar to get, all entries matching a query are shown. The user
|
439
|
-
is then asked to select which entry has to be deleted or stop.
|
440
|
-
User confirmation is required even in case of a single match.
|
339
|
+
See [Change Log](ChangeLog)
|
441
340
|
|
442
341
|
License
|
443
342
|
-------
|
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
@@ -171,17 +171,24 @@ EOS
|
|
171
171
|
waiting = opts[:wait]
|
172
172
|
stdout_opt = opts[:stdout]
|
173
173
|
field_name = opts[:field] || "password"
|
174
|
-
|
175
|
-
|
176
|
-
|
174
|
+
id = opts[:id]
|
175
|
+
|
177
176
|
safe = use_safe opts[:filename]
|
178
|
-
|
179
|
-
|
180
|
-
if id
|
181
|
-
|
177
|
+
show = opts[:show]
|
178
|
+
|
179
|
+
if not id
|
180
|
+
string = argv.join(" ")
|
181
|
+
entries_with_idx = safe.match string
|
182
|
+
id = Pwss::Safe.choose_entry entries_with_idx
|
183
|
+
end
|
184
|
+
|
185
|
+
if id != -1 and safe.get(id) then
|
182
186
|
field_value = safe.get_field id, field_name
|
183
|
-
if
|
184
|
-
|
187
|
+
if stdout_opt then
|
188
|
+
printf("%s", field_value)
|
189
|
+
else
|
190
|
+
puts (show ? safe.get(id).to_yaml : safe.get_pruned(id).to_yaml )
|
191
|
+
Pwss::Password.to_clipboard(field_name, field_value, waiting)
|
185
192
|
end
|
186
193
|
end
|
187
194
|
end
|
@@ -230,15 +237,17 @@ EOS
|
|
230
237
|
entries_with_idx = safe.match string
|
231
238
|
id = Pwss::Safe.choose_entry entries_with_idx, true
|
232
239
|
if id != -1 then
|
233
|
-
|
234
|
-
|
235
|
-
safe.
|
240
|
+
old_value = safe.get_field id, field
|
241
|
+
new_value = Pwss::Fields.ask field, { strategy: strategy, length: length }
|
242
|
+
printf "Updating #{field} field of '#{safe.entries[id]["title"]}' in #{safe.filename} ..."
|
243
|
+
safe.update id, field, new_value
|
236
244
|
safe.save
|
237
|
-
puts "
|
245
|
+
puts "... done"
|
246
|
+
puts "The old value of #{field} is: #{old_value}"
|
238
247
|
|
239
248
|
# make the field available in the clipboard, just in case it is needed
|
240
249
|
if field == "password"
|
241
|
-
Pwss::Password.to_clipboard "password",
|
250
|
+
Pwss::Password.to_clipboard "password", new_value, waiting
|
242
251
|
end
|
243
252
|
end
|
244
253
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'slop'
|
2
|
-
require 'pwss/password'
|
3
2
|
|
4
3
|
module Pwss
|
5
4
|
module CommandSyntax
|
@@ -44,13 +43,14 @@ module Pwss
|
|
44
43
|
|
45
44
|
def self.get_opts
|
46
45
|
opts = Slop::Options.new
|
47
|
-
opts.banner = "get [options] -- get a
|
46
|
+
opts.banner = "get [options] arg -- get a field of a record matching arg"
|
48
47
|
|
49
48
|
opts.string "-f", "--filename", "Password file to use"
|
50
49
|
opts.bool "--stdout", "Output the password to standard output"
|
51
|
-
opts.bool "-
|
50
|
+
opts.bool "-s", "--show", "Show sensitive fields"
|
52
51
|
opts.integer "-w", "--wait", "Number of seconds the field is available in the clipboard (0 = wait for user input)", default: DEFAULT_WAIT
|
53
|
-
opts.string "--field", "Field to make available on stdout or clipboard (
|
52
|
+
opts.string "--field", "Field to make available on stdout or clipboard (default to password)"
|
53
|
+
opts.integer "--id", "Get an entry directly by id and ignore any arg"
|
54
54
|
return { :get => [opts, :get] }
|
55
55
|
end
|
56
56
|
|
@@ -58,11 +58,11 @@ module Pwss
|
|
58
58
|
opts = Slop::Options.new
|
59
59
|
opts.banner = "add|new [options] [entry title] -- add an entry and copy its password in the clipboard"
|
60
60
|
opts.string "-f", "--filename", "Password file to use"
|
61
|
-
opts.integer "-w", "--wait", "
|
61
|
+
opts.integer "-w", "--wait", "Time (in seconds) password is available in the clipboard (0 = interactive)", default: DEFAULT_WAIT
|
62
62
|
opts.string "-t", "--type", "Create an entry of type TYPE (Entry, CreditCard, BankAccount, SoftwareLicense, Sim).\n Default to 'Entry', which is good enough for websites credentials"
|
63
|
-
opts.string "-m", "--method", "Method to generate the password
|
63
|
+
opts.string "-m", "--method", "Method to generate the password. One of: random (default), strong, alpha, ask"
|
64
64
|
opts.bool "--ask", "A shortcut for --method ask"
|
65
|
-
opts.integer "-l", "--length", "Password length
|
65
|
+
opts.integer "-l", "--length", "Password length. Used if the method is not 'ask'; default to #{DEFAULT_LENGTH})", default: DEFAULT_LENGTH
|
66
66
|
return { :add => [opts, :add_entry],
|
67
67
|
:new => [opts, :add_entry] }
|
68
68
|
end
|
@@ -10,14 +10,15 @@ module Pwss
|
|
10
10
|
HIDDEN = 2
|
11
11
|
|
12
12
|
# this is a set of fields useful for different types of entries
|
13
|
-
#
|
13
|
+
# see the constants above to make sense of the fields for each entry
|
14
|
+
# different types of entries will use the appropriate set of fields
|
14
15
|
FIELDS = {
|
15
16
|
# everyone has...
|
16
17
|
"title" => ["Readline.readline('title: ')", "''", false],
|
17
18
|
"url" => ["Readline.readline('url: ')", "''", false],
|
18
19
|
"username" => ["Readline.readline('username: ')", "''", false],
|
19
20
|
"recovery_email" => ["Readline.readline('email: ')", "''", false],
|
20
|
-
"password" => ["Pwss::Password.password(arguments)", "Pwss::Password.password", true],
|
21
|
+
"password" => ["Pwss::Password.password(arguments)", "Pwss::Password.ask_password_twice('password')", true],
|
21
22
|
"description" => ["get_lines", "''", false],
|
22
23
|
|
23
24
|
# banks also have ...
|
@@ -70,12 +71,11 @@ module Pwss
|
|
70
71
|
|
71
72
|
# ... otherwise, do some work and ask for the value!
|
72
73
|
input_f = FIELDS[key] ? FIELDS[key][INPUT_F] : "Readline.readline('#{key}: ')"
|
73
|
-
default = FIELDS[key] ? FIELDS[key][DEFAULT] : nil
|
74
74
|
value = eval input_f
|
75
75
|
if value != nil and value != "" then
|
76
76
|
value
|
77
77
|
else
|
78
|
-
|
78
|
+
FIELDS[key] ? eval(FIELDS[key][DEFAULT]) : nil
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -108,8 +108,9 @@ module Pwss
|
|
108
108
|
output
|
109
109
|
end
|
110
110
|
|
111
|
+
# custom keys are always considered to be sensitive
|
111
112
|
def self.sensitive? field
|
112
|
-
FIELDS[field][HIDDEN]
|
113
|
+
FIELDS[field] ? FIELDS[field][HIDDEN] : true
|
113
114
|
end
|
114
115
|
|
115
116
|
def self.sensitive
|
data/lib/pwss/password.rb
CHANGED
@@ -13,14 +13,12 @@ module Pwss
|
|
13
13
|
#
|
14
14
|
#
|
15
15
|
def self.password arguments = {}
|
16
|
-
strategy = arguments[:strategy] || 'random'
|
17
16
|
length = arguments[:length] || DEFAULT_PASSWORD_LENGTH
|
17
|
+
strategy = arguments[:strategy] || 'random'
|
18
18
|
|
19
19
|
case strategy
|
20
|
-
when 'random'
|
21
|
-
return Pwss::Password.random_password(length,
|
22
|
-
when 'alpha'
|
23
|
-
return Pwss::Password.random_password(length, true)
|
20
|
+
when 'random', 'strong', 'alpha'
|
21
|
+
return Pwss::Password.random_password(length, strategy)
|
24
22
|
when 'ask'
|
25
23
|
return Pwss::Password.ask_password_twice "new password for entry"
|
26
24
|
when 'pwgen'
|
@@ -28,10 +26,10 @@ module Pwss
|
|
28
26
|
password = %x(pwgen -N1 #{length}).chomp
|
29
27
|
return password
|
30
28
|
rescue
|
31
|
-
raise "Error: pwgen not found. Use one of random, alpha, or ask."
|
29
|
+
raise "Error: pwgen not found. Use one of random, strong, alpha, or ask."
|
32
30
|
end
|
33
31
|
else
|
34
|
-
raise "Error: strategy not understood.
|
32
|
+
raise "Error: password generation strategy #{strategy} not understood."
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
@@ -62,10 +60,26 @@ module Pwss
|
|
62
60
|
|
63
61
|
# Generate a random password
|
64
62
|
# (Adapted from: http://randompasswordsgenerator.net/tutorials/ruby-random-password-generator.html)
|
65
|
-
def self.random_password length=DEFAULT_PASSWORD_LENGTH,
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
def self.random_password length=DEFAULT_PASSWORD_LENGTH, strategy="random"
|
64
|
+
lower = 'abcdefghijkmnpqrstuvwxyz'
|
65
|
+
upper = 'ABCDEFGHJKLMNPQRSTUVWXYZ'
|
66
|
+
digits = '123456789'
|
67
|
+
ambiguous = '0oOlI'
|
68
|
+
safe_symbols = '~!@#$%^-+_.,;:'
|
69
|
+
difficult_symbols = '&*()={}[]|\\\"\'`<>?/'
|
70
|
+
|
71
|
+
case strategy
|
72
|
+
when 'random'
|
73
|
+
chars = lower + upper + digits + safe_symbols + difficult_symbols + ambiguous
|
74
|
+
when 'strong'
|
75
|
+
chars = lower + upper + digits + safe_symbols
|
76
|
+
when 'alpha'
|
77
|
+
chars = lower + upper + digits
|
78
|
+
else
|
79
|
+
raise "Error: password generation strategy #{strategy} is not understood."
|
80
|
+
end
|
81
|
+
|
82
|
+
Array.new(length) { chars[rand(chars.length)].chr }.join
|
69
83
|
end
|
70
84
|
|
71
85
|
#
|
data/lib/pwss/safe.rb
CHANGED
@@ -154,7 +154,6 @@ module Pwss
|
|
154
154
|
|
155
155
|
if even_if_one or entries.size > 1
|
156
156
|
entries.size > 1 ? puts("pwss matches:") : puts("pwss match:")
|
157
|
-
# pruned = entries.map { |x| Pwss::Safe.prune_entry x, ["password", "pin", "verification_number"] }
|
158
157
|
entries.each_with_index do |e, i|
|
159
158
|
puts Pwss::Safe.entry_to_s ids[i], e
|
160
159
|
end
|
@@ -166,7 +165,6 @@ module Pwss
|
|
166
165
|
end
|
167
166
|
else
|
168
167
|
puts "pwss has one match:"
|
169
|
-
# pruned = Pwss::Safe.prune_entry entries[0], ["password", "pin", "verification_number"]
|
170
168
|
puts Pwss::Safe.entry_to_s ids[0], entries[0]
|
171
169
|
id = ids[0]
|
172
170
|
end
|
data/lib/pwss/version.rb
CHANGED
data/pwss.gemspec
CHANGED
@@ -35,6 +35,6 @@ Distinguishing features:
|
|
35
35
|
|
36
36
|
spec.add_runtime_dependency 'slop', '~> 4.3.0', '>= 4.3.0'
|
37
37
|
spec.add_runtime_dependency 'encryptor', '~> 1.3.0', '~> 1.3.0'
|
38
|
-
spec.add_runtime_dependency 'clipboard', '~> 1.
|
38
|
+
spec.add_runtime_dependency 'clipboard', '~> 1.1.1', '>= 1.1.1'
|
39
39
|
spec.add_runtime_dependency 'gpgme', '~> 2.0.12', '>= 2.0.12'
|
40
40
|
end
|
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.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adolfo Villafiorita
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,20 +92,20 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 1.
|
95
|
+
version: 1.1.1
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 1.
|
98
|
+
version: 1.1.1
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
101
|
version_requirements: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
103
|
- - "~>"
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: 1.
|
105
|
+
version: 1.1.1
|
106
106
|
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: 1.
|
108
|
+
version: 1.1.1
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: gpgme
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,6 +146,7 @@ extra_rdoc_files: []
|
|
146
146
|
files:
|
147
147
|
- ".gitignore"
|
148
148
|
- ".travis.yml"
|
149
|
+
- ChangeLog.md
|
149
150
|
- Gemfile
|
150
151
|
- LICENSE.txt
|
151
152
|
- README.md
|
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
190
|
version: '0'
|
190
191
|
requirements: []
|
191
192
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
193
|
+
rubygems_version: 2.6.11
|
193
194
|
signing_key:
|
194
195
|
specification_version: 4
|
195
196
|
summary: A password manager in the spirit of pass and pws
|