metasploit-model 0.28.0 → 0.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +3 -1
  3. data/config/locales/en.yml +0 -171
  4. data/lib/metasploit/model.rb +0 -2
  5. data/lib/metasploit/model/spec.rb +0 -130
  6. data/lib/metasploit/model/version.rb +1 -1
  7. data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +4 -6
  8. data/spec/support/shared/examples/metasploit/model/translation.rb +1 -1
  9. data/spec/support/shared/examples/search_association.rb +1 -1
  10. data/spec/support/shared/examples/search_with.rb +4 -2
  11. metadata +3 -349
  12. data/app/models/metasploit/model/module/ancestor/spec/template.rb +0 -125
  13. data/app/models/metasploit/model/module/class/spec/template.rb +0 -92
  14. data/app/models/metasploit/model/module/instance/spec/template.rb +0 -97
  15. data/app/models/metasploit/model/spec/template.rb +0 -277
  16. data/app/validators/derivation_validator.rb +0 -17
  17. data/app/validators/dynamic_length_validator.rb +0 -45
  18. data/lib/metasploit/model/architecture.rb +0 -342
  19. data/lib/metasploit/model/author.rb +0 -54
  20. data/lib/metasploit/model/authority.rb +0 -141
  21. data/lib/metasploit/model/authority/bid.rb +0 -10
  22. data/lib/metasploit/model/authority/cve.rb +0 -10
  23. data/lib/metasploit/model/authority/msb.rb +0 -10
  24. data/lib/metasploit/model/authority/osvdb.rb +0 -10
  25. data/lib/metasploit/model/authority/pmasa.rb +0 -10
  26. data/lib/metasploit/model/authority/secunia.rb +0 -10
  27. data/lib/metasploit/model/authority/us_cert_vu.rb +0 -10
  28. data/lib/metasploit/model/authority/waraxe.rb +0 -31
  29. data/lib/metasploit/model/authority/zdi.rb +0 -10
  30. data/lib/metasploit/model/derivation.rb +0 -109
  31. data/lib/metasploit/model/derivation/full_name.rb +0 -19
  32. data/lib/metasploit/model/email_address.rb +0 -124
  33. data/lib/metasploit/model/module.rb +0 -20
  34. data/lib/metasploit/model/module/action.rb +0 -52
  35. data/lib/metasploit/model/module/ancestor.rb +0 -491
  36. data/lib/metasploit/model/module/ancestor/spec.rb +0 -6
  37. data/lib/metasploit/model/module/architecture.rb +0 -34
  38. data/lib/metasploit/model/module/author.rb +0 -40
  39. data/lib/metasploit/model/module/class.rb +0 -403
  40. data/lib/metasploit/model/module/class/spec.rb +0 -6
  41. data/lib/metasploit/model/module/handler.rb +0 -29
  42. data/lib/metasploit/model/module/instance.rb +0 -622
  43. data/lib/metasploit/model/module/instance/spec.rb +0 -6
  44. data/lib/metasploit/model/module/path.rb +0 -159
  45. data/lib/metasploit/model/module/platform.rb +0 -32
  46. data/lib/metasploit/model/module/rank.rb +0 -85
  47. data/lib/metasploit/model/module/reference.rb +0 -32
  48. data/lib/metasploit/model/module/stance.rb +0 -16
  49. data/lib/metasploit/model/module/target.rb +0 -78
  50. data/lib/metasploit/model/module/target/architecture.rb +0 -34
  51. data/lib/metasploit/model/module/target/platform.rb +0 -34
  52. data/lib/metasploit/model/module/type.rb +0 -38
  53. data/lib/metasploit/model/platform.rb +0 -246
  54. data/lib/metasploit/model/real_pathname.rb +0 -16
  55. data/lib/metasploit/model/reference.rb +0 -104
  56. data/spec/app/models/metasploit/model/module/ancestor/spec/template_spec.rb +0 -174
  57. data/spec/app/models/metasploit/model/module/class/spec/template_spec.rb +0 -222
  58. data/spec/app/models/metasploit/model/module/instance/spec/template_spec.rb +0 -201
  59. data/spec/app/models/metasploit/model/search/operator/deprecated/app_spec.rb +0 -62
  60. data/spec/app/models/metasploit/model/search/operator/deprecated/author_spec.rb +0 -197
  61. data/spec/app/models/metasploit/model/search/operator/deprecated/authority_spec.rb +0 -135
  62. data/spec/app/models/metasploit/model/search/operator/deprecated/platform_spec.rb +0 -124
  63. data/spec/app/models/metasploit/model/search/operator/deprecated/ref_spec.rb +0 -387
  64. data/spec/app/models/metasploit/model/search/operator/deprecated/text_spec.rb +0 -399
  65. data/spec/app/models/metasploit/model/spec/template_spec.rb +0 -23
  66. data/spec/app/validators/derivation_validator_spec.rb +0 -92
  67. data/spec/app/validators/dynamic_length_validator_spec.rb +0 -293
  68. data/spec/dummy/app/models/dummy/architecture.rb +0 -92
  69. data/spec/dummy/app/models/dummy/author.rb +0 -15
  70. data/spec/dummy/app/models/dummy/authority.rb +0 -130
  71. data/spec/dummy/app/models/dummy/email_address.rb +0 -27
  72. data/spec/dummy/app/models/dummy/module/action.rb +0 -25
  73. data/spec/dummy/app/models/dummy/module/ancestor.rb +0 -67
  74. data/spec/dummy/app/models/dummy/module/architecture.rb +0 -19
  75. data/spec/dummy/app/models/dummy/module/author.rb +0 -28
  76. data/spec/dummy/app/models/dummy/module/class.rb +0 -69
  77. data/spec/dummy/app/models/dummy/module/instance.rb +0 -209
  78. data/spec/dummy/app/models/dummy/module/path.rb +0 -64
  79. data/spec/dummy/app/models/dummy/module/platform.rb +0 -19
  80. data/spec/dummy/app/models/dummy/module/rank.rb +0 -44
  81. data/spec/dummy/app/models/dummy/module/reference.rb +0 -19
  82. data/spec/dummy/app/models/dummy/module/target.rb +0 -62
  83. data/spec/dummy/app/models/dummy/module/target/architecture.rb +0 -19
  84. data/spec/dummy/app/models/dummy/module/target/platform.rb +0 -19
  85. data/spec/dummy/app/models/dummy/platform.rb +0 -58
  86. data/spec/dummy/app/models/dummy/reference.rb +0 -31
  87. data/spec/dummy/spec/factories/dummy/architectures.rb +0 -13
  88. data/spec/dummy/spec/factories/dummy/authorities.rb +0 -32
  89. data/spec/dummy/spec/factories/dummy/authors.rb +0 -8
  90. data/spec/dummy/spec/factories/dummy/email_addresses.rb +0 -8
  91. data/spec/dummy/spec/factories/dummy/module/actions.rb +0 -13
  92. data/spec/dummy/spec/factories/dummy/module/ancestors.rb +0 -45
  93. data/spec/dummy/spec/factories/dummy/module/architectures.rb +0 -35
  94. data/spec/dummy/spec/factories/dummy/module/authors.rb +0 -10
  95. data/spec/dummy/spec/factories/dummy/module/classes.rb +0 -40
  96. data/spec/dummy/spec/factories/dummy/module/instances.rb +0 -86
  97. data/spec/dummy/spec/factories/dummy/module/paths.rb +0 -16
  98. data/spec/dummy/spec/factories/dummy/module/platforms.rb +0 -35
  99. data/spec/dummy/spec/factories/dummy/module/ranks.rb +0 -14
  100. data/spec/dummy/spec/factories/dummy/module/references.rb +0 -17
  101. data/spec/dummy/spec/factories/dummy/module/target/architectures.rb +0 -40
  102. data/spec/dummy/spec/factories/dummy/module/target/platforms.rb +0 -41
  103. data/spec/dummy/spec/factories/dummy/module/targets.rb +0 -46
  104. data/spec/dummy/spec/factories/dummy/platforms.rb +0 -3
  105. data/spec/dummy/spec/factories/dummy/references.rb +0 -26
  106. data/spec/factories/metasploit/model/architectures.rb +0 -6
  107. data/spec/factories/metasploit/model/authorities.rb +0 -28
  108. data/spec/factories/metasploit/model/authors.rb +0 -9
  109. data/spec/factories/metasploit/model/email_addresses.rb +0 -14
  110. data/spec/factories/metasploit/model/module/actions.rb +0 -9
  111. data/spec/factories/metasploit/model/module/ancestors.rb +0 -180
  112. data/spec/factories/metasploit/model/module/architectures.rb +0 -15
  113. data/spec/factories/metasploit/model/module/classes.rb +0 -47
  114. data/spec/factories/metasploit/model/module/handlers.rb +0 -3
  115. data/spec/factories/metasploit/model/module/instances.rb +0 -83
  116. data/spec/factories/metasploit/model/module/paths.rb +0 -51
  117. data/spec/factories/metasploit/model/module/platforms.rb +0 -15
  118. data/spec/factories/metasploit/model/module/ranks.rb +0 -9
  119. data/spec/factories/metasploit/model/module/references.rb +0 -11
  120. data/spec/factories/metasploit/model/module/stances.rb +0 -3
  121. data/spec/factories/metasploit/model/module/targets.rb +0 -22
  122. data/spec/factories/metasploit/model/module/types.rb +0 -5
  123. data/spec/factories/metasploit/model/references.rb +0 -88
  124. data/spec/lib/metasploit/model/architecture_spec.rb +0 -52
  125. data/spec/lib/metasploit/model/author_spec.rb +0 -6
  126. data/spec/lib/metasploit/model/authority/bid_spec.rb +0 -17
  127. data/spec/lib/metasploit/model/authority/cve_spec.rb +0 -17
  128. data/spec/lib/metasploit/model/authority/msb_spec.rb +0 -17
  129. data/spec/lib/metasploit/model/authority/osvdb_spec.rb +0 -17
  130. data/spec/lib/metasploit/model/authority/pmasa_spec.rb +0 -17
  131. data/spec/lib/metasploit/model/authority/secunia_spec.rb +0 -17
  132. data/spec/lib/metasploit/model/authority/us_cert_vu_spec.rb +0 -17
  133. data/spec/lib/metasploit/model/authority/waraxe_spec.rb +0 -51
  134. data/spec/lib/metasploit/model/authority/zdi_spec.rb +0 -21
  135. data/spec/lib/metasploit/model/authority_spec.rb +0 -10
  136. data/spec/lib/metasploit/model/derivation/full_name_spec.rb +0 -75
  137. data/spec/lib/metasploit/model/derivation_spec.rb +0 -217
  138. data/spec/lib/metasploit/model/email_address_spec.rb +0 -19
  139. data/spec/lib/metasploit/model/module/action_spec.rb +0 -6
  140. data/spec/lib/metasploit/model/module/ancestor_spec.rb +0 -6
  141. data/spec/lib/metasploit/model/module/architecture_spec.rb +0 -9
  142. data/spec/lib/metasploit/model/module/author_spec.rb +0 -6
  143. data/spec/lib/metasploit/model/module/class_spec.rb +0 -19
  144. data/spec/lib/metasploit/model/module/handler_spec.rb +0 -61
  145. data/spec/lib/metasploit/model/module/instance_spec.rb +0 -183
  146. data/spec/lib/metasploit/model/module/path_spec.rb +0 -6
  147. data/spec/lib/metasploit/model/module/platform_spec.rb +0 -9
  148. data/spec/lib/metasploit/model/module/rank_spec.rb +0 -29
  149. data/spec/lib/metasploit/model/module/reference_spec.rb +0 -9
  150. data/spec/lib/metasploit/model/module/stance_spec.rb +0 -30
  151. data/spec/lib/metasploit/model/module/target/architecture_spec.rb +0 -9
  152. data/spec/lib/metasploit/model/module/target/platform_spec.rb +0 -9
  153. data/spec/lib/metasploit/model/module/target_spec.rb +0 -9
  154. data/spec/lib/metasploit/model/module/type_spec.rb +0 -125
  155. data/spec/lib/metasploit/model/platform_spec.rb +0 -100
  156. data/spec/lib/metasploit/model/reference_spec.rb +0 -21
  157. data/spec/support/shared/contexts/metasploit/model/module/ancestor/contents/metasploit_module.rb +0 -12
  158. data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents.rb +0 -10
  159. data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents/metasploit_module.rb +0 -15
  160. data/spec/support/shared/examples/derives.rb +0 -115
  161. data/spec/support/shared/examples/metasploit/model/architecture.rb +0 -425
  162. data/spec/support/shared/examples/metasploit/model/architecture/seed.rb +0 -25
  163. data/spec/support/shared/examples/metasploit/model/author.rb +0 -27
  164. data/spec/support/shared/examples/metasploit/model/authority.rb +0 -124
  165. data/spec/support/shared/examples/metasploit/model/authority/seed.rb +0 -49
  166. data/spec/support/shared/examples/metasploit/model/email_address.rb +0 -220
  167. data/spec/support/shared/examples/metasploit/model/module/action.rb +0 -26
  168. data/spec/support/shared/examples/metasploit/model/module/ancestor.rb +0 -2004
  169. data/spec/support/shared/examples/metasploit/model/module/ancestor/payload_factory.rb +0 -63
  170. data/spec/support/shared/examples/metasploit/model/module/architecture.rb +0 -36
  171. data/spec/support/shared/examples/metasploit/model/module/author.rb +0 -29
  172. data/spec/support/shared/examples/metasploit/model/module/class.rb +0 -1514
  173. data/spec/support/shared/examples/metasploit/model/module/handler.rb +0 -21
  174. data/spec/support/shared/examples/metasploit/model/module/instance.rb +0 -1384
  175. data/spec/support/shared/examples/metasploit/model/module/instance/class_methods.rb +0 -537
  176. data/spec/support/shared/examples/metasploit/model/module/instance/is_not_stanced_with_module_type.rb +0 -22
  177. data/spec/support/shared/examples/metasploit/model/module/instance/is_stanced_with_module_type.rb +0 -38
  178. data/spec/support/shared/examples/metasploit/model/module/instance/validates/dynamic_length_of.rb +0 -131
  179. data/spec/support/shared/examples/metasploit/model/module/path.rb +0 -493
  180. data/spec/support/shared/examples/metasploit/model/module/platform.rb +0 -36
  181. data/spec/support/shared/examples/metasploit/model/module/rank.rb +0 -92
  182. data/spec/support/shared/examples/metasploit/model/module/reference.rb +0 -16
  183. data/spec/support/shared/examples/metasploit/model/module/target.rb +0 -29
  184. data/spec/support/shared/examples/metasploit/model/module/target/architecture.rb +0 -56
  185. data/spec/support/shared/examples/metasploit/model/module/target/platform.rb +0 -56
  186. data/spec/support/shared/examples/metasploit/model/platform.rb +0 -213
  187. data/spec/support/shared/examples/metasploit/model/real_pathname.rb +0 -29
  188. data/spec/support/shared/examples/metasploit/model/reference.rb +0 -410
  189. data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/app.rb +0 -44
  190. data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb +0 -72
  191. data/spec/support/templates/metasploit/model/module/ancestors/_attributes.rb.erb +0 -9
  192. data/spec/support/templates/metasploit/model/module/ancestors/_methods.rb.erb +0 -8
  193. data/spec/support/templates/metasploit/model/module/ancestors/_validations.rb.erb +0 -6
  194. data/spec/support/templates/metasploit/model/module/ancestors/base.rb.erb +0 -3
  195. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_auxiliary.rb.erb +0 -1
  196. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_encoder.rb.erb +0 -1
  197. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_exploit.rb.erb +0 -1
  198. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_non_payload.rb.erb +0 -5
  199. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_nop.rb.erb +0 -1
  200. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_payload.rb.erb +0 -4
  201. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_post.rb.erb +0 -1
  202. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_handled.rb.erb +0 -20
  203. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_single.rb.erb +0 -1
  204. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stage.rb.erb +0 -0
  205. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stager.rb.erb +0 -1
  206. data/spec/support/templates/metasploit/model/module/classes/_methods.rb.erb +0 -9
