pws 1.0.7 → 1.0.8
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 +5 -0
- data/MIT-LICENSE.txt +1 -1
- data/README.md +16 -3
- data/features/add.feature +3 -3
- data/features/create.feature +1 -1
- data/features/generate.feature +18 -11
- data/features/get.feature +2 -2
- data/features/in-out.feature +1 -1
- data/features/master.feature +2 -2
- data/features/namespaces.feature +1 -1
- data/features/print-screen.feature +62 -0
- data/features/remove.feature +1 -1
- data/features/rename.feature +1 -1
- data/features/resave.feature +2 -2
- data/features/support/env.rb +0 -14
- data/features/update-generate.feature +21 -12
- data/features/update.feature +3 -3
- data/lib/pws.rb +34 -5
- data/lib/pws/runner.rb +9 -1
- data/lib/pws/version.rb +3 -1
- data/pws.gemspec +4 -4
- metadata +33 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be1a0e41b9218f6e0ef2f3570e945bf7b08a52a
|
4
|
+
data.tar.gz: 22a90601c2ecb6d7e0e3cccd6e5481db781384c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e5f4179c8dc2cf2e7be483d42dd442279e9c61857288595a0c1c575fcad5a6f73b79eb283c34f5a249b227d6e2ee5403a245207025af2c930ffbd1551eef1b0
|
7
|
+
data.tar.gz: feeb683b32b10c345e10e5a94a18f573cf0a01c5bbb1609537b2881e6a1b997fce1d92f6a5e6277b4019891db5e9f835e7c6478626086f00281d77236e140593
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 1.0.8
|
2
|
+
* New command to print password to screen, patch by @terabyte
|
3
|
+
* New option to exclude specific characters when generating new passwords, patch by @alex0112
|
4
|
+
* Update (and loosen up) clipboard dependency
|
5
|
+
|
1
6
|
== 1.0.7
|
2
7
|
* Ruby 2.4 compat (explicitely only pass 32 bytes of the encryption key)
|
3
8
|
* Update clipboard dependency to 1.1.1
|
data/MIT-LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@ pws is a command-line password safe/manager written in Ruby using [aes-256-cbc](
|
|
5
5
|
|
6
6
|
Usage
|
7
7
|
---
|
8
|
-
[](https://ruby.janlelis.de/60-pws-the-ruby-powered-command-line-password-manager)
|
9
9
|
|
10
10
|
|
11
11
|
Setup
|
@@ -33,7 +33,20 @@ Besides using the `--filename path/to/safe` option, you can shortly call `pws --
|
|
33
33
|
|
34
34
|
|
35
35
|
### Reading the source
|
36
|
-
Trust the code by reading the source! It's originally based on [this tutorial](
|
36
|
+
Trust the code by reading the source! It's originally based on [this tutorial](https://ruby.janlelis.de/41-tutorial-build-your-own-password-safe-with-ruby). You might want to start reading in the [0.9.2 tag](https://github.com/janlelis/pws/tree/0.9.2), because it's got less features and therefore is less code.
|
37
|
+
|
38
|
+
|
39
|
+
Projects built on top of PWS
|
40
|
+
---
|
41
|
+
* [pws-otp](https://github.com/janlelis/pws-otp) Experimental OTP support for 2FA
|
42
|
+
* [pwsqr](https://github.com/smileart/pwsqr) Simple QR interface to pws gem. Helps to use your passwords on a smartphone.
|
43
|
+
* [aws-pws](https://github.com/fancyremarker/aws-pws) A password-protected CredentialProvider for AWS
|
44
|
+
* [omnivault](https://github.com/aptible/omnivault) Multi-platform keychain functionality
|
45
|
+
|
46
|
+
|
47
|
+
Blog articles
|
48
|
+
---
|
49
|
+
* [Packaging ruby programs in NixOS](http://blog.arkency.com/2016/04/packaging-ruby-programs-in-nixos/) using PWS as example
|
37
50
|
|
38
51
|
|
39
52
|
Contributors
|
@@ -47,4 +60,4 @@ Contributors
|
|
47
60
|
|
48
61
|
J-\_-L
|
49
62
|
---
|
50
|
-
© 2010-
|
63
|
+
© 2010-2019 Jan Lelis, MIT license
|
data/features/add.feature
CHANGED
@@ -3,7 +3,7 @@ Feature: Add
|
|
3
3
|
As a user
|
4
4
|
I want to add new passwords to my password safe
|
5
5
|
|
6
|
-
|
6
|
+
|
7
7
|
Scenario: Add a new password for "github"
|
8
8
|
Given A safe exists with master password "my_master_password"
|
9
9
|
When I run `pws add github` interactively
|
@@ -13,7 +13,7 @@ Feature: Add
|
|
13
13
|
And the output should contain "Please enter a password for github:"
|
14
14
|
And the output should contain "The password for github has been added"
|
15
15
|
|
16
|
-
|
16
|
+
|
17
17
|
Scenario: Add a new password for "github", already passing it as command line paramenter (not recommended)
|
18
18
|
Given A safe exists with master password "my_master_password"
|
19
19
|
When I run `pws add github github_password` interactively
|
@@ -44,7 +44,7 @@ Feature: Add
|
|
44
44
|
Then the output should contain "Master password:"
|
45
45
|
And the output should contain "NO ACCESS"
|
46
46
|
|
47
|
-
|
47
|
+
|
48
48
|
Scenario: Set a new password for "github", this also sets the timestamp
|
49
49
|
Given A safe exists with master password "my_master_password" and a key "some" with password "entry"
|
50
50
|
When I run `pws add github github_password` interactively
|
data/features/create.feature
CHANGED
data/features/generate.feature
CHANGED
@@ -3,8 +3,8 @@ Feature: Generate
|
|
3
3
|
As a user
|
4
4
|
I want to generate passwords and add them to my password safe
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
|
8
8
|
Scenario: Generate a new password for "github" and gets it
|
9
9
|
Given A safe exists with master password "my_master_password"
|
10
10
|
When I run `pws generate github` interactively
|
@@ -13,7 +13,7 @@ Feature: Generate
|
|
13
13
|
And the output should contain "The password for github has been added"
|
14
14
|
And the output should contain "The password for github is now available in your clipboard for 10 seconds"
|
15
15
|
|
16
|
-
|
16
|
+
|
17
17
|
Scenario: Generate a new password for "github", second parameter gets passed to the get as keep-in-clipboard time
|
18
18
|
Given A safe exists with master password "my_master_password"
|
19
19
|
When I run `pws generate github 1` interactively
|
@@ -22,7 +22,7 @@ Feature: Generate
|
|
22
22
|
And the output should contain "The password for github has been added"
|
23
23
|
And the output should contain "The password for github is now available in your clipboard for 1 second"
|
24
24
|
|
25
|
-
|
25
|
+
|
26
26
|
Scenario: Generate a new password for "github", PWS_SECONDS set to 5, gets passed to the get as keep-in-clipboard time
|
27
27
|
Given A safe exists with master password "my_master_password"
|
28
28
|
When I set env variable "PWS_SECONDS" to "5"
|
@@ -32,7 +32,7 @@ Feature: Generate
|
|
32
32
|
And the output should contain "The password for github has been added"
|
33
33
|
And the output should contain "The password for github is now available in your clipboard for 5 seconds"
|
34
34
|
|
35
|
-
|
35
|
+
|
36
36
|
Scenario: Generate a new password for "github", third parameter defines password length
|
37
37
|
Given A safe exists with master password "my_master_password"
|
38
38
|
When I run `pws generate github 0 10` interactively
|
@@ -42,7 +42,7 @@ Feature: Generate
|
|
42
42
|
And the output should contain "The password for github has been copied to your clipboard"
|
43
43
|
And the clipboard should match /^.{10}$/
|
44
44
|
|
45
|
-
|
45
|
+
|
46
46
|
Scenario: Generate a new password for "github", default length is 64
|
47
47
|
Given A safe exists with master password "my_master_password"
|
48
48
|
When I run `pws generate github 0` interactively
|
@@ -52,7 +52,7 @@ Feature: Generate
|
|
52
52
|
And the output should contain "The password for github has been copied to your clipboard"
|
53
53
|
And the clipboard should match /^.{64}$/
|
54
54
|
|
55
|
-
|
55
|
+
|
56
56
|
Scenario: Generate a new password for "github", default length of PWS_LENGTH
|
57
57
|
Given A safe exists with master password "my_master_password"
|
58
58
|
When I set env variable "PWS_LENGTH" to "15"
|
@@ -63,7 +63,7 @@ Feature: Generate
|
|
63
63
|
And the output should contain "The password for github has been copied to your clipboard"
|
64
64
|
And the clipboard should match /^.{15}$/
|
65
65
|
|
66
|
-
|
66
|
+
|
67
67
|
Scenario: Generate a new password for "github", fourth parameter defines a char pool used for generation
|
68
68
|
Given A safe exists with master password "my_master_password"
|
69
69
|
When I run `pws generate github 0 10 a` interactively
|
@@ -73,7 +73,7 @@ Feature: Generate
|
|
73
73
|
And the output should contain "The password for github has been copied to your clipboard"
|
74
74
|
And the clipboard should match /^a{10}$/
|
75
75
|
|
76
|
-
|
76
|
+
|
77
77
|
Scenario: Generate a new password for "github", the default char pool is !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
|
78
78
|
Given A safe exists with master password "my_master_password"
|
79
79
|
When I run `pws generate github 0` interactively
|
@@ -83,7 +83,7 @@ Feature: Generate
|
|
83
83
|
And the output should contain "The password for github has been copied to your clipboard"
|
84
84
|
And the clipboard should match ^[!\"\#$%&'()*+,\-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~]+$
|
85
85
|
|
86
|
-
|
86
|
+
|
87
87
|
Scenario: Generate a new password for "github", the default char pool PWS_CHARPOOL
|
88
88
|
Given A safe exists with master password "my_master_password"
|
89
89
|
When I set env variable "PWS_CHARPOOL" to "a"
|
@@ -94,4 +94,11 @@ Feature: Generate
|
|
94
94
|
And the output should contain "The password for github has been copied to your clipboard"
|
95
95
|
And the clipboard should match ^a{64}$
|
96
96
|
|
97
|
-
|
97
|
+
Scenario: Generate a new password for "github", exclude the characters "ABC123" from the charpool
|
98
|
+
Given A safe exists with master password "my_master_password"
|
99
|
+
When I run `pws generate github 0 --exclude ABC123` interactively
|
100
|
+
And I type "my_master_password"
|
101
|
+
Then the output should contain "Master password:"
|
102
|
+
And the output should contain "The password for github has been added"
|
103
|
+
And the output should contain "The password for github has been copied to your clipboard"
|
104
|
+
And the clipboard should match [^ABC123]{64}
|
data/features/get.feature
CHANGED
@@ -11,7 +11,7 @@ Feature: Get
|
|
11
11
|
And the output should contain "The password for github has been copied to your clipboard"
|
12
12
|
And the clipboard should contain "github_password"
|
13
13
|
|
14
|
-
|
14
|
+
|
15
15
|
Scenario: Get the password for "github" (which exists) and keep it in the clipboard for 10 seconds
|
16
16
|
Given A safe exists with master password "my_master_password" and a key "github" with password "github_password"
|
17
17
|
When I run `pws get github` interactively
|
@@ -26,7 +26,7 @@ Feature: Get
|
|
26
26
|
Then the output should contain "Master password:"
|
27
27
|
And the output should contain "The password for github is now available in your clipboard for 1 second"
|
28
28
|
|
29
|
-
|
29
|
+
|
30
30
|
Scenario: Get the password for "github" (which exists) and keep it in the clipboard for 5 seconds when PWS_SECONDS is set to 5
|
31
31
|
Given A safe exists with master password "my_master_password" and a key "github" with password "github_password"
|
32
32
|
When I set env variable "PWS_SECONDS" to "5"
|
data/features/in-out.feature
CHANGED
@@ -32,7 +32,7 @@ Feature: --in and --out options
|
|
32
32
|
Then the output should contain "Master password:"
|
33
33
|
Then the output should contain "NO ACCESS"
|
34
34
|
|
35
|
-
|
35
|
+
|
36
36
|
Scenario: Succesfully converts from 0.9 to 1.0 with --in 0.9 and out --1.0 options
|
37
37
|
Given A "0.9" safe exists with master password "password" and a key "github" with password "123456"
|
38
38
|
When I run `pws resave --in 0.9 --out 1.0` interactively
|
data/features/master.feature
CHANGED
@@ -3,7 +3,7 @@ Feature: Master
|
|
3
3
|
As a user
|
4
4
|
I want to change the master password
|
5
5
|
|
6
|
-
|
6
|
+
|
7
7
|
Scenario: Change the master password and check that it has changed
|
8
8
|
Given A safe exists with master password "my_master_password"
|
9
9
|
When I run `pws master` interactively
|
@@ -37,7 +37,7 @@ Feature: Master
|
|
37
37
|
Then the output should contain "Master password:"
|
38
38
|
And the output should contain "The master password has been changed"
|
39
39
|
|
40
|
-
|
40
|
+
|
41
41
|
Scenario: I can have an empty master password (not recommended)
|
42
42
|
Given A safe exists with master password "my_master_password"
|
43
43
|
When I run `pws master` interactively
|
data/features/namespaces.feature
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
Feature: PrintScreen
|
2
|
+
In order to have a helpful password safe when I have no clipboard
|
3
|
+
As a user
|
4
|
+
I want to disply passwords from my password safe
|
5
|
+
|
6
|
+
Scenario: Get the password for "github" (which exists) and print it to the screen
|
7
|
+
Given A safe exists with master password "my_master_password" and a key "github" with password "github_password"
|
8
|
+
When I run `pws ps github 0` interactively
|
9
|
+
And I type "my_master_password"
|
10
|
+
Then the output should contain "Master password:"
|
11
|
+
And the output should contain "The password for github is:\ngithub_password"
|
12
|
+
|
13
|
+
|
14
|
+
Scenario: Get the password for "github" (which exists) and print it to the screen for 10 seconds
|
15
|
+
Given A safe exists with master password "my_master_password" and a key "github" with password "github_password"
|
16
|
+
When I run `pws ps github` interactively
|
17
|
+
And I type "my_master_password"
|
18
|
+
Then the output should contain "Master password:"
|
19
|
+
And the output should contain "The password for github will be displayed for 10 seconds:\ngithub"
|
20
|
+
|
21
|
+
Scenario: Get the password for "github" (which exists) and print it to the screen for 1 second
|
22
|
+
Given A safe exists with master password "my_master_password" and a key "github" with password "github_password"
|
23
|
+
When I run `pws ps github 1` interactively
|
24
|
+
And I type "my_master_password"
|
25
|
+
Then the output should contain "Master password:"
|
26
|
+
And the output should contain "The password for github will be displayed for 1 second:\ngithub"
|
27
|
+
|
28
|
+
|
29
|
+
Scenario: Get the password for "github" (which exists) and print it to the screen for 5 seconds when PWS_SECONDS is set to 5
|
30
|
+
Given A safe exists with master password "my_master_password" and a key "github" with password "github_password"
|
31
|
+
When I set env variable "PWS_SECONDS" to "5"
|
32
|
+
And I run `pws ps github` interactively
|
33
|
+
And I type "my_master_password"
|
34
|
+
Then the output should contain "Master password:"
|
35
|
+
And the output should contain "The password for github will be displayed for 5 seconds:\ngithub"
|
36
|
+
|
37
|
+
Scenario: Try to get the password for "google" (which does not exist)
|
38
|
+
Given A safe exists with master password "my_master_password" and a key "github" with password "github_password"
|
39
|
+
When I run `pws ps google` interactively
|
40
|
+
And I type "my_master_password"
|
41
|
+
Then the output should contain "Master password:"
|
42
|
+
And the output should contain "No password found for google!"
|
43
|
+
|
44
|
+
Scenario: Try to get the password for "github" (but the master password is wrong)
|
45
|
+
Given A safe exists with master password "my_master_password" and a key "github" with password "github_password"
|
46
|
+
When I run `pws ps github` interactively
|
47
|
+
And I type "my_master_password_wrong"
|
48
|
+
Then the output should contain "Master password:"
|
49
|
+
And the output should contain "NO ACCESS"
|
50
|
+
|
51
|
+
Scenario: Get the password for "gihub" using an abbrev shortcut
|
52
|
+
Given A safe exists with master password "my_master_password" and keys
|
53
|
+
| github | 123 |
|
54
|
+
| google | 345 |
|
55
|
+
| gitorious | 678 |
|
56
|
+
When I run `pws ps gith 0` interactively
|
57
|
+
And I type "my_master_password"
|
58
|
+
Then the output should contain "Master password:"
|
59
|
+
And the output should contain "The password for github is:\n123"
|
60
|
+
|
61
|
+
|
62
|
+
|
data/features/remove.feature
CHANGED
@@ -3,7 +3,7 @@ Feature: Remove
|
|
3
3
|
As a user
|
4
4
|
I want to remove passwords from my password safe
|
5
5
|
|
6
|
-
|
6
|
+
|
7
7
|
Scenario: Remove password entry "github"
|
8
8
|
Given A safe exists with master password "my_master_password" and a key "github" with password "github_password"
|
9
9
|
When I run `pws remove github` interactively
|
data/features/rename.feature
CHANGED
@@ -3,7 +3,7 @@ Feature: Rename
|
|
3
3
|
As a user
|
4
4
|
I want to rename passwords in my password safe
|
5
5
|
|
6
|
-
|
6
|
+
|
7
7
|
Scenario: Rename the password entry "github" to "gh"
|
8
8
|
Given A safe exists with master password "my_master_password" and a key "github" with password "github_password"
|
9
9
|
When I run `pws rename github gh` interactively
|
data/features/resave.feature
CHANGED
@@ -3,7 +3,7 @@ Feature: Resave
|
|
3
3
|
As a user
|
4
4
|
I want resave the save
|
5
5
|
|
6
|
-
|
6
|
+
|
7
7
|
Scenario: Usual resave
|
8
8
|
Given A safe exists with master password "my_master_password" and keys
|
9
9
|
| some | 123 |
|
@@ -18,7 +18,7 @@ Feature: Resave
|
|
18
18
|
And the output should contain "password"
|
19
19
|
And the output should contain "entries"
|
20
20
|
|
21
|
-
|
21
|
+
|
22
22
|
Scenario: Useful for converting when used together with --in and --out options
|
23
23
|
Given A "0.9" safe exists with master password "password" and a key "github" with password "123456"
|
24
24
|
When I run `pws show` interactively
|
data/features/support/env.rb
CHANGED
@@ -33,17 +33,3 @@ Around do |_, block|
|
|
33
33
|
|
34
34
|
FileUtils.rm ENV["PWS"] if File.exist? ENV["PWS"]
|
35
35
|
end
|
36
|
-
|
37
|
-
# Hacks
|
38
|
-
|
39
|
-
Before('@slow-hack') do
|
40
|
-
@aruba_io_wait_seconds = 3
|
41
|
-
end
|
42
|
-
|
43
|
-
Before('@very-slow-hack') do
|
44
|
-
@aruba_io_wait_seconds = 7
|
45
|
-
end
|
46
|
-
|
47
|
-
Before('@wait-11s') do
|
48
|
-
@aruba_timeout_seconds = 15
|
49
|
-
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: UpdateGenerate
|
2
2
|
In order to keep my privacy
|
3
3
|
As a user
|
4
4
|
I want to update a password entry and generate the new password
|
5
5
|
|
6
|
-
|
6
|
+
|
7
7
|
Scenario: Generate a new password for "github" and get it
|
8
8
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
9
9
|
When I run `pws update-gen github` interactively
|
@@ -26,7 +26,7 @@ Feature: Update
|
|
26
26
|
Then the output should contain "Master password:"
|
27
27
|
And the output should contain "NO ACCESS"
|
28
28
|
|
29
|
-
|
29
|
+
|
30
30
|
Scenario: Generate a new password for "github" and get it
|
31
31
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
32
32
|
When I run `pws update-gen github` interactively
|
@@ -35,7 +35,7 @@ Feature: Update
|
|
35
35
|
And the output should contain "The password for github has been updated"
|
36
36
|
And the output should contain "The password for github is now available in your clipboard for 10 seconds"
|
37
37
|
|
38
|
-
|
38
|
+
|
39
39
|
Scenario: Generate a new password for "github", second parameter gets passed to the get as keep-in-clipboard time
|
40
40
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
41
41
|
When I run `pws update-gen github 1` interactively
|
@@ -44,8 +44,8 @@ Feature: Update
|
|
44
44
|
And the output should contain "The password for github has been updated"
|
45
45
|
And the output should contain "The password for github is now available in your clipboard for 1 second"
|
46
46
|
|
47
|
-
|
48
|
-
|
47
|
+
|
48
|
+
|
49
49
|
Scenario: Generate a new password for "github", PWS_SECONDS set to 5, gets passed to the get as keep-in-clipboard time
|
50
50
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
51
51
|
When I set env variable "PWS_SECONDS" to "5"
|
@@ -55,7 +55,7 @@ Feature: Update
|
|
55
55
|
And the output should contain "The password for github has been updated"
|
56
56
|
And the output should contain "The password for github is now available in your clipboard for 5 seconds"
|
57
57
|
|
58
|
-
|
58
|
+
|
59
59
|
Scenario: Generate a new password for "github", third parameter defines password length
|
60
60
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
61
61
|
When I run `pws update-gen github 0 10` interactively
|
@@ -65,7 +65,7 @@ Feature: Update
|
|
65
65
|
And the output should contain "The password for github has been copied to your clipboard"
|
66
66
|
And the clipboard should match /^.{10}$/
|
67
67
|
|
68
|
-
|
68
|
+
|
69
69
|
Scenario: Generate a new password for "github", default length is 64
|
70
70
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
71
71
|
When I run `pws update-gen github 0` interactively
|
@@ -75,7 +75,7 @@ Feature: Update
|
|
75
75
|
And the output should contain "The password for github has been copied to your clipboard"
|
76
76
|
And the clipboard should match /^.{64}$/
|
77
77
|
|
78
|
-
|
78
|
+
|
79
79
|
Scenario: Generate a new password for "github", default length of PWS_LENGTH
|
80
80
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
81
81
|
When I set env variable "PWS_LENGTH" to "15"
|
@@ -86,7 +86,7 @@ Feature: Update
|
|
86
86
|
And the output should contain "The password for github has been copied to your clipboard"
|
87
87
|
And the clipboard should match /^.{15}$/
|
88
88
|
|
89
|
-
|
89
|
+
|
90
90
|
Scenario: Generate a new password for "github", fourth parameter defines a char pool used for generation
|
91
91
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
92
92
|
When I run `pws update-gen github 0 10 a` interactively
|
@@ -96,7 +96,7 @@ Feature: Update
|
|
96
96
|
And the output should contain "The password for github has been copied to your clipboard"
|
97
97
|
And the clipboard should match /^a{10}$/
|
98
98
|
|
99
|
-
|
99
|
+
|
100
100
|
Scenario: Generate a new password for "github", the default char pool is !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
|
101
101
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
102
102
|
When I run `pws update-gen github 0` interactively
|
@@ -106,7 +106,7 @@ Feature: Update
|
|
106
106
|
And the output should contain "The password for github has been copied to your clipboard"
|
107
107
|
And the clipboard should match ^[!\"\#$%&'()*+,\-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~]+$
|
108
108
|
|
109
|
-
|
109
|
+
|
110
110
|
Scenario: Generate a new password for "github", the default char pool PWS_CHARPOOL
|
111
111
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
112
112
|
When I set env variable "PWS_CHARPOOL" to "a"
|
@@ -116,3 +116,12 @@ Feature: Update
|
|
116
116
|
And the output should contain "The password for github has been updated"
|
117
117
|
And the output should contain "The password for github has been copied to your clipboard"
|
118
118
|
And the clipboard should match ^a{64}$
|
119
|
+
|
120
|
+
Scenario: Generate a new password for "github", exclude the characters "ABC123" from the charpool
|
121
|
+
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
122
|
+
When I run `pws update-gen github 0 --exclude ABC123` interactively
|
123
|
+
And I type "my_master_password"
|
124
|
+
Then the output should contain "Master password:"
|
125
|
+
And the output should contain "The password for github has been updated"
|
126
|
+
And the output should contain "The password for github has been copied to your clipboard"
|
127
|
+
And the clipboard should match [^ABC123]{64}
|
data/features/update.feature
CHANGED
@@ -12,7 +12,7 @@ Feature: Update
|
|
12
12
|
And the output should contain "Please enter a new password for github:"
|
13
13
|
And the output should contain "The password for github has been updated"
|
14
14
|
|
15
|
-
|
15
|
+
|
16
16
|
Scenario: Set a new password for "github", already passing it as command line paramenter (not recommended)
|
17
17
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
18
18
|
When I run `pws update github new_password` interactively
|
@@ -27,7 +27,7 @@ Feature: Update
|
|
27
27
|
Then the output should contain "Master password:"
|
28
28
|
And the output should contain "There is no password stored for github, so you cannot update it!"
|
29
29
|
|
30
|
-
|
30
|
+
|
31
31
|
Scenario: Try to update the password for "github" (but it's empty)
|
32
32
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
33
33
|
When I run `pws update github` interactively
|
@@ -44,7 +44,7 @@ Feature: Update
|
|
44
44
|
Then the output should contain "Master password:"
|
45
45
|
And the output should contain "NO ACCESS"
|
46
46
|
|
47
|
-
|
47
|
+
|
48
48
|
Scenario: Set a new password for "github", this also sets the timestamp
|
49
49
|
Given A safe exists with master password "my_master_password" and a key "github" with password "old_password"
|
50
50
|
When I run `pws update github github_password` interactively
|
data/lib/pws.rb
CHANGED
@@ -127,15 +127,42 @@ class PWS
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
aliases_for :get, :entry, :copy, :password, :for, :[]
|
130
|
+
|
131
|
+
# Print a password entry to the screen
|
132
|
+
def print_screen(key, seconds = @options[:seconds])
|
133
|
+
if real_key = @abbrevs[key]
|
134
|
+
password = @data[real_key][:password]
|
135
|
+
if seconds && seconds.to_i > 0
|
136
|
+
print Paint[%[The password for #{real_key} will be displayed for #{seconds.to_i} second#{?s if seconds.to_i > 1}:\n#{password}], :green]
|
137
|
+
begin
|
138
|
+
sleep seconds.to_i
|
139
|
+
rescue Interrupt
|
140
|
+
puts "\e[999D\e[K\e[1A"*2 if $stdin.tty? # clear the pw from the screen
|
141
|
+
raise
|
142
|
+
end
|
143
|
+
puts "\e[999D\e[K\e[1A"*2 if $stdin.tty? # clear the pw from the screen
|
144
|
+
return true
|
145
|
+
else
|
146
|
+
pa %[The password for #{real_key} is:\n#{password}], :green
|
147
|
+
return true
|
148
|
+
end
|
149
|
+
else
|
150
|
+
pa %[No password found for #{key}!], :red
|
151
|
+
return false
|
152
|
+
end
|
153
|
+
end
|
154
|
+
alias :'print-screen' :print_screen
|
155
|
+
alias :ps :print_screen
|
130
156
|
|
131
157
|
# Adds a password entry with a freshly generated random password
|
132
158
|
def generate(
|
133
159
|
key,
|
134
160
|
seconds = @options[:seconds],
|
135
161
|
length = @options[:length],
|
136
|
-
charpool = @options[:charpool]
|
162
|
+
charpool = @options[:charpool],
|
163
|
+
excluded = @options[:exclude]
|
137
164
|
)
|
138
|
-
get(key, seconds) if add(key, generator(length, charpool))
|
165
|
+
get(key, seconds) if add(key, generator(length, charpool, excluded))
|
139
166
|
end
|
140
167
|
alias_for :generate, :gen
|
141
168
|
|
@@ -144,9 +171,10 @@ class PWS
|
|
144
171
|
key,
|
145
172
|
seconds = @options[:seconds],
|
146
173
|
length = @options[:length],
|
147
|
-
charpool = @options[:charpool]
|
174
|
+
charpool = @options[:charpool],
|
175
|
+
excluded = @options[:exclude]
|
148
176
|
)
|
149
|
-
get(key, seconds) if update(key, generator(length, charpool))
|
177
|
+
get(key, seconds) if update(key, generator(length, charpool, excluded))
|
150
178
|
end
|
151
179
|
alias :'update-generate' :update_generate
|
152
180
|
alias :'update_gen' :update_generate
|
@@ -285,7 +313,8 @@ class PWS
|
|
285
313
|
end
|
286
314
|
|
287
315
|
# Generate a random password, maybe put in its own class sometime
|
288
|
-
def generator(length, charpool)
|
316
|
+
def generator(length, charpool, exclude)
|
317
|
+
charpool = charpool.tr(exclude, '') if exclude
|
289
318
|
charpool_size = charpool.size
|
290
319
|
(1..length.to_i).map{
|
291
320
|
charpool[SecureRandom.random_number(charpool_size)]
|
data/lib/pws/runner.rb
CHANGED
@@ -68,6 +68,14 @@ module PWS::Runner
|
|
68
68
|
#{Paint['get', :bold]} / entry / copy / password / for ( name, seconds = 10 )
|
69
69
|
Copies the password for <name> to the clipboard. The second argument specifies,
|
70
70
|
how long the password is kept in the clipboard (0 = no deletion).
|
71
|
+
Please keep in mind that other programs can access (and log) the contents
|
72
|
+
of your clipboard.
|
73
|
+
|
74
|
+
#{Paint['ps', :bold]} / print-screen ( name, seconds = 10 )
|
75
|
+
Displays the password on stdout. The second argument specifies,
|
76
|
+
how long the password is shown (0 = no deletion).
|
77
|
+
Please keep in mind that the password will appear in your shell's logfile,
|
78
|
+
for example, in "~/.bash_history"
|
71
79
|
|
72
80
|
#{Paint['add', :bold]} / set / store / create ( name, password = nil )
|
73
81
|
Stores a new password entry. The second argument can be the password, but
|
@@ -126,7 +134,7 @@ module PWS::Runner
|
|
126
134
|
encryption key (pbkdf2). A higher number takes longer to compute, but makes
|
127
135
|
it harder for attacker to bruteforce your password.
|
128
136
|
|
129
|
-
#{Paint['--seconds', :bold]}, #{Paint['--length', :bold]}, #{Paint['--charpool', :bold]}
|
137
|
+
#{Paint['--seconds', :bold]}, #{Paint['--length', :bold]}, #{Paint['--charpool', :bold]}, #{Paint['--exclude', :bold]}
|
130
138
|
Preset options for specific actions.
|
131
139
|
|
132
140
|
#{Paint["ENV Variables", :underline]}
|
data/lib/pws/version.rb
CHANGED
data/pws.gemspec
CHANGED
@@ -16,13 +16,13 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.extra_rdoc_files = ["README.md", "MIT-LICENSE.txt", "CHANGELOG.md"]
|
17
17
|
s.license = 'MIT'
|
18
18
|
s.executables = ['pws']
|
19
|
-
s.add_dependency 'clipboard', '~> 1.
|
19
|
+
s.add_dependency 'clipboard', '~> 1.3'
|
20
20
|
s.add_dependency 'paint', '>= 0.8.7'
|
21
21
|
s.add_dependency 'pbkdf2-ruby'
|
22
22
|
s.add_development_dependency 'rake', '< 13'
|
23
|
-
s.add_development_dependency 'aruba', '
|
24
|
-
s.add_development_dependency 'cucumber', '~>
|
25
|
-
s.add_development_dependency 'rspec', '~>
|
23
|
+
s.add_development_dependency 'aruba', '~> 0.14'
|
24
|
+
s.add_development_dependency 'cucumber', '~> 3.1'
|
25
|
+
s.add_development_dependency 'rspec', '~> 3.8'
|
26
26
|
|
27
27
|
len = s.homepage.size
|
28
28
|
s.post_install_message = \
|
metadata
CHANGED
@@ -1,114 +1,115 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: clipboard
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
|
-
version: 1.
|
19
|
-
name: clipboard
|
20
|
-
prerelease: false
|
19
|
+
version: '1.3'
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: paint
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 0.8.7
|
33
|
-
name: paint
|
34
|
-
prerelease: false
|
35
34
|
type: :runtime
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.8.7
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: pbkdf2-ruby
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - ">="
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '0'
|
47
|
-
name: pbkdf2-ruby
|
48
|
-
prerelease: false
|
49
48
|
type: :runtime
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - "<"
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '13'
|
61
|
-
name: rake
|
62
|
-
prerelease: false
|
63
62
|
type: :development
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "<"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '13'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
+
name: aruba
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
71
72
|
requirements:
|
72
|
-
- -
|
73
|
+
- - "~>"
|
73
74
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
75
|
-
name: aruba
|
76
|
-
prerelease: false
|
75
|
+
version: '0.14'
|
77
76
|
type: :development
|
77
|
+
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: '0.14'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
+
name: cucumber
|
84
85
|
requirement: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
87
|
- - "~>"
|
87
88
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
89
|
-
name: cucumber
|
90
|
-
prerelease: false
|
89
|
+
version: '3.1'
|
91
90
|
type: :development
|
91
|
+
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '3.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
98
99
|
requirement: !ruby/object:Gem::Requirement
|
99
100
|
requirements:
|
100
101
|
- - "~>"
|
101
102
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
103
|
-
name: rspec
|
104
|
-
prerelease: false
|
103
|
+
version: '3.8'
|
105
104
|
type: :development
|
105
|
+
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
description: pws is a command-line password safe. Please run `pws --help` for usage
|
110
|
+
version: '3.8'
|
111
|
+
description: pws is a command-line password safe. Please run `pws --help` for usage
|
112
|
+
information.
|
112
113
|
email: mail@janlelis.de
|
113
114
|
executables:
|
114
115
|
- pws
|
@@ -131,6 +132,7 @@ files:
|
|
131
132
|
- features/master.feature
|
132
133
|
- features/misc.feature
|
133
134
|
- features/namespaces.feature
|
135
|
+
- features/print-screen.feature
|
134
136
|
- features/remove.feature
|
135
137
|
- features/rename.feature
|
136
138
|
- features/resave.feature
|
@@ -172,9 +174,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
174
|
- !ruby/object:Gem::Version
|
173
175
|
version: '0'
|
174
176
|
requirements: []
|
175
|
-
rubyforge_project:
|
176
|
-
rubygems_version: 2.
|
177
|
-
signing_key:
|
177
|
+
rubyforge_project:
|
178
|
+
rubygems_version: 2.5.1
|
179
|
+
signing_key:
|
178
180
|
specification_version: 4
|
179
181
|
summary: pws is a CLI password safe.
|
180
182
|
test_files: []
|