rubeepass 1.0.6 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rpass +3 -1
  3. data/lib/rubeepass/entry.rb +37 -109
  4. metadata +16 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a23be2b3bb598095b6dcdd4fa3f1b10fc604748
4
- data.tar.gz: b28f86207bc3cacf7b53af4c07028b5edd01e0d3
3
+ metadata.gz: eb87ea45836dac08a8f7d0127dc31134e976e57f
4
+ data.tar.gz: 405356c08747438ffbb5c58203bbe631a98377a2
5
5
  SHA512:
6
- metadata.gz: 58872aac5c8e05220c3157d120e8e5889659e4ce68b2066d59cfa298cbbd46c65d625abcea1331d3a78905c872e1beeb1905f2a8672b3d421d6ffc9a1fa9e57e
7
- data.tar.gz: ba86990fadd0a959fb83a0cc9d21cdd4bd20db243b4e017001ee72cc74999bdcc132c0fde0769e3de8eec665df1969c0938f7fdabc541b5bca660144a863b236
6
+ metadata.gz: 72834f102e69ffca03cccec065741aef39f834558cb46014269b1386b80a41aa748140c1b4f3c905e63a038bea25fe8c2fb6f51efe551d23f5868821173781e0
7
+ data.tar.gz: 3ca9453d67fa6f66a07883e9dc665753d4db6261831b266963c6785de13ff7e77e8a282e4bb73ed2eefaac1f4841d741224bb3148e3ccdd1dde38926dd3a9a1f
data/bin/rpass CHANGED
@@ -251,7 +251,9 @@ begin
251
251
  end
252
252
 
253
253
  djinni = Djinni.new
254
- djinni.load_wishes("#{File.dirname(__FILE__)}/../lib/rubeepass/wish")
254
+ djinni.load_wishes(
255
+ "#{File.dirname(__FILE__)}/../lib/rubeepass/wish"
256
+ )
255
257
 
256
258
  if (options["command"])
257
259
  djinni.grant_wish(
@@ -6,7 +6,12 @@ class RubeePass::Entry
6
6
 
7
7
  attr_accessor :group
8
8
  attr_accessor :keepass
9
+ attr_accessor :notes
10
+ attr_accessor :password
9
11
  attr_accessor :path
12
+ attr_accessor :title
13
+ attr_accessor :url
14
+ attr_accessor :username
10
15
  attr_accessor :uuid
11
16
 
12
17
  def ==(other)
@@ -26,7 +31,7 @@ class RubeePass::Entry
26
31
  ret.push("#{lvl}Username : #{@username}")
27
32
  if (show_passwd)
28
33
  ret.push(
29
- hilight_password("#{lvl}Password : #{password}")
34
+ hilight_password("#{lvl}Password : #{@password}")
30
35
  )
31
36
  end
32
37
  ret.push("#{lvl}Url : #{@url}")
@@ -45,53 +50,17 @@ class RubeePass::Entry
45
50
  end
46
51
 
47
52
  def self.from_xml(keepass, parent, xml)
48
- notes = ""
49
- password = ""
50
- title = ""
51
- url = ""
52
- username = ""
53
+ attrs = Hash.new
53
54
 
54
- uuid = xml.elements["UUID"].text
55
- uuid = "" if (uuid.nil?)
55
+ uuid = xml.elements["UUID"].text || ""
56
56
 
57
57
  xml.elements.each("String") do |elem|
58
+ key = elem.elements["Key"].text
58
59
  value = elem.elements["Value"]
59
- case elem.elements["Key"].text
60
- when "Notes"
61
- if (value.attributes["Protected"] == "True")
62
- notes = handle_protected(keepass, value.text)
63
- else
64
- notes = value.text
65
- notes = "" if (notes.nil?)
66
- end
67
- when "Password"
68
- if (value.attributes["Protected"] == "True")
69
- password = handle_protected(keepass, value.text)
70
- else
71
- password = value.text
72
- password = "" if (password.nil?)
73
- end
74
- when "Title"
75
- if (value.attributes["Protected"] == "True")
76
- title = handle_protected(keepass, value.text)
77
- else
78
- title = value.text
79
- title = "" if (title.nil?)
80
- end
81
- when "URL"
82
- if (value.attributes["Protected"] == "True")
83
- url = handle_protected(keepass, value.text)
84
- else
85
- url = value.text
86
- url = "" if (url.nil?)
87
- end
88
- when "UserName"
89
- if (value.attributes["Protected"] == "True")
90
- username = handle_protected(keepass, value.text)
91
- else
92
- username = value.text
93
- username = "" if (username.nil?)
94
- end
60
+
61
+ attrs[key] = value.text || ""
62
+ if (value.attributes["Protected"] == "True")
63
+ attrs[key] = handle_protected(keepass, value.text)
95
64
  end
96
65
  end
97
66
 
@@ -102,16 +71,7 @@ class RubeePass::Entry
102
71
  end
103
72
  end
104
73
 
105
- return RubeePass::Entry.new(
106
- parent,
107
- keepass,
108
- notes,
109
- password,
110
- title,
111
- url,
112
- username,
113
- uuid
114
- )
74
+ return RubeePass::Entry.new(parent, keepass, attrs, uuid)
115
75
  end
116
76
 
117
77
  def self.handle_protected(keepass, base64)
@@ -142,23 +102,17 @@ class RubeePass::Entry
142
102
  end
143
103
  private :hilight_title
144
104
 
145
- def initialize(
146
- group,
147
- keepass,
148
- notes,
149
- password,
150
- title,
151
- url,
152
- username,
153
- uuid
154
- )
105
+ def initialize(group, keepass, attributes, uuid)
155
106
  @group = group
156
107
  @keepass = keepass
157
- @notes = notes
158
- @password = password
159
- @title = title
160
- @url = url
161
- @username = username
108
+ @attributes = attributes
109
+
110
+ @notes = attribute("Notes")
111
+ @password = attribute("Password")
112
+ @title = attribute("Title")
113
+ @url = attribute("URL")
114
+ @username = attribute("UserName")
115
+
162
116
  @uuid = uuid
163
117
 
164
118
  @path = @title
@@ -176,7 +130,7 @@ class RubeePass::Entry
176
130
  )