@@ -1,425 +0,0 @@
1
- Metasploit::Model::Spec.shared_examples_for 'Architecture' do
2
- subject(:architecture) do
3
- # Architecture, don't have a factory, they have a sequence and can't use sequence generated architectures because
4
- # validators so tightly constraint values.
5
- architecture_class.new
6
- end
7
-
8
- context 'CONSTANTS' do
9
- context 'ABBREVIATIONS' do
10
- subject(:abbreviations) do
11
- described_class::ABBREVIATIONS
12
- end
13
-
14
- it 'should be an Array<String>' do
15
- abbreviations.should be_an Array
16
-
17
- abbreviations.each do |architecture|
18
- architecture.should be_a String
19
- end
20
- end
21
-
22
- it 'should include both endians of ARM' do
23
- abbreviations.should include('armbe')
24
- abbreviations.should include('armle')
25
- end
26
-
27
- it 'should include 32-bit and 64-bit versions of Cell Broadband Engine Architecture' do
28
- abbreviations.should include('cbea')
29
- abbreviations.should include('cbea64')
30
- end
31
-
32
- it 'should include cmd for command shell' do
33
- abbreviations.should include('cmd')
34
- end
35
-
36
- it 'should include dalvik for Dalvik Virtual Machine in Google Android' do
37
- abbreviations.should include('dalvik')
38
- end
39
-
40
- it 'should include firefox for Firefox privileged javascript API' do
41
- expect(abbreviations).to include('firefox')
42
- end
43
-
44
- it 'should include java for Java Virtual Machine' do
45
- abbreviations.should include('java')
46
- end
47
-
48
- it 'should include endian-ware MIPS' do
49
- abbreviations.should include('mipsbe')
50
- abbreviations.should include('mipsle')
51
- end
52
-
53
- it 'should include nodejs for javascript code that requires NodeJS extensions/libraries' do
54
- expect(abbreviations).to include('nodejs')
55
- end
56
-
57
- it 'should include php for PHP code' do
58
- abbreviations.should include('php')
59
- end
60
-
61
- it 'should include 32-bit and 64-bit PowerPC' do
62
- abbreviations.should include('ppc')
63
- abbreviations.should include('ppc64')
64
- end
65
-
66
- it 'should include python for Python code' do
67
- abbreviations.should include('python')
68
- end
69
-
70
- it 'should include ruby for Ruby code' do
71
- abbreviations.should include('ruby')
72
- end
73
-
74
- it 'should include sparc for Sparc' do
75
- abbreviations.should include('sparc')
76
- end
77
-
78
- it 'should include tty for Terminals' do
79
- abbreviations.should include('tty')
80
- end
81
-
82
- it 'should include 32-bit and 64-bit x86' do
83
- abbreviations.should include('x86')
84
- abbreviations.should include('x86_64')
85
- end
86
- end
87
-
88
- context 'BITS' do
89
- subject(:bits) do
90
- described_class::BITS
91
- end
92
-
93
- it { should include 32 }
94
- it { should include 64 }
95
- end
96
-
97
- context 'ENDIANNESSES' do
98
- subject(:endiannesses) do
99
- described_class::ENDIANNESSES
100
- end
101
-
102
- it { should include 'big' }
103
- it { should include 'little' }
104
- end
105
-
106
- context 'FAMILIES' do
107
- subject(:families) do
108
- described_class::FAMILIES
109
- end
110
-
111
- it 'includes arm for big- and little-endian ARM' do
112
- expect(families).to include('arm')
113
- end
114
-
115
- it 'includes cbea for 32- and 64-bit Cell Broadband Engine Architecture' do
116
- expect(families).to include('cbea')
117
- end
118
-
119
- it 'includes javascript for NodeJS' do
120
- expect(families).to include('javascript')
121
- end
122
-
123
- it 'includes mips for big and little-endian MIPS' do
124
- expect(families).to include('mips')
125
- end
126
-
127
- it 'includes ppc for 32- and 64-bit PPC' do
128
- expect(families).to include('ppc')
129
- end
130
-
131
- it 'includes sparc for sparc' do
132
- expect(families).to include('sparc')
133
- end
134
-
135
- it 'includes x86 for x86 and x86_64' do
136
- expect(families).to include('x86')
137
- end
138
- end
139
- end
140
-
141
- context 'search' do
142
- context 'attributes' do
143
- it_should_behave_like 'search_attribute',
144
- :abbreviation,
145
- type: {
146
- set: :string
147
- }
148
- it_should_behave_like 'search_attribute',
149
- :bits,
150
- type: {
151
- set: :integer
152
- }
153
- it_should_behave_like 'search_attribute',
154
- :endianness,
155
- type: {
156
- set: :string
157
- }
158
- it_should_behave_like 'search_attribute',
159
- :family,
160
- type: {
161
- set: :string
162
- }
163
- end
164
- end
165
-
166
- context 'seeds' do
167
- it_should_behave_like 'Metasploit::Model::Architecture seed',
168
- :abbreviation => 'armbe',
169
- :bits => 32,
170
- :endianness => 'big',
171
- :family => 'arm',
172
- :summary => 'Little-endian ARM'
173
-
174
- it_should_behave_like 'Metasploit::Model::Architecture seed',
175
- :abbreviation => 'armle',
176
- :bits => 32,
177
- :endianness => 'little',
178
- :family => 'arm',
179
- :summary => 'Big-endian ARM'
180
-
181
- it_should_behave_like 'Metasploit::Model::Architecture seed',
182
- :abbreviation => 'cbea',
183
- :bits => 32,
184
- :endianness => 'big',
185
- :family => 'cbea',
186
- :summary => '32-bit Cell Broadband Engine Architecture'
187
-
188
- it_should_behave_like 'Metasploit::Model::Architecture seed',
189
- :abbreviation => 'cbea64',
190
- :bits => 64,
191
- :endianness => 'big',
192
- :family => 'cbea',
193
- :summary => '64-bit Cell Broadband Engine Architecture'
194
-
195
- it_should_behave_like 'Metasploit::Model::Architecture seed',
196
- :abbreviation => 'cmd',
197
- :bits => nil,
198
- :endianness => nil,
199
- :family => nil,
200
- :summary => 'Command Injection'
201
-
202
- it_should_behave_like 'Metasploit::Model::Architecture seed',
203
- :abbreviation => 'dalvik',
204
- :bits => nil,
205
- :endianness => nil,
206
- :family => nil,
207
- :summary => 'Dalvik process virtual machine used in Google Android'
208
-
209
- it_should_behave_like 'Metasploit::Model::Architecture seed',
210
- abbreviation: 'firefox',
211
- bits: nil,
212
- endianness: nil,
213
- family: 'javascript',
214
- summary: "Firefox's privileged javascript API"
215
-
216
- it_should_behave_like 'Metasploit::Model::Architecture seed',
217
- :abbreviation => 'java',
218
- :bits => nil,
219
- :endianness => 'big',
220
- :family => nil,
221
- :summary => 'Java'
222
-
223
- it_should_behave_like 'Metasploit::Model::Architecture seed',
224
- :abbreviation => 'mipsbe',
225
- :bits => 32,
226
- :endianness => 'big',
227
- :family => 'mips',
228
- :summary => 'Big-endian MIPS'
229
-
230
- it_should_behave_like 'Metasploit::Model::Architecture seed',
231
- :abbreviation => 'mipsle',
232
- :bits => 32,
233
- :endianness => 'little',
234
- :family => 'mips',
235
- :summary => 'Little-endian MIPS'
236
-
237
- it_should_behave_like 'Metasploit::Model::Architecture seed',
238
- :abbreviation => 'nodejs',
239
- :bits => nil,
240
- :endianness => nil,
241
- :family => 'javascript',
242
- :summary => 'NodeJS'
243
-
244
- it_should_behave_like 'Metasploit::Model::Architecture seed',
245
- :abbreviation => 'php',
246
- :bits => nil,
247
- :endianness => nil,
248
- :family => nil,
249
- :summary => 'PHP'
250
-
251
- it_should_behave_like 'Metasploit::Model::Architecture seed',
252
- :abbreviation => 'ppc',
253
- :bits => 32,
254
- :endianness => 'big',
255
- :family => 'ppc',
256
- :summary => '32-bit Peformance Optimization With Enhanced RISC - Performance Computing'
257
-
258
- it_should_behave_like 'Metasploit::Model::Architecture seed',
259
- :abbreviation => 'ppc64',
260
- :bits => 64,
261
- :endianness => 'big',
262
- :family => 'ppc',
263
- :summary => '64-bit Performance Optimization With Enhanced RISC - Performance Computing'
264
-
265
- it_should_behave_like 'Metasploit::Model::Architecture seed',
266
- :abbreviation => 'python',
267
- :bits => nil,
268
- :endianness => nil,
269
- :family => nil,
270
- :summary => 'Python'
271
-
272
- it_should_behave_like 'Metasploit::Model::Architecture seed',
273
- :abbreviation => 'ruby',
274
- :bits => nil,
275
- :endianness => nil,
276
- :family => nil,
277
- :summary => 'Ruby'
278
-
279
- it_should_behave_like 'Metasploit::Model::Architecture seed',
280
- :abbreviation => 'sparc',
281
- :bits => nil,
282
- :endianness => nil,
283
- :family => 'sparc',
284
- :summary => 'Scalable Processor ARChitecture'
285
-
286
- it_should_behave_like 'Metasploit::Model::Architecture seed',
287
- :abbreviation => 'tty',
288
- :bits => nil,
289
- :endianness => nil,
290
- :family => nil,
291
- :summary => '*nix terminal'
292
-
293
- it_should_behave_like 'Metasploit::Model::Architecture seed',
294
- :abbreviation => 'x86',
295
- :bits => 32,
296
- :endianness => 'little',
297
- :family => 'x86',
298
- :summary => '32-bit x86'
299
-
300
- it_should_behave_like 'Metasploit::Model::Architecture seed',
301
- :abbreviation => 'x86_64',
302
- :bits => 64,
303
- :endianness => 'little',
304
- :family => 'x86',
305
- :summary => '64-bit x86'
306
- end
307
-
308
- context 'validations' do
309
- context 'abbreviation' do
310
- # have to test inclusion validation manually because
311
- # ensure_inclusion_of(:abbreviation).in_array(described_class::ABBREVIATIONS).allow_nil does not work with
312
- # additional uniqueness validation.
313
- context 'ensure inclusion of abbreviation in ABBREVIATIONS' do
314
- let(:error) do
315
- 'is not included in the list'
316
- end
317
-
318
- abbreviations = [
319
- 'armbe',
320
- 'armle',
321
- 'cbea',
322
- 'cbea64',
323
- 'cmd',
324
- 'dalvik',
325
- 'firefox',
326
- 'java',
327
- 'mipsbe',
328
- 'mipsle',
329
- 'nodejs',
330
- 'php',
331
- 'ppc',
332
- 'ppc64',
333
- 'python',
334
- 'ruby',
335
- 'sparc',
336
- 'tty',
337
- 'x86',
338
- 'x86_64'
339
- ]
340
-
341
- abbreviations.each do |abbreviation|
342
- context "with #{abbreviation.inspect}" do
343
- before(:each) do
344
- architecture.abbreviation = abbreviation
345
-
346
- architecture.valid?
347
- end
348
-
349
- it 'should not record error on abbreviation' do
350
- architecture.errors[:abbreviation].should_not include(error)
351
- end
352
- end
353
- end
354
- end
355
- end
356
-
357
- it { should ensure_inclusion_of(:bits).in_array(described_class::BITS).allow_nil }
358
- it { should ensure_inclusion_of(:endianness).in_array(described_class::ENDIANNESSES).allow_nil }
359
- it { should ensure_inclusion_of(:family).in_array(described_class::FAMILIES).allow_nil }
360
- it { should validate_presence_of(:summary) }
361
- end
362
-
363
- context 'abbreviation_set' do
364
- subject(:abbreviation_set) do
365
- architecture_class.abbreviation_set
366
- end
367
-
368
- it { should_not include nil }
369
- it { should include 'armbe' }
370
- it { should include 'armle' }
371
- it { should include 'cbea' }
372
- it { should include 'cbea64' }
373
- it { should include 'cmd' }
374
- it { should include 'dalvik' }
375
- it { should include 'firefox' }
376
- it { should include 'java' }
377
- it { should include 'mipsbe' }
378
- it { should include 'mipsle' }
379
- it { should include 'nodejs' }
380
- it { should include 'php' }
381
- it { should include 'ppc' }
382
- it { should include 'ppc64' }
383
- it { should include 'python' }
384
- it { should include 'ruby' }
385
- it { should include 'sparc' }
386
- it { should include 'tty' }
387
- it { should include 'x86' }
388
- it { should include 'x86_64' }
389
- end
390
-
391
- context 'bits_set' do
392
- subject(:bits_set) do
393
- architecture_class.bits_set
394
- end
395
-
396
- it { should_not include nil }
397
- it { should include 32 }
398
- it { should include 64 }
399
- end
400
-
401
- context 'endianness_set' do
402
- subject(:endianness_set) do
403
- architecture_class.endianness_set
404
- end
405
-
406
- it { should_not include nil }
407
- it { should include 'big' }
408
- it { should include 'little' }
409
- end
410
-
411
- context 'family_set' do
412
- subject(:family_set) do
413
- architecture_class.family_set
414
- end
415
-
416
- it { should_not include nil }
417
- it { should include 'arm' }
418
- it { should include 'cbea' }
419
- it { should include 'mips' }
420
- it { should include 'javascript' }
421
- it { should include 'ppc' }
422
- it { should include 'sparc' }
423
- it { should include 'x86' }
424
- end
425
- end
@@ -1,25 +0,0 @@
1
- shared_examples_for 'Metasploit::Model::Architecture seed' do |attributes={}|
2
- attributes.assert_valid_keys(:abbreviation, :bits, :endianness, :family, :summary)
3
-
4
- context_abbreviation = attributes.fetch(:abbreviation)
5
-
6
- context "with #{context_abbreviation}" do
7
- subject do
8
- seed
9
- end
10
-
11
- # put in a let so that `let(:seed)` has access to abbreviation.
12
- let(:abbreviation) do
13
- context_abbreviation
14
- end
15
-
16
- it 'should exist' do
17
- seed.should_not be_nil
18
- end
19
-
20
- its(:bits) { should == attributes.fetch(:bits) }
21
- its(:endianness) { should == attributes.fetch(:endianness) }
22
- its(:family) { should == attributes.fetch(:family) }
23
- its(:summary) { should == attributes.fetch(:summary) }
24
- end
25
- end
@@ -1,27 +0,0 @@
1
- Metasploit::Model::Spec.shared_examples_for 'Author' do
2
- context 'factories' do
3
- context author_factory do
4
- subject(author_factory) do
5
- FactoryGirl.build(author_factory)
6
- end
7
-
8
- it { should be_valid }
9
- end
10
- end
11
-
12
- context 'mass assignment security' do
13
- it { should allow_mass_assignment_of(:name) }
14
- end
15
-
16
- context 'search' do
17
- context 'attributes' do
18
- it_should_behave_like 'search_attribute', :name, :type => :string
19
- end
20
- end
21
-
22
- context 'validations' do
23
- context 'name' do
24
- it { should validate_presence_of :name }
25
- end
26
- end
27
- end