awsborn 0.3.6 → 0.3.7
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.
- data/VERSION +1 -1
- data/lib/awsborn/keychain.rb +12 -8
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.7
|
data/lib/awsborn/keychain.rb
CHANGED
@@ -16,19 +16,23 @@ module Awsborn
|
|
16
16
|
@unlocked = false
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def get (name)
|
20
20
|
unlock
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
password_line = find_generic_password(name)
|
22
|
+
if password_line.match(/^password: 0x/)
|
23
|
+
hex_dump = password_line[/password: 0x(\S+)/, 1]
|
24
|
+
text = decode_hex(hex_dump)
|
25
|
+
text = string_content(text) if multi_encoded?(text)
|
26
|
+
elsif password_line.match(/^password: "/)
|
27
|
+
text = password_line[/password: "(.+)"/, 1]
|
28
|
+
else
|
29
|
+
raise "Note '#{name}' not found in #{@keychain}"
|
30
|
+
end
|
24
31
|
text
|
25
32
|
end
|
26
33
|
|
27
34
|
def find_generic_password (name)
|
28
|
-
|
29
|
-
hex_dump = dump[/password: 0x(\S+)/, 1]
|
30
|
-
raise "Note '#{name}' not found in #{@keychain}" unless hex_dump
|
31
|
-
hex_dump
|
35
|
+
`security -q find-generic-password -s "#{name}" -g "#{@keychain}" 2>&1 1>/dev/null`
|
32
36
|
end
|
33
37
|
|
34
38
|
def decode_hex (hex_dump)
|