rubeepass 1.1.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb87ea45836dac08a8f7d0127dc31134e976e57f
4
- data.tar.gz: 405356c08747438ffbb5c58203bbe631a98377a2
3
+ metadata.gz: 5945c73082ac80abb126641064d1adc6ff1b08d1
4
+ data.tar.gz: 387b03a273731daf0330dbdc2419494c22c66b46
5
5
  SHA512:
6
- metadata.gz: 72834f102e69ffca03cccec065741aef39f834558cb46014269b1386b80a41aa748140c1b4f3c905e63a038bea25fe8c2fb6f51efe551d23f5868821173781e0
7
- data.tar.gz: 3ca9453d67fa6f66a07883e9dc665753d4db6261831b266963c6785de13ff7e77e8a282e4bb73ed2eefaac1f4841d741224bb3148e3ccdd1dde38926dd3a9a1f
6
+ metadata.gz: b5d068702f0b3d5bbe09ec040434f6c52a947c995b1d62fa2580f894497b9184c1b842467c05c4297345b164078e19d298b69273af90133e8f71a608af692539
7
+ data.tar.gz: 714026548c9412fa21ea26f97dca37462a94d596041d432b4424757b351843372aa9617ce8ac18373593013142e76010d441b984eb45bc290c406ed9bf515ef5
@@ -22,6 +22,36 @@ class RubeePass::Entry
22
22
  return (self.title.downcase <=> other.title.downcase)
23
23
  end
24
24
 
25
+ def additional_attributes
26
+ return attributes.select do |key, value|
27
+ key.match(/^(Notes|Password|Title|URL|UserName)$/).nil?
28
+ end
29
+ end
30
+
31
+ def attribute(attr)
32
+ return nil if (@keepass.nil?)
33
+ return "" if (!has_attribute?(attr))
34
+
35
+ begin
36
+ return @keepass.protected_decryptor.decrypt(
37
+ @attributes[attr]
38
+ )
39
+ rescue
40
+ return @attributes[attr]
41
+ end
42
+ end
43
+
44
+ def attributes
45
+ return nil if (@keepass.nil?)
46
+
47
+ attrs = Hash.new
48
+ @attributes.each do |key, value|
49
+ attrs[key] = attribute(key)
50
+ end
51
+
52
+ return attrs
53
+ end
54
+
25
55
  def details(level = 0, show_passwd = false)
26
56
  lvl = Array.new(level, " ").join
27
57
 
@@ -75,8 +105,9 @@ class RubeePass::Entry
75
105
  end
76
106
 
77
107
  def self.handle_protected(keepass, base64)
78
- data = nil
79
108
  return nil if (base64.nil?)
109
+
110
+ data = nil
80
111
  begin
81
112
  data = base64.unpack("m*")[0]
82
113
  if (data.length != data.bytesize)
@@ -90,6 +121,10 @@ class RubeePass::Entry
90
121
  return keepass.protected_decryptor.add_to_stream(data)
91
122
  end
92
123
 
124
+ def has_attribute?(attr)
125
+ return !@attributes[attr].nil?
126
+ end
127
+
93
128
  def hilight_password(passwd)
94
129
  return passwd if (!RubeePass.hilight?)
95
130
  return passwd.light_red
@@ -154,34 +189,6 @@ class RubeePass::Entry
154
189
  end
155
190
  end
156
191
 
157
- def has_attribute?(attr)
158
- !@attributes[attr].nil?
159
- end
160
-
161
- def attribute(attr)
162
- return nil if (@keepass.nil?)
163
- return "" unless (has_attribute?(attr))
164
-
165
- begin
166
- return @keepass.protected_decryptor.get_password(
167
- @attributes[attr]
168
- )
169
- rescue
170
- return @attributes[attr]
171
- end
172
- end
173
-
174
- def attributes
175
- return nil if (@keepass.nil?)
176
-
177
- attributes = {}
178
- @attributes.each do |key, value|
179
- attributes[key] = attribute(key)
180
- end
181
-
182
- return attributes
183
- end
184
-
185
192
  def to_s
186
193
  return details
187
194
  end
@@ -6,7 +6,7 @@ class RubeePass::ProtectedDecryptor
6
6
  return (@ciphertext.length - 1)
7
7
  end
8
8
 
9
- def get_password(index)
9
+ def decrypt(index)
10
10
  return nil if (@iv.nil? || @key.nil?)
11
11
  return nil if ((index < 0) || (index >= @ciphertext.length))
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubeepass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-10 00:00:00.000000000 Z
11
+ date: 2017-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubyforge_project:
224
- rubygems_version: 2.4.5.1
224
+ rubygems_version: 2.6.8
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: Ruby KeePass 2.x implementation