uhide 0.0.24 โ 0.0.29
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.md +1 -1
- data/bin/uhide +4 -8
- data/lib/uhide/main.rb +127 -131
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1bb0a47cafba2fee10332891e6be453113a5b1ceae61eba210d77605b199083
|
4
|
+
data.tar.gz: 4c6b59d2d8ccc634767340ca5a395d6478fb3c2548c8a525576b01d7698fa834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc10019a4bcc6bb68172f8a69d1917c18f217fb640b5fe640beda754695f3e4feee234f618eb318070ab4e72923e1576cc81f70196684e6859cd778ad03961b9
|
7
|
+
data.tar.gz: d42ea00c9827ab34834c732f67c9e2758dc7ddf67914cd487c08531837d2f13eb5e235f99b9144cae39b90b86f21bcec6ba932b25ca5a5dadb4193bb807dd468
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
๐
ฟ๏ธ๐๐ผeยฎ๏ธed ๐
ฑ๏ธ๐พ eโ๏ธ๐ค๐ฏโน๏ธ tec๐จn๐๐ฑ๐
พ๏ธg๐พ
|
4
4
|
|
5
|
-
|
5
|
+
Securely store passwords, phone numbers, email addresses, credit card numbers -- any sensitive text.
|
6
6
|
|
7
7
|
**Install:** `gem install uhide`
|
8
8
|
|
data/bin/uhide
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
require 'optparse'
|
2
2
|
require 'uhide'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
opts.banner = "Usage: uhide command [key-name] [key-value]"
|
7
|
-
|
8
|
-
opts.on("-h", "--help", "Help") do |v|
|
4
|
+
OptionParser.new do |๐|
|
5
|
+
๐.on('-h', '--help', 'Help') do |๐|
|
9
6
|
puts <<-HELP
|
10
7
|
Usage: uhide command [key-name] [key-value]
|
11
8
|
Example: uhide set gmail mysecurepassword123
|
@@ -14,17 +11,16 @@ Example: uhide get gmail
|
|
14
11
|
Get Started:
|
15
12
|
|
16
13
|
1. run `uhide`
|
17
|
-
2. You will
|
14
|
+
2. You will see: ๐ > . Choose a password you can remember and enter it.
|
18
15
|
3. You can now run commands. Next time you run `uhide` from this directory, enter the same password to manage your sensitive information.
|
19
16
|
|
20
17
|
Commands and Optional Arguments:
|
21
18
|
- get [key-name]
|
22
19
|
- set [key-name] [key-value]
|
23
|
-
|
24
20
|
HELP
|
25
21
|
exit!
|
26
22
|
end
|
27
23
|
|
28
24
|
end.parse!
|
29
25
|
|
30
|
-
Uhide::Main
|
26
|
+
Uhide::Main.โ๏ธ
|
data/lib/uhide/main.rb
CHANGED
@@ -1,153 +1,150 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
$๐ง = -> { ๐๏ธ '๐ง', SecureRandom.random_bytes }
|
4
|
-
$๐ = -> { ๐๏ธ '๐', ActiveSupport::MessageEncryptor.key_len }
|
5
|
-
INVALID_KEY = 'invalid key'.colorize(:magenta)
|
6
|
-
UNSUPPORTED_๐พ = 'unsupported'.colorize(:magenta) + ' ๐พ'
|
7
|
-
$cache = {}
|
1
|
+
โผ๏ธ๐ = 'invalid key'.colorize(:magenta)
|
2
|
+
โผ๏ธ๐พ = 'unsupported'.colorize(:magenta) + ' ๐พ'
|
8
3
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
def ๐ฝ
|
14
|
-
print "\r"
|
15
|
-
$stdout.flush
|
16
|
-
end
|
17
|
-
|
18
|
-
def โ ๐, simple: true
|
19
|
-
print ๐
|
20
|
-
password = password?
|
21
|
-
$password = password if simple
|
22
|
-
๐ฝ
|
23
|
-
return password
|
24
|
-
end
|
25
|
-
|
26
|
-
def ๐งผ ๐๏ธ
|
27
|
-
๐๏ธ.chomp
|
28
|
-
end
|
29
|
-
|
30
|
-
def ๐ ๐ท๏ธ: nil
|
31
|
-
if ๐ท๏ธ.nil?
|
32
|
-
puts $cache['ddllv']
|
33
|
-
else
|
34
|
-
puts $cache['ddllv'][๐ท๏ธ]
|
35
|
-
end
|
36
|
-
|
37
|
-
๐ = File.read './๐ง'
|
38
|
-
if ๐.empty?
|
39
|
-
๐ = SecureRandom.random_bytes $๐.call
|
40
|
-
File.write './๐ง', Marshal.dump(๐)
|
41
|
-
return $cache['๐ง'] = ๐
|
42
|
-
else
|
43
|
-
return $cache['๐ง'] = Marshal.load(File.read './๐ง')
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
def ๐ ๐ท๏ธ, ๐
|
49
|
-
$cache['ddllv'][๐ท๏ธ] = ๐
|
50
|
-
๐พ
|
51
|
-
end
|
52
|
-
|
53
|
-
def ๐ค ๐ฃ๏ธ
|
54
|
-
๐พ, ๐ท๏ธ, ๐ = ๐ฃ๏ธ.split
|
55
|
-
|
56
|
-
if ๐พ.nil?
|
57
|
-
return
|
58
|
-
end
|
4
|
+
class Uhide::Main
|
5
|
+
@@โ = " โ > "
|
6
|
+
@@๐ = " ๐ > "
|
7
|
+
@@๐๏ธ = {}
|
59
8
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
๐ ๐ท๏ธ: ๐ท๏ธ
|
64
|
-
else
|
65
|
-
๐
|
9
|
+
class << self
|
10
|
+
def ๐ง
|
11
|
+
๐๏ธ '๐ง', SecureRandom.random_bytes
|
66
12
|
end
|
67
13
|
|
68
|
-
|
69
|
-
|
14
|
+
def ๐
|
15
|
+
๐๏ธ '๐', ActiveSupport::MessageEncryptor.key_len
|
16
|
+
end
|
70
17
|
|
71
|
-
|
72
|
-
|
18
|
+
def ๐ฝ
|
19
|
+
print "\r"
|
20
|
+
$stdout.flush
|
21
|
+
end
|
73
22
|
|
74
|
-
|
75
|
-
|
76
|
-
['ddllv', '๐ง', '๐'].each_entry{ |item| File.delete "./#{item}" }
|
77
|
-
exit!
|
78
|
-
else
|
79
|
-
puts INVALID_KEY
|
23
|
+
def ๐งผ ๐๏ธ
|
24
|
+
๐๏ธ.chomp
|
80
25
|
end
|
81
26
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
โ๏ธ = ActiveSupport::MessageEncryptor.new(
|
90
|
-
ActiveSupport::KeyGenerator.new($password).generate_key($๐ง.call, $๐.call)
|
91
|
-
)
|
92
|
-
|
93
|
-
was_bootstrapped = !(not $cache['ddllv'])
|
94
|
-
๐ = ๐๏ธ 'ddllv', {}, โ๏ธ: โ๏ธ
|
95
|
-
๐ 'ddllv', ๐, โ๏ธ: โ๏ธ if was_bootstrapped
|
96
|
-
end
|
97
|
-
|
98
|
-
def ๐ ๐๏ธ, ๐, โ๏ธ: false
|
99
|
-
if โ๏ธ
|
100
|
-
๐ = โ๏ธ.encrypt_and_sign ๐
|
101
|
-
else
|
102
|
-
๐ = ๐
|
103
|
-
end
|
104
|
-
|
105
|
-
๐ = Marshal.dump ๐
|
106
|
-
File.write "./#{๐๏ธ}", ๐
|
107
|
-
return ๐
|
108
|
-
end
|
109
|
-
|
110
|
-
def ๐๏ธ ๐๏ธ, ๐, โ๏ธ: false
|
111
|
-
if $cache[๐๏ธ]
|
112
|
-
return $cache[๐๏ธ]
|
113
|
-
end
|
114
|
-
|
115
|
-
begin
|
116
|
-
๐ = File.read "./#{๐๏ธ}"
|
117
|
-
rescue Errno::ENOENT
|
118
|
-
๐ = ๐ ๐๏ธ, ๐, โ๏ธ: โ๏ธ
|
119
|
-
end
|
120
|
-
|
121
|
-
if not ๐.empty?
|
122
|
-
๐ = Marshal.load ๐
|
27
|
+
def โ ๐, simple: true
|
28
|
+
print ๐
|
29
|
+
โ๏ธ = ๐งผ STDIN.noecho(&:gets)
|
30
|
+
@@โ๏ธ = โ๏ธ if simple
|
31
|
+
๐ฝ
|
32
|
+
return โ๏ธ
|
33
|
+
end
|
123
34
|
|
124
|
-
|
35
|
+
def ๐ ๐ท๏ธ: nil
|
36
|
+
if ๐ท๏ธ.nil?
|
37
|
+
puts @@๐๏ธ['ใฝ๏ธ']
|
38
|
+
else
|
39
|
+
puts @@๐๏ธ['ใฝ๏ธ'][๐ท๏ธ]
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def ๐ ๐ท๏ธ, ๐
|
45
|
+
@@๐๏ธ['ใฝ๏ธ'][๐ท๏ธ] = ๐
|
46
|
+
๐พ
|
47
|
+
end
|
48
|
+
|
49
|
+
def ๐พ
|
50
|
+
โ๏ธ = ActiveSupport::MessageEncryptor.new(
|
51
|
+
ActiveSupport::KeyGenerator.new(@@โ๏ธ).generate_key(๐ง, ๐)
|
52
|
+
)
|
53
|
+
|
54
|
+
๐ฅพ = !(not @@๐๏ธ['ใฝ๏ธ'])
|
55
|
+
๐ = ๐๏ธ 'ใฝ๏ธ', {}, โ๏ธ: โ๏ธ
|
56
|
+
๐ 'ใฝ๏ธ', ๐, โ๏ธ: โ๏ธ if ๐ฅพ
|
57
|
+
end
|
58
|
+
|
59
|
+
def ๐ ๐๏ธ, ๐, โ๏ธ: false
|
60
|
+
if โ๏ธ
|
61
|
+
๐ = โ๏ธ.encrypt_and_sign ๐
|
62
|
+
else
|
63
|
+
๐ = ๐
|
64
|
+
end
|
65
|
+
|
66
|
+
๐ = Marshal.dump ๐
|
67
|
+
File.write "./#{๐๏ธ}", ๐
|
68
|
+
return ๐
|
69
|
+
end
|
70
|
+
|
71
|
+
def ๐๏ธ ๐๏ธ, ๐, โ๏ธ: false
|
72
|
+
if @@๐๏ธ[๐๏ธ]
|
73
|
+
return @@๐๏ธ[๐๏ธ]
|
74
|
+
end
|
75
|
+
|
125
76
|
begin
|
126
|
-
|
127
|
-
rescue
|
128
|
-
|
77
|
+
๐ = File.read "./#{๐๏ธ}"
|
78
|
+
rescue Errno::ENOENT
|
79
|
+
๐ = ๐ ๐๏ธ, ๐, โ๏ธ: โ๏ธ
|
80
|
+
end
|
81
|
+
|
82
|
+
if not ๐.empty?
|
83
|
+
๐ = Marshal.load ๐
|
84
|
+
|
85
|
+
if โ๏ธ
|
86
|
+
begin
|
87
|
+
๐ = โ๏ธ.decrypt_and_verify ๐
|
88
|
+
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
89
|
+
puts โผ๏ธ๐
|
90
|
+
exit!
|
91
|
+
end
|
92
|
+
|
93
|
+
else
|
94
|
+
๐ = ๐
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
return @@๐๏ธ[๐๏ธ] = ๐
|
100
|
+
end
|
101
|
+
|
102
|
+
def ๐ค ๐ฃ๏ธ
|
103
|
+
๐พ, ๐ท๏ธ, ๐ = ๐ฃ๏ธ.split
|
104
|
+
|
105
|
+
if ๐พ.nil?
|
106
|
+
return
|
107
|
+
end
|
108
|
+
|
109
|
+
case ๐พ.to_sym
|
110
|
+
when :get
|
111
|
+
if ๐ท๏ธ
|
112
|
+
๐ ๐ท๏ธ: ๐ท๏ธ
|
113
|
+
else
|
114
|
+
๐
|
115
|
+
end
|
116
|
+
|
117
|
+
when :set
|
118
|
+
๐ ๐ท๏ธ, ๐
|
119
|
+
|
120
|
+
when :exit, :quit
|
129
121
|
exit!
|
122
|
+
|
123
|
+
when :help
|
124
|
+
puts "For help, quit and run `uhide -h` from your shell"
|
125
|
+
|
126
|
+
when :reset
|
127
|
+
if โ(@@๐, simple: false) == @@โ๏ธ
|
128
|
+
['ใฝ๏ธ', '๐ง', '๐'].each_entry { |item| File.delete "./#{item}" }
|
129
|
+
exit!
|
130
|
+
else
|
131
|
+
puts โผ๏ธ๐
|
132
|
+
end
|
133
|
+
|
134
|
+
else
|
135
|
+
puts โผ๏ธ๐พ
|
130
136
|
end
|
131
137
|
|
132
|
-
else
|
133
|
-
๐ = ๐
|
134
138
|
end
|
135
139
|
|
136
|
-
|
137
|
-
|
138
|
-
return $cache[๐๏ธ] = ๐
|
139
|
-
end
|
140
|
-
|
141
|
-
class Uhide::Main
|
142
|
-
class << self
|
143
|
-
def start()
|
140
|
+
def โ๏ธ
|
144
141
|
begin
|
145
|
-
โ
|
142
|
+
โ @@๐
|
146
143
|
|
147
144
|
๐พ
|
148
145
|
|
149
146
|
loop do
|
150
|
-
print
|
147
|
+
print @@โ
|
151
148
|
๐ค(๐งผ gets)
|
152
149
|
end
|
153
150
|
|
@@ -161,4 +158,3 @@ class Uhide::Main
|
|
161
158
|
end
|
162
159
|
|
163
160
|
end
|
164
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uhide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Keen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|