177
131
  case method_name
178
132
  when "password"
179
- @keepass.copy_to_clipboard(password)
133
+ @keepass.copy_to_clipboard(@password)
180
134
  when "url"
181
135
  @keepass.copy_to_clipboard(@url)
182
136
  when "username"
@@ -187,7 +141,7 @@ class RubeePass::Entry
187
141
  elsif (method_name.match(/^echo_.+$/))
188
142
  case method_name.to_s.gsub(/^echo_/, "")
189
143
  when "password"
190
- puts password
144
+ puts @password
191
145
  when "url"
192
146
  puts @url
193
147
  when "username"
@@ -200,58 +154,32 @@ class RubeePass::Entry
200
154
  end
201
155
  end
202
156
 
203
- def notes
204
- return nil if (@keepass.nil?)
205
- return "" if (@notes.nil?)
206
- begin
207
- return @keepass.protected_decryptor.get_password(@notes)
208
- rescue
209
- return @notes
210
- end
157
+ def has_attribute?(attr)
158
+ !@attributes[attr].nil?
211
159
  end
212
160
 
213
- def password
161
+ def attribute(attr)
214
162
  return nil if (@keepass.nil?)
215
- return "" if (@password.nil?)
163
+ return "" unless (has_attribute?(attr))
164
+
216
165
  begin
217
166
  return @keepass.protected_decryptor.get_password(
218
- @password
167
+ @attributes[attr]
219
168
  )
220
169
  rescue
221
- return @password
170
+ return @attributes[attr]
222
171
  end
223
172
  end
224
173
 
225
- def title
174
+ def attributes
226
175
  return nil if (@keepass.nil?)
227
- return "" if (@title.nil?)
228
- begin
229
- return @keepass.protected_decryptor.get_password(@title)
230
- rescue
231
- return @title
232
- end
233
- end
234
176
 
235
- def url
236
- return nil if (@keepass.nil?)
237
- return "" if (@url.nil?)
238
- begin
239
- return @keepass.protected_decryptor.get_password(@url)
240
- rescue
241
- return @url
177
+ attributes = {}
178
+ @attributes.each do |key, value|
179
+ attributes[key] = attribute(key)
242
180
  end
243
- end
244
181
 
245
- def username
246
- return nil if (@keepass.nil?)
247
- return "" if (@username.nil?)
248
- begin
249
- return @keepass.protected_decryptor.get_password(
250
- @username
251
- )
252
- rescue
253
- return @username
254
- end
182
+ return attributes
255
183
  end
256
184
 
257
185
  def to_s
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.0.6
4
+ version: 1.1.0
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-03-04 00:00:00.000000000 Z
11
+ date: 2017-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.9'
19
+ version: '5.10'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 5.9.1
22
+ version: 5.10.1
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '5.9'
29
+ version: '5.10'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 5.9.1
32
+ version: 5.10.1
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '11.3'
39
+ version: '12.0'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 11.3.0
42
+ version: 12.0.0
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '11.3'
49
+ version: '12.0'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 11.3.0
52
+ version: 12.0.0
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: djinni
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '2.0'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 2.0.1
62
+ version: 2.0.2
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: '2.0'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 2.0.1
72
+ version: 2.0.2
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: hilighter
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -116,20 +116,20 @@ dependencies:
116
116
  requirements:
117
117
  - - "~>"
118
118
  - !ruby/object:Gem::Version
119
- version: '0.9'
119
+ version: '1.0'
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: 0.9.6
122
+ version: 1.0.0
123
123
  type: :runtime
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: '0.9'
129
+ version: '1.0'
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: 0.9.6
132
+ version: 1.0.0
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: salsa20
135
135
  requirement: !ruby/object:Gem::Requirement