metasploit-model 0.28.0-java → 0.29.0-java

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 +4 -4
  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 +2 -348
  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,141 +0,0 @@
1
- # Code shared between `Mdm::Authority` and `Metasploit::Framework::Authority`.
2
- module Metasploit::Model::Authority
3
- extend ActiveModel::Naming
4
- extend ActiveSupport::Autoload
5
- extend ActiveSupport::Concern
6
-
7
- include Metasploit::Model::Translation
8
-
9
- autoload :Bid
10
- autoload :Cve
11
- autoload :Msb
12
- autoload :Osvdb
13
- autoload :Pmasa
14
- autoload :Secunia
15
- autoload :UsCertVu
16
- autoload :Waraxe
17
- autoload :Zdi
18
-
19
- included do
20
- include ActiveModel::MassAssignmentSecurity
21
- include ActiveModel::Validations
22
- include Metasploit::Model::Search
23
-
24
- #
25
- # Mass Assignment Security
26
- #
27
-
28
- attr_accessible :abbreviation
29
- attr_accessible :obsolete
30
- attr_accessible :summary
31
- attr_accessible :url
32
-
33
- #
34
- # Search Attributes
35
- #
36
-
37
- search_attribute :abbreviation, :type => :string
38
-
39
- #
40
- # Validations
41
- #
42
-
43
- validates :abbreviation,
44
- :presence => true
45
- end
46
-
47
- #
48
- # Associations
49
- #
50
-
51
- # @!attribute [rw] references
52
- # {Metasploit::Model::Reference References} that use this authority's scheme for their
53
- # {Metasploit::Model::Reference#authority}.
54
- #
55
- # @return [Array<Metasploit::Model::Reference>]
56
-
57
- # @!attribute [r] module_instances
58
- # {Metasploit::Model::Module::Instance Modules} that have a reference with this authority.
59
- #
60
- # @return [Array<Metasploit::Model::Module::Instance>]
61
-
62
- # @!attribute [r] vulns
63
- # Vulnerabilities that have a reference under this authority.
64
- #
65
- # @return [Array<Metasploit::Model::Vuln>]
66
-
67
- #
68
- # Attributes
69
- #
70
-
71
- # @!attribute [rw] abbreviation
72
- # Abbreviation or initialism for authority, such as CVE for 'Common Vulnerability and Exposures'.
73
- #
74
- # @return [String]
75
-
76
- # @!attribute [rw] obsolete
77
- # Whether this authority is obsolete and no longer exists on the internet.
78
- #
79
- # @return [false]
80
- # @return [true] {#url} may be `nil` because authory no longer has a web site.
81
-
82
- # @!attribute [rw] summary
83
- # An expansion of the {#abbreviation}.
84
- #
85
- # @return [String, nil]
86
-
87
- # @!attribute [rw] url
88
- # URL to the authority's home page or root URL for their {#references} database.
89
- #
90
- # @return [String, nil]
91
-
92
- #
93
- # Instance Methods
94
- #
95
-
96
- # Returns the {Metasploit::Model::Reference#url URL} for a {Metasploit::Model::Reference#designation designation}.
97
- #
98
- # @param designation [String] {Metasploit::Model::Reference#designation}.
99
- # @return [String] {Metasploit::Model::Reference#url}
100
- # @return [nil] if this {Metasploit::Model::Authority} is {#obsolete}.
101
- # @return [nil] if this {Metasploit::Model::Authority} does have a way to derive URLS from designations.
102
- def designation_url(designation)
103
- url = nil
104
-
105
- if extension
106
- url = extension.designation_url(designation)
107
- end
108
-
109
- url
110
- end
111
-
112
- # Returns module that include authority specific methods.
113
- #
114
- # @return [Module] if {#abbreviation} has a corresponding module under the Metasploit::Model::Authority namespace.
115
- # @return [nil] otherwise.
116
- def extension
117
- begin
118
- extension_name.constantize
119
- rescue NameError
120
- nil
121
- end
122
- end
123
-
124
- # Returns name of module that includes authority specific methods.
125
- #
126
- # @return [String] unless {#abbreviation} is blank.
127
- # @return [nil] if {#abbreviation} is blank.
128
- def extension_name
129
- extension_name = nil
130
-
131
- unless abbreviation.blank?
132
- # underscore before camelize to eliminate -'s
133
- relative_model_name = abbreviation.underscore.camelize
134
- # don't scope to self.class.name so that authority extension are always resolved the same in Mdm and
135
- # Metasploit::Framework.
136
- extension_name = "Metasploit::Model::Authority::#{relative_model_name}"
137
- end
138
-
139
- extension_name
140
- end
141
- end
@@ -1,10 +0,0 @@
1
- # BugTraq ID authority-specific code.
2
- module Metasploit::Model::Authority::Bid
3
- # Returns URL to {Metasploit::Model::Reference#designation BugTraq ID's} page on SecurityFocus' site.
4
- #
5
- # @param designation [String] N+ BugTraq ID.
6
- # @return [String] URL
7
- def self.designation_url(designation)
8
- "http://www.securityfocus.com/bid/#{designation}"
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # Common Vulnerabilities and Exposures authority-specific code.
2
- module Metasploit::Model::Authority::Cve
3
- # Returns URL to {Metasploit::Model::Reference#designation the CVE ID's} page on CVE Details.
4
- #
5
- # @param designation [String] YYYY-NNNN CVE ID.
6
- # @return [String] URL
7
- def self.designation_url(designation)
8
- "http://cvedetails.com/cve/CVE-#{designation}"
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # Microsoft Security Bulletin authority-specific code.
2
- module Metasploit::Model::Authority::Msb
3
- # Returns URL to {Metasploit::Model::Reference#designation the security bulletin's} page on Technet.
4
- #
5
- # @param designation [String] MSYY-NNN Security Bulletin ID.
6
- # @return [String] URL
7
- def self.designation_url(designation)
8
- "http://www.microsoft.com/technet/security/bulletin/#{designation}"
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # Open Sourced Vulnerability Database authority-specific code.
2
- module Metasploit::Model::Authority::Osvdb
3
- # Returns URL to {Metasploit::Model::Reference#designation OSVDB ID's} page.
4
- #
5
- # @param designation [String] N+ OSVDB ID.
6
- # @return [String] URL
7
- def self.designation_url(designation)
8
- "http://www.osvdb.org/#{designation}/"
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # phpMyAdmin Security Announcement authority-specific code.
2
- module Metasploit::Model::Authority::Pmasa
3
- # Returns URL to {Metasploit::Model::Reference#designation phpMyAdmin Security Advisory's} page on phpMyAdmin's site.
4
- #
5
- # @param designation [String] YYYY-N phpMyAdmin Security Advisory ID.
6
- # @return [String] URL
7
- def self.designation_url(designation)
8
- "http://www.phpmyadmin.net/home_page/security/PMASA-#{designation}.php"
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # Secunia authority-specific code.
2
- module Metasploit::Model::Authority::Secunia
3
- # Returns URL to {Metasploit::Model::Reference#designation Secunia Advisory ID's} page on Secunia.
4
- #
5
- # @param designation [String] NNNNN Secunia Advisory ID.
6
- # @return [String] URL
7
- def self.designation_url(designation)
8
- "https://secunia.com/advisories/#{designation}/"
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # United States Computer Emergency Readiness Team Vulnerability Notes Database authority-specific code.
2
- module Metasploit::Model::Authority::UsCertVu
3
- # Returns URL to {Metasploit::Model::Reference#designation Vul ID's} page on US CERT Notes Database.
4
- #
5
- # @param designation [String] N US CERT ID.
6
- # @return [String] URL
7
- def self.designation_url(designation)
8
- "http://www.kb.cert.org/vuls/id/#{designation}"
9
- end
10
- end
@@ -1,31 +0,0 @@
1
- # Waraxe authority-specific code.
2
- module Metasploit::Model::Authority::Waraxe
3
- #
4
- # CONSTANTS
5
- #
6
-
7
- # Regular expression for breaking up designation into year and number
8
- DESIGNATION_REGEXP = /\A(?<year>\d+)-SA#(?<number>\d+)\Z/
9
-
10
- #
11
- # Methods
12
- #
13
-
14
- # Returns URL to {Metasploit::Model::Reference#designation Waraxe Security Advisory's} page on Waraxe's site.
15
- #
16
- # @param designation [String] YYYY-SA#N+ Waraxe fully-qualified ID.
17
- # @return [String] URL
18
- # @return [nil] if designation does not match {DESIGNATION_REGEXP}.
19
- def self.designation_url(designation)
20
- match = DESIGNATION_REGEXP.match(designation)
21
- url = nil
22
-
23
- if match
24
- number = match[:number]
25
-
26
- url = "http://www.waraxe.us/advisory-#{number}.html"
27
- end
28
-
29
- url
30
- end
31
- end
@@ -1,10 +0,0 @@
1
- # Zero Day Initiative authority-specific code.
2
- module Metasploit::Model::Authority::Zdi
3
- # Returns URL to {Metasploit::Model::Reference#designation the ZDI ID's} page on ZDI.
4
- #
5
- # @param designation [String] YY-NNNN ZDI ID.
6
- # @return [String] URL
7
- def self.designation_url(designation)
8
- "http://www.zerodayinitiative.com/advisories/ZDI-#{designation}"
9
- end
10
- end
@@ -1,109 +0,0 @@
1
- # Allow to declare that attributes should be derived, which will set the attribute equal to derived_<attribute> if
2
- # the attribute is `nil` before validation. Optionally, it can be checked if the attribute matches the
3
- # derived_<attribute> in a validation.
4
- #
5
- #
6
- # @example Full setup
7
- # class Person < ActiveRecord::Base
8
- # include Metasploit::Model::Derivation
9
- #
10
- # #
11
- # # Attributes
12
- # #
13
- #
14
- # # @!attributes [rw] first_name
15
- # # First Name.
16
- # #
17
- # # @return [String]
18
- #
19
- # # @!attribute [rw] full_name
20
- # # Full name. (Includes first and last name).
21
- # #
22
- # # @return [String]
23
- #
24
- # # @!attribute [rw] last_name
25
- # # Last name.
26
- # #
27
- # # @return [String]
28
- #
29
- # #
30
- # # Derivations
31
- # #
32
- #
33
- # derives :full_name
34
- #
35
- # #
36
- # # Methods
37
- # #
38
- #
39
- # # Derives {#full_name} from {#first_name} and {#last_name}.
40
- # #
41
- # # @return [String] "<first_name> <last_name>"
42
- # def derive_full_name
43
- # "#{first_name} #{last_name}"
44
- # end
45
- # end
46
- module Metasploit::Model::Derivation
47
- extend ActiveSupport::Autoload
48
- extend ActiveSupport::Concern
49
-
50
- autoload :FullName
51
-
52
- included do
53
- include ActiveModel::Validations
54
- include ActiveModel::Validations::Callbacks
55
-
56
- before_validation :derive
57
- end
58
-
59
- # Defines class methods include {#derives}, which can be used to declare derived attributes after mixing in
60
- # {Metasploit::Model::Derivation}.
61
- module ClassMethods
62
- # Declares that the attribute should be derived using the derived_<attribute> method if it is `nil` before
63
- # validation.
64
- #
65
- # @param attribute [Symbol] the name of the attribute.
66
- # @param options [Hash{Symbol => Boolean}]
67
- # @option options [Boolean] :validate (false) If `true`, validates `attribute` using {DerivationValidator}. If
68
- # `false`, does no validation on `attribute`.
69
- # @return [void]
70
- def derives(attribute, options={})
71
- options.assert_valid_keys(:validate)
72
-
73
- validate = options.fetch(:validate, false)
74
- validate_by_derived_attribute[attribute] = validate
75
-
76
- if validate
77
- validates attribute, :derivation => true
78
- end
79
- end
80
-
81
- # Maps a derived attribute (declared with {#derives}) to whether the attribute should validate as a derivation.
82
- #
83
- # @return [Hash{Symbol => Boolean}]
84
- def validate_by_derived_attribute
85
- @validate_by_derived_attribute ||= {}
86
- end
87
- end
88
-
89
- #
90
- # Instance Methods
91
- #
92
-
93
- private
94
-
95
- # Derives each attribute in {ClassMethods#validate_by_derived_attribute} if the attribute is `nil`.
96
- #
97
- # @return [void]
98
- def derive
99
- self.class.validate_by_derived_attribute.each_key do |attribute|
100
- value = send(attribute)
101
-
102
- # explicitly check for `nil` in case attribute is Boolean
103
- if value.nil?
104
- derived_value = send("derived_#{attribute}")
105
- send("#{attribute}=", derived_value)
106
- end
107
- end
108
- end
109
- end
@@ -1,19 +0,0 @@
1
- # Methods for deriving full_name from module_type and reference_name in `Mdm::Module::Ancestor`,
2
- # `Mdm::Module::Class`, `Metasploit::Framework::Module::Ancestor`, and `Metasploit::Framework::Module::Class`.
3
- module Metasploit::Model::Derivation::FullName
4
- # Derives full_name by combining module_type and reference_name in the same way used to create modules using
5
- # Msf::ModuleManager#create in metasploit-framework.
6
- #
7
- # @return [String] <module_type>/<reference_name>
8
- # @return [nil] if module_type is `nil`.
9
- # @return [nil] if reference_name is `nil`.
10
- def derived_full_name
11
- derived = nil
12
-
13
- if module_type and reference_name
14
- derived = "#{module_type}/#{reference_name}"
15
- end
16
-
17
- derived
18
- end
19
- end
@@ -1,124 +0,0 @@
1
- # Code shared between `Mdm::EmailAddress` and `Metasploit::Framework::EmailAddress`.
2
- module Metasploit::Model::EmailAddress
3
- extend ActiveModel::Naming
4
- extend ActiveSupport::Concern
5
-
6
- include Metasploit::Model::Translation
7
-
8
- included do
9
- include ActiveModel::MassAssignmentSecurity
10
- include ActiveModel::Validations
11
- include Metasploit::Model::Derivation
12
- include Metasploit::Model::Search
13
-
14
- #
15
- # Derivations
16
- #
17
-
18
- derives :domain, :validate => true
19
- derives :full, :validate => true
20
- derives :local, :validate => true
21
-
22
- #
23
- # Mass Assignment Security
24
- #
25
-
26
- attr_accessible :domain
27
- attr_accessible :full
28
- attr_accessible :local
29
-
30
- #
31
- # Search Attributes
32
- #
33
-
34
- search_attribute :domain, :type => :string
35
- search_attribute :full, :type => :string
36
- search_attribute :local, :type => :string
37
-
38
- #
39
- # Validations
40
- #
41
-
42
- validates :domain, :presence => true
43
- validates :local, :presence => true
44
- end
45
-
46
- #
47
- # Associations
48
- #
49
-
50
- # @!attribute [rw] module_authors
51
- # Credits where {#authors} used this email address for {#module_instances modules}.
52
- #
53
- # @return [Array<Metasploit::Model::Module::Author>]
54
-
55
- # @!attribute [r] authors
56
- # Authors that used this email address.
57
- #
58
- # @return [Array<Metasploit::Model::Author>]
59
-
60
- # @!attribute [r] module_instances
61
- # Modules where this email address was used.
62
- #
63
- # @return [Array<Metasploit::Module::Instance>]
64
-
65
- #
66
- # Attributes
67
- #
68
-
69
- # @!attribute [rw] domain
70
- # The domain part of the email address after the `'@'`.
71
- #
72
- # @return [String]
73
-
74
- # @!attribute [rw] full
75
- # The full email address.
76
- #
77
- # @return [String] <{#local}>@<{#domain}
78
-
79
- # @!attribute [rw] local
80
- # The local part of the email address before the `'@'`.
81
- #
82
- # @return [String]
83
-
84
- #
85
- # Methods
86
- #
87
-
88
- # Derives {#domain} from {#full}
89
- #
90
- # @return [String] if {#full} is present
91
- # @return [nil] if {#full} is not present
92
- def derived_domain
93
- domain = nil
94
-
95
- if full.present?
96
- _local, domain = full.split('@', 2)
97
- end
98
-
99
- domain
100
- end
101
-
102
- # Derives {#full} from {#domain} and {#local}
103
- #
104
- # @return [String]
105
- def derived_full
106
- if domain.present? && local.present?
107
- "#{local}@#{domain}"
108
- end
109
- end
110
-
111
- # Derives {#local} from {#full}.
112
- #
113
- # @return [String] if {#full} is present
114
- # @return [nil] if {#full} is not present
115
- def derived_local
116
- local = nil
117
-
118
- if full.present?
119
- local, _domain = full.split('@', 2)
120
- end
121
-
122
- local
123
- end
124
- end