uberpass 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +15 -0
- data/bin/uberpass-seppuku +13 -0
- data/lib/uberpass.rb +0 -3
- data/lib/uberpass/cli.rb +11 -11
- data/lib/uberpass/decrypt.rb +0 -1
- data/lib/uberpass/file_handler.rb +22 -7
- data/lib/uberpass/version.rb +1 -1
- data/spec/uberpass_output.rb +1 -1
- data/spec/uberpass_spec.rb +4 -6
- metadata +11 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7740715563b6928b828e51e7898b4c8c262d89f3
|
4
|
+
data.tar.gz: 1b3251bf85e6c77bd139696405e44735f91ab839
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9ba192d068a8664e52704253c5d987479e9e9a8e981d06d078ba7c48797148895808ecb4b180c17f640a413f77459636a123e731a16fd1cada5ea748459c9c79
|
7
|
+
data.tar.gz: 98945b49e7629a01ec68e1fd7581b0c5cc8261cf9e64b6d073cd906edc2f2e668a5cc054fe6d4b966c59728a72025e69fd984c28b97e12d89a3b379e77694e88
|
data/README.rdoc
CHANGED
@@ -28,3 +28,18 @@ and getting some help:
|
|
28
28
|
|
29
29
|
$ uberpass
|
30
30
|
$ uberpass:0.0.5> help
|
31
|
+
|
32
|
+
removing a password file
|
33
|
+
|
34
|
+
$ uberpass-seppuku
|
35
|
+
|
36
|
+
or
|
37
|
+
|
38
|
+
$ uberpass-seppuku happy_place
|
39
|
+
|
40
|
+
== Changelog
|
41
|
+
|
42
|
+
=== v1.0.0
|
43
|
+
|
44
|
+
Passwords now stored as json. Dump passwords from older versions and add back
|
45
|
+
in.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
Signal.trap("INT") { exit }
|
4
|
+
|
5
|
+
require 'uberpass'
|
6
|
+
|
7
|
+
Uberpass::FileHandler.configure { |handler| handler.namespace = ARGV.pop }
|
8
|
+
|
9
|
+
terminal = HighLine.new $stdin, $stdout
|
10
|
+
|
11
|
+
if terminal.agree("<%= color('are you sure?', :error) %> ") { |q| q.default = "n" }
|
12
|
+
Uberpass::FileHandler.seppuku!
|
13
|
+
end
|
data/lib/uberpass.rb
CHANGED
data/lib/uberpass/cli.rb
CHANGED
@@ -61,7 +61,7 @@ module Uberpass
|
|
61
61
|
action.short = 'g'
|
62
62
|
action.usage = 'g google'
|
63
63
|
action.proc = ->(terminal, key) {
|
64
|
-
ShowDecorator.new(terminal, FileHandler.generate(key)).output
|
64
|
+
ShowDecorator.new(terminal, FileHandler.generate(key.to_s)).output
|
65
65
|
}
|
66
66
|
action.description = "Generates a random password for a given key"
|
67
67
|
end
|
@@ -71,7 +71,7 @@ module Uberpass
|
|
71
71
|
action.short = 'gs'
|
72
72
|
action.usage = 'gs [name]'
|
73
73
|
action.proc = ->(terminal, key) {
|
74
|
-
ShowDecorator.new(terminal, FileHandler.generate_short(key)).output
|
74
|
+
ShowDecorator.new(terminal, FileHandler.generate_short(key.to_s)).output
|
75
75
|
}
|
76
76
|
action.description = "Generates a random password but smaller so its easier to type into a phone or a legacy system"
|
77
77
|
end
|
@@ -82,20 +82,20 @@ module Uberpass
|
|
82
82
|
action.usage = 'rm [name]'
|
83
83
|
action.confirm = true
|
84
84
|
action.proc = ->(terminal, key) {
|
85
|
-
ShowDecorator.new(terminal, FileHandler.remove(key)).output
|
85
|
+
ShowDecorator.new(terminal, FileHandler.remove(key.to_s)).output
|
86
86
|
}
|
87
87
|
action.description = "Removes and entry"
|
88
88
|
end
|
89
89
|
|
90
90
|
register_action do |action|
|
91
91
|
action.name = 'show'
|
92
|
-
action.short = '
|
93
|
-
action.usage = '
|
92
|
+
action.short = 'cat'
|
93
|
+
action.usage = 'cat [name|index]'
|
94
94
|
action.proc = ->(terminal, key) {
|
95
95
|
entry = if key =~ /^\d+$/
|
96
96
|
FileHandler.all[key.to_i]
|
97
97
|
else
|
98
|
-
FileHandler.show key
|
98
|
+
FileHandler.show key.to_s
|
99
99
|
end
|
100
100
|
ShowDecorator.new(terminal, entry).output
|
101
101
|
}
|
@@ -105,9 +105,9 @@ module Uberpass
|
|
105
105
|
register_action do |action|
|
106
106
|
action.name = 'encrypt'
|
107
107
|
action.short = 'e'
|
108
|
-
action.usage = '[name]
|
108
|
+
action.usage = '[name] < [password]'
|
109
109
|
action.proc = ->(terminal, key, password) {
|
110
|
-
ShowDecorator.new(terminal, FileHandler.encrypt(key, password)).output
|
110
|
+
ShowDecorator.new(terminal, FileHandler.encrypt(key.to_s, password.to_s)).output
|
111
111
|
}
|
112
112
|
action.description = "Encrypts a value"
|
113
113
|
end
|
@@ -117,7 +117,7 @@ module Uberpass
|
|
117
117
|
action.short = 'mv'
|
118
118
|
action.usage = 'mv [name] [new name]'
|
119
119
|
action.proc = ->(terminal, old, new) {
|
120
|
-
ShowDecorator.new(terminal, FileHandler.rename(old, new)).output
|
120
|
+
ShowDecorator.new(terminal, FileHandler.rename(old.to_s, new.to_s)).output
|
121
121
|
}
|
122
122
|
action.description = "Rename an entry"
|
123
123
|
end
|
@@ -211,7 +211,7 @@ module Uberpass
|
|
211
211
|
end
|
212
212
|
|
213
213
|
def output_entry(key, values, index)
|
214
|
-
out = "<%= color('#{values["created_at"]
|
214
|
+
out = "<%= color('#{values["created_at"]}', :date) %>"
|
215
215
|
out << " <%= color('[#{index}]', :index) %>"
|
216
216
|
out << " <%= color('#{key}', :name) %>"
|
217
217
|
@terminal.say out
|
@@ -251,7 +251,7 @@ module Uberpass
|
|
251
251
|
if values.nil?
|
252
252
|
out = "<%= color('#{key} does not exist', :error) %>"
|
253
253
|
else
|
254
|
-
out = "<%= color('#{values["created_at"]
|
254
|
+
out = "<%= color('#{values["created_at"]}', :date) %>"
|
255
255
|
out << " <%= color('#{key}', :name) %>\n"
|
256
256
|
out << "<%= color('#{values["password"]}', :name) %>"
|
257
257
|
end
|
data/lib/uberpass/decrypt.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'securerandom'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module Uberpass
|
4
5
|
class FileHandler
|
@@ -36,20 +37,26 @@ module Uberpass
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def write(encryptor)
|
39
|
-
File.open(passwords_file, "w") { |file|
|
40
|
+
File.open(passwords_file, "w+") { |file|
|
40
41
|
file.write(encryptor.encrypted_data)
|
41
42
|
}
|
42
|
-
File.open(key_file, "w") { |file|
|
43
|
+
File.open(key_file, "w+") { |file|
|
43
44
|
file.write(encryptor.encrypted_key)
|
44
45
|
}
|
45
|
-
File.open(iv_file, "w") { |file|
|
46
|
+
File.open(iv_file, "w+") { |file|
|
46
47
|
file.write(encryptor.encrypted_iv)
|
47
48
|
}
|
48
49
|
end
|
49
50
|
|
51
|
+
def seppuku!
|
52
|
+
if File.exists?(passwords_file)
|
53
|
+
File.unlink(passwords_file, key_file, iv_file)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
50
57
|
def decrypted_passwords
|
51
58
|
if File.exists?(passwords_file)
|
52
|
-
|
59
|
+
decode(
|
53
60
|
Decrypt.new(
|
54
61
|
File.read(private_key_file),
|
55
62
|
File.read(passwords_file),
|
@@ -63,6 +70,14 @@ module Uberpass
|
|
63
70
|
end
|
64
71
|
end
|
65
72
|
|
73
|
+
def encode(data)
|
74
|
+
JSON.pretty_generate(data)
|
75
|
+
end
|
76
|
+
|
77
|
+
def decode(data)
|
78
|
+
JSON.parse(data)
|
79
|
+
end
|
80
|
+
|
66
81
|
def show(key)
|
67
82
|
Hash[*[key, decrypted_passwords[key]]]
|
68
83
|
end
|
@@ -88,7 +103,7 @@ module Uberpass
|
|
88
103
|
"password" => password,
|
89
104
|
"created_at" => Time.now
|
90
105
|
}
|
91
|
-
encryptor = Encrypt.new(File.read(public_key_file), passwords
|
106
|
+
encryptor = Encrypt.new(File.read(public_key_file), encode(passwords), pass_phrase)
|
92
107
|
write(encryptor)
|
93
108
|
Hash[*[key, entry]]
|
94
109
|
end
|
@@ -98,7 +113,7 @@ module Uberpass
|
|
98
113
|
raise ExistingEntryError, new unless passwords[new].nil?
|
99
114
|
entry = passwords.delete old
|
100
115
|
passwords[new] = entry
|
101
|
-
encryptor = Encrypt.new(File.read(public_key_file), passwords
|
116
|
+
encryptor = Encrypt.new(File.read(public_key_file), encode(passwords))
|
102
117
|
write(encryptor)
|
103
118
|
Hash[*[new, entry]]
|
104
119
|
end
|
@@ -106,7 +121,7 @@ module Uberpass
|
|
106
121
|
def remove(key)
|
107
122
|
passwords = decrypted_passwords
|
108
123
|
entry = passwords.delete key
|
109
|
-
encryptor = Encrypt.new(File.read(public_key_file), passwords
|
124
|
+
encryptor = Encrypt.new(File.read(public_key_file), encode(passwords))
|
110
125
|
write(encryptor)
|
111
126
|
Hash[*[key, entry]]
|
112
127
|
end
|
data/lib/uberpass/version.rb
CHANGED
data/spec/uberpass_output.rb
CHANGED
data/spec/uberpass_spec.rb
CHANGED
@@ -19,9 +19,7 @@ describe Uberpass do
|
|
19
19
|
|
20
20
|
@input.truncate(@input.rewind)
|
21
21
|
|
22
|
-
Uberpass::FileHandler.
|
23
|
-
Uberpass::FileHandler.remove entry.keys.first
|
24
|
-
end
|
22
|
+
Uberpass::FileHandler.seppuku!
|
25
23
|
|
26
24
|
Uberpass::FileHandler.generate 'twitter'
|
27
25
|
Uberpass::FileHandler.generate 'facebook'
|
@@ -43,7 +41,7 @@ describe Uberpass do
|
|
43
41
|
|
44
42
|
assert_match /facebook/, @output.string
|
45
43
|
assert_match /twitter/, @output.string
|
46
|
-
assert_match Time.now.strftime("%d
|
44
|
+
assert_match Time.now.strftime("%Y-%m-%d"), @output.string
|
47
45
|
end
|
48
46
|
|
49
47
|
it "should raise and catch argument error" do
|
@@ -74,7 +72,7 @@ describe Uberpass do
|
|
74
72
|
|
75
73
|
assert_match /are you sure\?/, @output.string
|
76
74
|
assert_match /linkedin/, @output.string
|
77
|
-
assert_match Time.now.strftime("%d
|
75
|
+
assert_match Time.now.strftime("%Y-%m-%d"), @output.string
|
78
76
|
end
|
79
77
|
|
80
78
|
it "should encrypt an existing password with <" do
|
@@ -119,7 +117,7 @@ describe Uberpass do
|
|
119
117
|
|
120
118
|
it "should show an error if key missing" do
|
121
119
|
@output.truncate(@output.rewind)
|
122
|
-
@input << '
|
120
|
+
@input << 'cat missing'
|
123
121
|
@input.rewind
|
124
122
|
|
125
123
|
@uberpass.do_action
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uberpass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Rufus Post
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: highline
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - '='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - '='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,23 +27,20 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: turn
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - '='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - '='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -64,6 +57,7 @@ email:
|
|
64
57
|
- rufuspost@gmail.com
|
65
58
|
executables:
|
66
59
|
- uberpass
|
60
|
+
- uberpass-seppuku
|
67
61
|
extensions: []
|
68
62
|
extra_rdoc_files: []
|
69
63
|
files:
|
@@ -72,6 +66,7 @@ files:
|
|
72
66
|
- README.rdoc
|
73
67
|
- Rakefile
|
74
68
|
- bin/uberpass
|
69
|
+
- bin/uberpass-seppuku
|
75
70
|
- lib/uberpass.rb
|
76
71
|
- lib/uberpass/cli.rb
|
77
72
|
- lib/uberpass/decrypt.rb
|
@@ -83,29 +78,27 @@ files:
|
|
83
78
|
- uberpass.gemspec
|
84
79
|
homepage: ''
|
85
80
|
licenses: []
|
81
|
+
metadata: {}
|
86
82
|
post_install_message:
|
87
83
|
rdoc_options: []
|
88
84
|
require_paths:
|
89
85
|
- lib
|
90
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
87
|
requirements:
|
93
|
-
- -
|
88
|
+
- - '>='
|
94
89
|
- !ruby/object:Gem::Version
|
95
90
|
version: '0'
|
96
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
92
|
requirements:
|
99
|
-
- -
|
93
|
+
- - '>='
|
100
94
|
- !ruby/object:Gem::Version
|
101
95
|
version: '0'
|
102
96
|
requirements: []
|
103
97
|
rubyforge_project: uberpass
|
104
|
-
rubygems_version:
|
98
|
+
rubygems_version: 2.0.0
|
105
99
|
signing_key:
|
106
|
-
specification_version:
|
100
|
+
specification_version: 4
|
107
101
|
summary: command line key chain
|
108
102
|
test_files:
|
109
103
|
- spec/uberpass_output.rb
|
110
104
|
- spec/uberpass_spec.rb
|
111
|
-
has_rdoc:
|