uhide 0.0.26 โ 0.0.31
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 -7
- data/lib/uhide/main.rb +128 -128
- 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: d467f5eb0557fdc3146bb3f7ef8052f00c4e8acfa70beae87ce51591d7aeba71
|
|
4
|
+
data.tar.gz: 328969e21fd19977fb3ea070d013c4da3635a6f69bb1c9f6ec451393e6daf473
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8b9a57a5f18e3fe0e0931a99cb04a35ca6869ce2ee1b74a67e8c730804ea42007dac2d35c0b2f26672e4def521f1c825414a306a2830d87ce4bb5b308b0fd9da
|
|
7
|
+
data.tar.gz: 4e64e833a13a5f0289bf8dc81bd6cd1a990b5afc75b1ff65564146ad1b195f4df46b6cd172e832035df9badde52a1c551223b97729382786ff9f272411f806de
|
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,7 +11,7 @@ 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:
|
|
@@ -26,4 +23,4 @@ Commands and Optional Arguments:
|
|
|
26
23
|
|
|
27
24
|
end.parse!
|
|
28
25
|
|
|
29
|
-
Uhide::Main
|
|
26
|
+
Uhide::Main.โ๏ธ
|
data/lib/uhide/main.rb
CHANGED
|
@@ -1,150 +1,151 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
$๐ง = -> { ๐๏ธ '๐ง', SecureRandom.random_bytes }
|
|
4
|
-
$๐ = -> { ๐๏ธ '๐', ActiveSupport::MessageEncryptor.key_len }
|
|
5
|
-
INVALID_KEY = 'invalid key'.colorize(:magenta)
|
|
6
|
-
UNSUPPORTED_๐พ = 'unsupported'.colorize(:magenta) + ' ๐พ'
|
|
7
|
-
$๐๏ธ = {}
|
|
1
|
+
$โผ๏ธ๐ = 'invalid key'.colorize(:magenta)
|
|
2
|
+
$โผ๏ธ๐พ = 'unsupported'.colorize(:magenta) + ' ๐พ'
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def ๐งผ ๐๏ธ
|
|
15
|
-
๐๏ธ.chomp
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def โ ๐, simple: true
|
|
19
|
-
print ๐
|
|
20
|
-
โ๏ธ = ๐งผ STDIN.noecho(&:gets)
|
|
21
|
-
$โ๏ธ = โ๏ธ if simple
|
|
22
|
-
๐ฝ
|
|
23
|
-
return โ๏ธ
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def ๐ ๐ท๏ธ: nil
|
|
27
|
-
if ๐ท๏ธ.nil?
|
|
28
|
-
puts $๐๏ธ['ddllv']
|
|
29
|
-
else
|
|
30
|
-
puts $๐๏ธ['ddllv'][๐ท๏ธ]
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
๐ = File.read './๐ง'
|
|
34
|
-
if ๐.empty?
|
|
35
|
-
๐ = SecureRandom.random_bytes $๐.call
|
|
36
|
-
File.write './๐ง', Marshal.dump(๐)
|
|
37
|
-
return $๐๏ธ['๐ง'] = ๐
|
|
38
|
-
else
|
|
39
|
-
return $๐๏ธ['๐ง'] = Marshal.load(File.read './๐ง')
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def ๐ ๐ท๏ธ, ๐
|
|
45
|
-
$๐๏ธ['ddllv'][๐ท๏ธ] = ๐
|
|
46
|
-
๐พ
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def ๐ค ๐ฃ๏ธ
|
|
50
|
-
๐พ, ๐ท๏ธ, ๐ = ๐ฃ๏ธ.split
|
|
51
|
-
|
|
52
|
-
if ๐พ.nil?
|
|
53
|
-
return
|
|
54
|
-
end
|
|
4
|
+
class Uhide::Main
|
|
5
|
+
@@โ = " โ > "
|
|
6
|
+
@@๐ = " ๐ > "
|
|
7
|
+
@@๐๏ธ = {}
|
|
55
8
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
๐ ๐ท๏ธ: ๐ท๏ธ
|
|
60
|
-
else
|
|
61
|
-
๐
|
|
9
|
+
class << self
|
|
10
|
+
def ๐ง
|
|
11
|
+
๐๏ธ '๐ง', SecureRandom.random_bytes
|
|
62
12
|
end
|
|
63
13
|
|
|
64
|
-
|
|
65
|
-
|
|
14
|
+
def ๐
|
|
15
|
+
๐๏ธ '๐', ActiveSupport::MessageEncryptor.key_len
|
|
16
|
+
end
|
|
66
17
|
|
|
67
|
-
|
|
68
|
-
|
|
18
|
+
def ๐ฝ
|
|
19
|
+
print "\r"
|
|
20
|
+
$stdout.flush
|
|
21
|
+
end
|
|
69
22
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
['ddllv', '๐ง', '๐'].each_entry{ |item| File.delete "./#{item}" }
|
|
73
|
-
exit!
|
|
74
|
-
else
|
|
75
|
-
puts INVALID_KEY
|
|
23
|
+
def ๐งผ ๐๏ธ
|
|
24
|
+
๐๏ธ.chomp
|
|
76
25
|
end
|
|
77
26
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
โ๏ธ = ActiveSupport::MessageEncryptor.new(
|
|
86
|
-
ActiveSupport::KeyGenerator.new($โ๏ธ).generate_key($๐ง.call, $๐.call)
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
was_bootstrapped = !(not $๐๏ธ['ddllv'])
|
|
90
|
-
๐ = ๐๏ธ 'ddllv', {}, โ๏ธ: โ๏ธ
|
|
91
|
-
๐ 'ddllv', ๐, โ๏ธ: โ๏ธ if was_bootstrapped
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def ๐ ๐๏ธ, ๐, โ๏ธ: false
|
|
95
|
-
if โ๏ธ
|
|
96
|
-
๐ = โ๏ธ.encrypt_and_sign ๐
|
|
97
|
-
else
|
|
98
|
-
๐ = ๐
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
๐ = Marshal.dump ๐
|
|
102
|
-
File.write "./#{๐๏ธ}", ๐
|
|
103
|
-
return ๐
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def ๐๏ธ ๐๏ธ, ๐, โ๏ธ: false
|
|
107
|
-
if $๐๏ธ[๐๏ธ]
|
|
108
|
-
return $๐๏ธ[๐๏ธ]
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
begin
|
|
112
|
-
๐ = File.read "./#{๐๏ธ}"
|
|
113
|
-
rescue Errno::ENOENT
|
|
114
|
-
๐ = ๐ ๐๏ธ, ๐, โ๏ธ: โ๏ธ
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
if not ๐.empty?
|
|
118
|
-
๐ = Marshal.load ๐
|
|
27
|
+
def โ ๐, simple: true
|
|
28
|
+
print ๐
|
|
29
|
+
โ๏ธ = ๐งผ STDIN.noecho(&:gets)
|
|
30
|
+
@@โ๏ธ = โ๏ธ if simple
|
|
31
|
+
๐ฝ
|
|
32
|
+
return โ๏ธ
|
|
33
|
+
end
|
|
119
34
|
|
|
120
|
-
|
|
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
|
+
|
|
121
76
|
begin
|
|
122
|
-
|
|
123
|
-
rescue
|
|
124
|
-
|
|
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
|
|
125
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 { | ๐ | File.delete "./#{๐}" }
|
|
129
|
+
exit!
|
|
130
|
+
else
|
|
131
|
+
puts $โผ๏ธ๐
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
else
|
|
135
|
+
puts $โผ๏ธ๐พ
|
|
126
136
|
end
|
|
127
137
|
|
|
128
|
-
else
|
|
129
|
-
๐ = ๐
|
|
130
138
|
end
|
|
131
139
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return $๐๏ธ[๐๏ธ] = ๐
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
class Uhide::Main
|
|
138
|
-
class << self
|
|
139
|
-
def start()
|
|
140
|
+
def โ๏ธ
|
|
140
141
|
begin
|
|
141
|
-
โ
|
|
142
|
+
โ @@๐
|
|
142
143
|
|
|
143
144
|
๐พ
|
|
144
145
|
|
|
145
146
|
loop do
|
|
146
|
-
print
|
|
147
|
-
๐ค
|
|
147
|
+
print @@โ
|
|
148
|
+
๐ค ๐งผ gets
|
|
148
149
|
end
|
|
149
150
|
|
|
150
151
|
rescue SystemExit, Interrupt
|
|
@@ -157,4 +158,3 @@ class Uhide::Main
|
|
|
157
158
|
end
|
|
158
159
|
|
|
159
160
|
end
|
|
160
|
-
|
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.31
|
|
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
|