uhide 0.0.21 → 0.0.26
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/bin/uhide +0 -1
- data/lib/uhide/main.rb +29 -26
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4a06d744fe8a6c1f74e8fd848e74af96ba37d5c377ee3d6b33599f0d38d30c1
|
4
|
+
data.tar.gz: 94cf1b71fbe3255fa896e25a53fd474e0bdb0e69677a6ef644944972cc452f0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d6f4416ab7af95df3e132b6651408be6d684847fc2b3740d44e89f28ca717959af688c8043c33782e4fe2dc2142d41121da0bd7f05bb93da47d8bf396fad2da
|
7
|
+
data.tar.gz: fb0c709b806ce2cef94508141e21dd062c845db86886657ea63e7a4572431bc962126c7d4f3873ec76cf677d594c28930b49dcaa41697e1362ed4ba99bac8d19
|
data/bin/uhide
CHANGED
data/lib/uhide/main.rb
CHANGED
@@ -2,56 +2,57 @@ $☔ = " ☔ > "
|
|
2
2
|
$🔑 = " 🔑 > "
|
3
3
|
$🧂 = -> { 🗃️ '🧂', SecureRandom.random_bytes }
|
4
4
|
$📏 = -> { 🗃️ '📏', ActiveSupport::MessageEncryptor.key_len }
|
5
|
-
INVALID_KEY = 'invalid key'.colorize(:
|
6
|
-
|
7
|
-
|
8
|
-
def password?
|
9
|
-
🧼 STDIN.noecho(&:gets)
|
10
|
-
end
|
5
|
+
INVALID_KEY = 'invalid key'.colorize(:magenta)
|
6
|
+
UNSUPPORTED_👾 = 'unsupported'.colorize(:magenta) + ' 👾'
|
7
|
+
$🗄️ = {}
|
11
8
|
|
12
9
|
def 🚽
|
13
10
|
print "\r"
|
14
11
|
$stdout.flush
|
15
12
|
end
|
16
13
|
|
14
|
+
def 🧼 🗑️
|
15
|
+
🗑️.chomp
|
16
|
+
end
|
17
|
+
|
17
18
|
def ❓ 🔑, simple: true
|
18
19
|
print 🔑
|
19
|
-
|
20
|
-
|
20
|
+
✍️ = 🧼 STDIN.noecho(&:gets)
|
21
|
+
$✍️ = ✍️ if simple
|
21
22
|
🚽
|
22
|
-
return
|
23
|
-
end
|
24
|
-
|
25
|
-
def 🧼 🗑️
|
26
|
-
🗑️.chomp
|
23
|
+
return ✍️
|
27
24
|
end
|
28
25
|
|
29
26
|
def 🔓 🏷️: nil
|
30
27
|
if 🏷️.nil?
|
31
|
-
puts
|
28
|
+
puts $🗄️['ddllv']
|
32
29
|
else
|
33
|
-
puts
|
30
|
+
puts $🗄️['ddllv'][🏷️]
|
34
31
|
end
|
35
32
|
|
36
33
|
📕 = File.read './🧂'
|
37
34
|
if 📕.empty?
|
38
35
|
🔀 = SecureRandom.random_bytes $📏.call
|
39
36
|
File.write './🧂', Marshal.dump(🔀)
|
40
|
-
return
|
37
|
+
return $🗄️['🧂'] = 🔀
|
41
38
|
else
|
42
|
-
return
|
39
|
+
return $🗄️['🧂'] = Marshal.load(File.read './🧂')
|
43
40
|
end
|
44
41
|
|
45
42
|
end
|
46
43
|
|
47
44
|
def 🔒 🏷️, 💎
|
48
|
-
|
45
|
+
$🗄️['ddllv'][🏷️] = 💎
|
49
46
|
💾
|
50
47
|
end
|
51
48
|
|
52
49
|
def 🤖 🗣️
|
53
50
|
👾, 🏷️, 💎 = 🗣️.split
|
54
51
|
|
52
|
+
if 👾.nil?
|
53
|
+
return
|
54
|
+
end
|
55
|
+
|
55
56
|
case 👾.to_sym
|
56
57
|
when :get
|
57
58
|
if 🏷️
|
@@ -67,23 +68,25 @@ def 🤖 🗣️
|
|
67
68
|
exit!
|
68
69
|
|
69
70
|
when :reset
|
70
|
-
if ❓($🔑, simple: false) ==
|
71
|
+
if ❓($🔑, simple: false) == $✍️
|
71
72
|
['ddllv', '🧂', '📏'].each_entry{ |item| File.delete "./#{item}" }
|
72
73
|
exit!
|
73
74
|
else
|
74
75
|
puts INVALID_KEY
|
75
76
|
end
|
76
77
|
|
78
|
+
else
|
79
|
+
puts UNSUPPORTED_👾
|
77
80
|
end
|
78
81
|
|
79
82
|
end
|
80
83
|
|
81
84
|
def 💾
|
82
85
|
⚛️ = ActiveSupport::MessageEncryptor.new(
|
83
|
-
ActiveSupport::KeyGenerator.new(
|
86
|
+
ActiveSupport::KeyGenerator.new($✍️).generate_key($🧂.call, $📏.call)
|
84
87
|
)
|
85
88
|
|
86
|
-
was_bootstrapped = !(not
|
89
|
+
was_bootstrapped = !(not $🗄️['ddllv'])
|
87
90
|
📖 = 🗃️ 'ddllv', {}, ⚛️: ⚛️
|
88
91
|
📀 'ddllv', 📖, ⚛️: ⚛️ if was_bootstrapped
|
89
92
|
end
|
@@ -100,15 +103,15 @@ def 📀 🗂️, 📖, ⚛️: false
|
|
100
103
|
return 📕
|
101
104
|
end
|
102
105
|
|
103
|
-
def 🗃️ 🗂️,
|
104
|
-
if
|
105
|
-
return
|
106
|
+
def 🗃️ 🗂️, 💎, ⚛️: false
|
107
|
+
if $🗄️[🗂️]
|
108
|
+
return $🗄️[🗂️]
|
106
109
|
end
|
107
110
|
|
108
111
|
begin
|
109
112
|
📕 = File.read "./#{🗂️}"
|
110
113
|
rescue Errno::ENOENT
|
111
|
-
📕 = 📀 🗂️,
|
114
|
+
📕 = 📀 🗂️, 💎, ⚛️: ⚛️
|
112
115
|
end
|
113
116
|
|
114
117
|
if not 📕.empty?
|
@@ -128,7 +131,7 @@ def 🗃️ 🗂️, 🔀, ⚛️: false
|
|
128
131
|
|
129
132
|
end
|
130
133
|
|
131
|
-
return
|
134
|
+
return $🗄️[🗂️] = 📖
|
132
135
|
end
|
133
136
|
|
134
137
|
class Uhide::Main
|