imp 0.2.1 → 0.2.2
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/imp.gemspec +2 -2
- data/lib/imp.rb +1 -1
- data/lib/imp/commands.rb +3 -25
- data/lib/imp/ui.rb +20 -8
- data/lib/imp/util.rb +24 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89aa2f96352505f2038a3824082459a3012637e6
|
4
|
+
data.tar.gz: 69aeb301287ff6be0c440695f527548522d9bb38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d44f5b225fdca01fcb88678a8057fed230dfef118b986dca2d2a5f095ca8030cb98cd4634a03968bf6f9a2cde9e0e8b8c0ba6a487adfe2dcd2308abc50ff14ea
|
7
|
+
data.tar.gz: f1fa1b6808134c5f6fd855fc79fb9505d83084b10f30df8e689efcb37bc83b0c4e813e18414e9787a88f59db57ff8d2dc5301e7c8ef2043eb026e3b5cfe94271
|
data/imp.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.description = "
|
9
9
|
IMP is a simple console password manager. Passwords are stored in an AES
|
10
10
|
encrypted filesystem-like tree. The main functionality includes printing,
|
11
|
-
setting and copying
|
12
|
-
being shown on screen."
|
11
|
+
setting and copying passwords, allowing the handling of passwords without
|
12
|
+
them being shown on screen."
|
13
13
|
spec.description
|
14
14
|
spec.version = Imp::VERSION
|
15
15
|
spec.date = Time.now.strftime('%Y-%m-%d')
|
data/lib/imp.rb
CHANGED
data/lib/imp/commands.rb
CHANGED
@@ -2,6 +2,7 @@ require 'clipboard'
|
|
2
2
|
require 'highline/import'
|
3
3
|
|
4
4
|
require_relative 'ui'
|
5
|
+
require_relative 'util'
|
5
6
|
|
6
7
|
module Imp
|
7
8
|
|
@@ -88,7 +89,7 @@ remenicient of urls).")
|
|
88
89
|
#
|
89
90
|
# @param args [Array] Ignored.
|
90
91
|
def self.change_passwd(*args)
|
91
|
-
pass = read_passwd
|
92
|
+
pass = Util.read_passwd("password for file '#{$file}'")
|
92
93
|
return unless pass
|
93
94
|
$tree.password = pass
|
94
95
|
$tree.flush
|
@@ -100,7 +101,7 @@ remenicient of urls).")
|
|
100
101
|
# @param key [String] The key to set the value for.
|
101
102
|
def self.set(key)
|
102
103
|
fail "Key must be supplied." unless key
|
103
|
-
pass = read_passwd
|
104
|
+
pass = Util.read_passwd
|
104
105
|
return unless pass
|
105
106
|
$tree[key] = pass
|
106
107
|
# We save the tree whenever it is modified.
|
@@ -176,29 +177,6 @@ remenicient of urls).")
|
|
176
177
|
# defined as private.
|
177
178
|
private
|
178
179
|
|
179
|
-
# Reads a password from the user.
|
180
|
-
#
|
181
|
-
# @return [String, nil] The password enetered, or nil if aborted.
|
182
|
-
def self.read_passwd
|
183
|
-
first_pass = true
|
184
|
-
pass1 = pass2 = nil
|
185
|
-
until pass1 == pass2 && !first_pass
|
186
|
-
unless first_pass
|
187
|
-
puts "The pass did not match. Please try again."
|
188
|
-
end
|
189
|
-
pass1 = ask "Please enter the pass (leave blank to cancel): " do |q|
|
190
|
-
q.echo = false
|
191
|
-
end
|
192
|
-
return if pass1 == ''
|
193
|
-
pass2 = ask "Re-enter the pass to confirm: " do |q|
|
194
|
-
q.echo = false
|
195
|
-
end
|
196
|
-
first_pass = false
|
197
|
-
end
|
198
|
-
return pass1
|
199
|
-
end
|
200
|
-
private_class_method :read_passwd
|
201
|
-
|
202
180
|
# Copies the value of a single 1-indexed character of the value of a key
|
203
181
|
# to the system clipboard.
|
204
182
|
#
|
data/lib/imp/ui.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'highline/import'
|
2
|
+
|
2
3
|
require 'readline'
|
3
4
|
require 'timeout'
|
4
5
|
require 'optparse'
|
@@ -28,13 +29,8 @@ module Imp
|
|
28
29
|
def self.load_file
|
29
30
|
until $tree
|
30
31
|
begin
|
31
|
-
passwd =
|
32
|
-
|
33
|
-
q.echo = false
|
34
|
-
end
|
35
|
-
if passwd == ''
|
36
|
-
break
|
37
|
-
end
|
32
|
+
passwd = get_passwd
|
33
|
+
return unless passwd
|
38
34
|
$tree = EncryptedTree.new(passwd, $file)
|
39
35
|
rescue OpenSSL::Cipher::CipherError
|
40
36
|
$stderr.puts "Decryption failed. Corrupt file or wrong password."
|
@@ -104,7 +100,7 @@ module Imp
|
|
104
100
|
# Displays welcome text.
|
105
101
|
def self.welcome
|
106
102
|
puts "imp version #{VERSION}"
|
107
|
-
puts "Using password file #{$file}."
|
103
|
+
puts "Using password file '#{$file}'."
|
108
104
|
puts "Welcome to imp! Type 'help' for a list of commands."
|
109
105
|
end
|
110
106
|
private_class_method :welcome
|
@@ -186,6 +182,22 @@ module Imp
|
|
186
182
|
end
|
187
183
|
private_class_method :init_readline
|
188
184
|
|
185
|
+
def self.get_passwd
|
186
|
+
if File.exists? File.expand_path($file)
|
187
|
+
pass = ask("Password for file '#{$file}' (leave blank to cancel): ")\
|
188
|
+
do |q|
|
189
|
+
q.echo = false
|
190
|
+
end
|
191
|
+
pass == "" ? nil : pass
|
192
|
+
else
|
193
|
+
puts "This is your first time using the file '#{$file}' to save "
|
194
|
+
"your passwords."
|
195
|
+
puts "Please enter your password for first-time use."
|
196
|
+
puts "Note that you can change this password at any time."
|
197
|
+
Util.read_passwd("password for the file '#{$file}'")
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
189
201
|
end
|
190
202
|
|
191
203
|
end
|
data/lib/imp/util.rb
CHANGED
@@ -14,6 +14,30 @@ module Imp
|
|
14
14
|
Dir.mkdir(dir)
|
15
15
|
end
|
16
16
|
|
17
|
+
# Reads a password from the user.
|
18
|
+
#
|
19
|
+
# @param desc [String] The description of the password inserted into query
|
20
|
+
# texts.
|
21
|
+
# @return [String, nil] The password enetered, or nil if aborted.
|
22
|
+
def self.read_passwd(desc = 'password')
|
23
|
+
first_pass = true
|
24
|
+
pass1 = pass2 = nil
|
25
|
+
until pass1 == pass2 && !first_pass
|
26
|
+
unless first_pass
|
27
|
+
puts "The pass did not match. Please try again."
|
28
|
+
end
|
29
|
+
pass1 = ask "Please enter the #{desc} (leave blank to cancel): " do |q|
|
30
|
+
q.echo = false
|
31
|
+
end
|
32
|
+
return if pass1 == ''
|
33
|
+
pass2 = ask "Re-enter the #{desc} to confirm: " do |q|
|
34
|
+
q.echo = false
|
35
|
+
end
|
36
|
+
first_pass = false
|
37
|
+
end
|
38
|
+
return pass1
|
39
|
+
end
|
40
|
+
|
17
41
|
end
|
18
42
|
|
19
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Kerber
|
@@ -42,8 +42,8 @@ description: |2-
|
|
42
42
|
|
43
43
|
IMP is a simple console password manager. Passwords are stored in an AES
|
44
44
|
encrypted filesystem-like tree. The main functionality includes printing,
|
45
|
-
setting and copying
|
46
|
-
being shown on screen.
|
45
|
+
setting and copying passwords, allowing the handling of passwords without
|
46
|
+
them being shown on screen.
|
47
47
|
email: t.kerber@online.de
|
48
48
|
executables:
|
49
49
|
- imp
|
@@ -51,13 +51,13 @@ extensions: []
|
|
51
51
|
extra_rdoc_files: []
|
52
52
|
files:
|
53
53
|
- bin/imp
|
54
|
-
- lib/imp/commands.rb
|
55
54
|
- lib/imp/crypto.rb
|
56
55
|
- lib/imp/encrypted_tree.rb
|
57
56
|
- lib/imp/tree.rb
|
57
|
+
- lib/imp/encrypted_file.rb
|
58
58
|
- lib/imp/util.rb
|
59
|
+
- lib/imp/commands.rb
|
59
60
|
- lib/imp/ui.rb
|
60
|
-
- lib/imp/encrypted_file.rb
|
61
61
|
- lib/imp.rb
|
62
62
|
- LICENSE
|
63
63
|
- README.md
|