metasploit-credential 0.7.8-java → 0.7.10-java

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.
@@ -208,6 +208,19 @@ describe Metasploit::Credential::Core do
208
208
 
209
209
  end
210
210
 
211
+ context 'search' do
212
+ let(:base_class) {
213
+ described_class
214
+ }
215
+
216
+ context 'associations' do
217
+ it_should_behave_like 'search_association', :logins
218
+ it_should_behave_like 'search_association', :private
219
+ it_should_behave_like 'search_association', :public
220
+ it_should_behave_like 'search_association', :realm
221
+ end
222
+ end
223
+
211
224
  context 'factories' do
212
225
  context 'metasploit_credential_core' do
213
226
  subject(:metasploit_credential_core) do
@@ -20,6 +20,270 @@ describe MetasploitDataModels::Search::Visitor::Relation do
20
20
  }
21
21
 
22
22
  context 'MetasploitDataModels::Search::Visitor::Relation#query Metasploit::Model::Search::Query#klass' do
23
+ context 'with Metasploit::Credential::Core' do
24
+ include_context 'Mdm::Workspace'
25
+
26
+ #
27
+ # Shared Examples
28
+ #
29
+
30
+ shared_examples 'Metasploit::Credential::Private' do |options={}|
31
+ options.assert_valid_keys(:name, :factory)
32
+
33
+ subclass_factory = options.fetch(:factory)
34
+ subclass_name = options.fetch(:name)
35
+
36
+ context subclass_name do
37
+ let(:private_factory) {
38
+ subclass_factory
39
+ }
40
+
41
+ it_should_behave_like 'MetasploitDataModels::Search::Visitor::Relation#visit matching record',
42
+ association: :private,
43
+ attribute: :data
44
+
45
+ context 'with all operators' do
46
+ let(:formatted) {
47
+ %Q{
48
+ logins.access_level:"#{matching_login_access_level}"
49
+ logins.status:"#{matching_login_status}"
50
+ private.data:"#{matching_private_data}"
51
+ public.username:"#{matching_public_username}"
52
+ realm.key:"#{matching_realm_key}"
53
+ realm.value:"#{matching_realm_value}"
54
+ }
55
+ }
56
+
57
+ it 'finds only matching record' do
58
+ expect(visit).to match_array([matching_record])
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ #
65
+ # lets
66
+ #
67
+
68
+ let(:klass) {
69
+ Metasploit::Credential::Core
70
+ }
71
+
72
+ let(:matching_login_access_level) {
73
+ 'Administrator'
74
+ }
75
+
76
+ let(:matching_login_status) {
77
+ Metasploit::Model::Login::Status::LOCKED_OUT
78
+ }
79
+
80
+ let(:matching_private) {
81
+ FactoryGirl.create(
82
+ private_factory,
83
+ matching_private_attributes
84
+ )
85
+ }
86
+
87
+ let(:matching_private_attributes) {
88
+ {}
89
+ }
90
+
91
+ let(:matching_private_data) {
92
+ matching_private.data
93
+ }
94
+
95
+ let(:matching_public) {
96
+ FactoryGirl.create(
97
+ :metasploit_credential_public,
98
+ username: matching_public_username
99
+ )
100
+ }
101
+
102
+ let(:matching_public_username) {
103
+ 'root'
104
+ }
105
+
106
+ let(:matching_realm) {
107
+ FactoryGirl.create(
108
+ :metasploit_credential_realm,
109
+ key: matching_realm_key,
110
+ value: matching_realm_value
111
+ )
112
+ }
113
+
114
+ let(:matching_realm_key) {
115
+ Metasploit::Model::Realm::Key::POSTGRESQL_DATABASE
116
+ }
117
+
118
+ let(:matching_realm_value) {
119
+ 'postgres'
120
+ }
121
+
122
+ let(:non_matching_login_access_level) {
123
+ 'normal'
124
+ }
125
+
126
+ let(:non_matching_login_status) {
127
+ Metasploit::Model::Login::Status::SUCCESSFUL
128
+ }
129
+
130
+ let(:non_matching_private) {
131
+ FactoryGirl.create(
132
+ private_factory,
133
+ non_matching_private_attributes
134
+ )
135
+ }
136
+
137
+ let(:non_matching_private_attributes) {
138
+ {}
139
+ }
140
+
141
+ let(:non_matching_public) {
142
+ FactoryGirl.create(
143
+ :metasploit_credential_public,
144
+ username: non_matching_public_username
145
+ )
146
+ }
147
+
148
+ let(:non_matching_public_username) {
149
+ 'guest'
150
+ }
151
+
152
+ let(:non_matching_realm) {
153
+ FactoryGirl.create(
154
+ :metasploit_credential_realm,
155
+ key: non_matching_realm_key,
156
+ value: non_matching_realm_value
157
+ )
158
+ }
159
+
160
+ let(:non_matching_realm_key) {
161
+ Metasploit::Model::Realm::Key::ACTIVE_DIRECTORY_DOMAIN
162
+ }
163
+
164
+ let(:non_matching_realm_value) {
165
+ 'DOMAIN'
166
+ }
167
+
168
+ let(:private_factory) {
169
+ [
170
+ :metasploit_credential_nonreplayable_hash,
171
+ :metasploit_credential_ntlm_hash,
172
+ :metasploit_credential_password,
173
+ :metasploit_credential_ssh_key
174
+ ].sample
175
+ }
176
+
177
+ #
178
+ # let!s
179
+ #
180
+
181
+ let!(:matching_login) {
182
+ FactoryGirl.create(
183
+ :metasploit_credential_login,
184
+ access_level: matching_login_access_level,
185
+ core: matching_record,
186
+ status: matching_login_status
187
+ )
188
+ }
189
+
190
+ let!(:matching_record) {
191
+ FactoryGirl.create(
192
+ :metasploit_credential_core,
193
+ private: matching_private,
194
+ public: matching_public,
195
+ realm: matching_realm
196
+ )
197
+ }
198
+
199
+ let!(:non_matching_login) {
200
+ FactoryGirl.create(
201
+ :metasploit_credential_login,
202
+ access_level: non_matching_login_access_level,
203
+ core: non_matching_record,
204
+ status: non_matching_login_status
205
+ )
206
+ }
207
+
208
+ let!(:non_matching_record) {
209
+ FactoryGirl.create(
210
+ :metasploit_credential_core,
211
+ private: non_matching_private,
212
+ public: non_matching_public,
213
+ realm: non_matching_realm
214
+ )
215
+ }
216
+
217
+ it_should_behave_like 'MetasploitDataModels::Search::Visitor::Relation#visit matching record',
218
+ association: :logins,
219
+ attribute: :access_level
220
+
221
+ it_should_behave_like 'MetasploitDataModels::Search::Visitor::Relation#visit matching record',
222
+ association: :logins,
223
+ attribute: :status
224
+
225
+ it_should_behave_like 'MetasploitDataModels::Search::Visitor::Relation#visit matching record',
226
+ association: :public,
227
+ attribute: :username
228
+
229
+ it_should_behave_like 'MetasploitDataModels::Search::Visitor::Relation#visit matching record',
230
+ association: :realm,
231
+ attribute: :key
232
+
233
+ it_should_behave_like 'MetasploitDataModels::Search::Visitor::Relation#visit matching record',
234
+ association: :realm,
235
+ attribute: :value
236
+
237
+ context 'wth Metasploit::Credential::PasswordHash' do
238
+
239
+ #
240
+ # lets
241
+ #
242
+
243
+ let(:matching_private_attributes) {
244
+ {
245
+ password_data: '123456789'
246
+ }
247
+ }
248
+
249
+ let(:non_matching_private_attributes) {
250
+ {
251
+ password_data: 'password'
252
+ }
253
+ }
254
+
255
+ it_should_behave_like 'Metasploit::Credential::Private',
256
+ factory: :metasploit_credential_nonreplayable_hash,
257
+ name: 'Metasploit::Credential::NonreplayableHash'
258
+
259
+
260
+ it_should_behave_like 'Metasploit::Credential::Private',
261
+ factory: :metasploit_credential_ntlm_hash,
262
+ name: 'Metasploit::Credential::NTLMHash'
263
+ end
264
+
265
+ it_should_behave_like 'Metasploit::Credential::Private',
266
+ factory: :metasploit_credential_password,
267
+ name: 'Metasploit::Credential::Password' do
268
+ let(:matching_attributes) {
269
+ {
270
+ data: '123456789'
271
+ }
272
+ }
273
+
274
+ let(:non_matching_attributes) {
275
+ {
276
+ # needs to not be a substring alias of matching_attributes[:password_data]
277
+ data: 'password'
278
+ }
279
+ }
280
+ end
281
+
282
+ it_should_behave_like 'Metasploit::Credential::Private',
283
+ factory: :metasploit_credential_ssh_key,
284
+ name: 'Metasploit::Credental::SSHKey'
285
+ end
286
+
23
287
  context 'with Metasploit::Credential::Login' do
24
288
  include_context 'Mdm::Workspace'
25
289
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit-credential
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.7.10
5
5
  platform: java
6
6
  authors:
7
7
  - Luke Imhoff
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-21 00:00:00.000000000 Z
12
+ date: 2014-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: metasploit-concern
@@ -29,18 +29,12 @@ dependencies:
29
29
  name: metasploit_data_models
30
30
  version_requirements: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
33
- - !ruby/object:Gem::Version
34
- version: 0.18.0.pre.compatibility
35
- - - <
32
+ - - ~>
36
33
  - !ruby/object:Gem::Version
37
34
  version: '0.19'
38
35
  requirement: !ruby/object:Gem::Requirement
39
36
  requirements:
40
- - - '>='
41
- - !ruby/object:Gem::Version
42
- version: 0.18.0.pre.compatibility
43
- - - <
37
+ - - ~>
44
38
  - !ruby/object:Gem::Version
45
39
  version: '0.19'
46
40
  prerelease: false