Top Level Namespace
Defined Under Namespace
Modules: Uhide
Constant Summary collapse
- INVALID_KEY =
'invalid key'.colorize(:red)
Instance Method Summary collapse
- #password? ⇒ Boolean
- #❓(🔑, simple: true) ⇒ Object
- #💾 ⇒ Object
- #📀(🗂️, 📖, ⚛️: false) ⇒ Object
- #🔒(🏷️, 💎) ⇒ Object
- #🔓(🏷️: nil) ⇒ Object
- #🗃️(🗂️, 🔀, ⚛️: false) ⇒ Object
- #🚽 ⇒ Object
- #🤖(🗣️) ⇒ Object
- #🧼(🗑️) ⇒ Object
Instance Method Details
#password? ⇒ Boolean
8 9 10 |
# File 'lib/uhide/main.rb', line 8 def password? 🧼 STDIN.noecho(&:gets) end |
#❓(🔑, simple: true) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/uhide/main.rb', line 17 def ❓ 🔑, simple: true print 🔑 password = password? $password = password if simple 🚽 return password end |
#💾 ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'lib/uhide/main.rb', line 78 def 💾 ⚛️ = ActiveSupport::MessageEncryptor.new( ActiveSupport::KeyGenerator.new($password).generate_key($🧂.call, $📏.call) ) was_bootstrapped = !(not $cache['ddllv']) 📖 = 🗃️ 'ddllv', {}, ⚛️: ⚛️ 📀 'ddllv', 📖, ⚛️: ⚛️ if was_bootstrapped end |
#📀(🗂️, 📖, ⚛️: false) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/uhide/main.rb', line 88 def 📀 🗂️, 📖, ⚛️: false if ⚛️ 📕 = ⚛️.encrypt_and_sign 📖 else 📕 = 📖 end 📕 = Marshal.dump(📕) File.write "./#{🗂️}", 📕 return 📕 end |
#🔒(🏷️, 💎) ⇒ Object
47 48 49 50 |
# File 'lib/uhide/main.rb', line 47 def 🔒 🏷️, 💎 $cache['ddllv'][🏷️] = 💎 💾 end |
#🔓(🏷️: nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/uhide/main.rb', line 29 def 🔓 🏷️: nil if 🏷️.nil? puts $cache['ddllv'] else puts $cache['ddllv'][🏷️] end 📕 = File.read './🧂' if 📕.empty? 🔀 = SecureRandom.random_bytes $📏.call File.write './🧂', Marshal.dump(🔀) return $cache['🧂'] = 🔀 else return $cache['🧂'] = Marshal.load(File.read './🧂') end end |
#🗃️(🗂️, 🔀, ⚛️: false) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/uhide/main.rb', line 100 def 🗃️ 🗂️, 🔀, ⚛️: false if $cache[🗂️] return $cache[🗂️] end begin 📕 = File.read "./#{🗂️}" rescue Errno::ENOENT 📕 = 📀 🗂️, 🔀, ⚛️: ⚛️ end if not 📕.empty? 📕 = Marshal.load 📕 if ⚛️ begin 📖 = ⚛️.decrypt_and_verify 📕 rescue ActiveSupport::MessageVerifier::InvalidSignature puts INVALID_KEY exit! end else 📖 = 📕 end end return $cache[🗂️] = 📖 end |
#🚽 ⇒ Object
12 13 14 15 |
# File 'lib/uhide/main.rb', line 12 def 🚽 print "\r" $stdout.flush end |
#🤖(🗣️) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/uhide/main.rb', line 52 def 🤖 🗣️ 👾, 🏷️, 💎 = 🗣️.split case 👾.to_sym when :get if 🏷️ 🔓 🏷️: 🏷️ else 🔓 end when :set 🔒 🏷️, 💎 when :reset if ❓($🔑, simple: false) == $password ['ddllv', '🧂', '📏'].each_entry{ |item| File.delete "./#{item}" } exit! else puts INVALID_KEY end end end |
#🧼(🗑️) ⇒ Object
25 26 27 |
# File 'lib/uhide/main.rb', line 25 def 🧼 🗑️ 🗑️.chomp end |