metasploit_data_models 1.0.0.pre.rails.pre.4.0b → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -2
- data/.travis.yml +6 -3
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +10 -52
- data/Gemfile +4 -6
- data/RELEASING.md +88 -0
- data/Rakefile +23 -0
- data/UPGRADING.md +1 -0
- data/app/models/mdm/api_key.rb +41 -1
- data/app/models/mdm/client.rb +41 -1
- data/app/models/mdm/cred.rb +116 -28
- data/app/models/mdm/event.rb +47 -0
- data/app/models/mdm/exploit_attempt.rb +65 -16
- data/app/models/mdm/exploited_host.rb +27 -0
- data/app/models/mdm/host_detail.rb +44 -0
- data/app/models/mdm/host_tag.rb +6 -8
- data/app/models/mdm/listener.rb +52 -0
- data/app/models/mdm/macro.rb +42 -0
- data/app/models/mdm/mod_ref.rb +21 -1
- data/app/models/mdm/module/action.rb +15 -0
- data/app/models/mdm/module/arch.rb +10 -0
- data/app/models/mdm/module/author.rb +17 -1
- data/app/models/mdm/module/mixin.rb +13 -0
- data/app/models/mdm/module/platform.rb +11 -0
- data/app/models/mdm/module/target.rb +18 -0
- data/app/models/mdm/nexpose_console.rb +82 -4
- data/app/models/mdm/profile.rb +36 -0
- data/app/models/mdm/route.rb +16 -4
- data/app/models/mdm/session_event.rb +32 -0
- data/app/models/mdm/tag.rb +48 -9
- data/app/models/mdm/task.rb +85 -46
- data/app/models/mdm/task_cred.rb +29 -0
- data/app/models/mdm/task_host.rb +25 -0
- data/app/models/mdm/task_service.rb +25 -0
- data/app/models/mdm/task_session.rb +25 -0
- data/app/models/mdm/user.rb +192 -6
- data/app/models/mdm/vuln_attempt.rb +37 -12
- data/app/models/mdm/vuln_detail.rb +138 -5
- data/app/models/mdm/vuln_ref.rb +3 -0
- data/app/models/mdm/web_form.rb +34 -0
- data/app/models/mdm/web_page.rb +69 -0
- data/app/models/mdm/web_site.rb +50 -0
- data/app/models/mdm/wmap_request.rb +85 -0
- data/app/models/mdm/wmap_target.rb +40 -0
- data/app/models/mdm/workspace.rb +160 -17
- data/app/models/metasploit_data_models/automatic_exploitation/match.rb +13 -23
- data/app/models/metasploit_data_models/automatic_exploitation/match_result.rb +25 -4
- data/app/models/metasploit_data_models/automatic_exploitation/match_set.rb +15 -4
- data/app/models/metasploit_data_models/automatic_exploitation/run.rb +7 -3
- data/app/models/metasploit_data_models/ip_address/v4/segmented.rb +1 -1
- data/app/models/metasploit_data_models/module_run.rb +1 -1
- data/app/models/metasploit_data_models/search/visitor/where.rb +1 -1
- data/app/validators/ip_format_validator.rb +4 -0
- data/app/validators/parameters_validator.rb +12 -0
- data/app/validators/password_is_strong_validator.rb +10 -1
- data/lib/mdm/host/operating_system_normalization.rb +7 -10
- data/lib/metasploit_data_models.rb +4 -0
- data/lib/metasploit_data_models/automatic_exploitation.rb +25 -0
- data/lib/metasploit_data_models/engine.rb +2 -0
- data/lib/metasploit_data_models/serialized_prefs.rb +6 -0
- data/lib/metasploit_data_models/version.rb +30 -7
- data/metasploit_data_models.gemspec +9 -2
- data/spec/app/models/mdm/api_key_spec.rb +1 -3
- data/spec/app/models/mdm/client_spec.rb +9 -11
- data/spec/app/models/mdm/cred_spec.rb +42 -54
- data/spec/app/models/mdm/event_spec.rb +22 -24
- data/spec/app/models/mdm/exploit_attempt_spec.rb +19 -21
- data/spec/app/models/mdm/exploited_host_spec.rb +11 -13
- data/spec/app/models/mdm/host_detail_spec.rb +15 -17
- data/spec/app/models/mdm/host_spec.rb +262 -260
- data/spec/app/models/mdm/host_tag_spec.rb +6 -8
- data/spec/app/models/mdm/listener_spec.rb +30 -32
- data/spec/app/models/mdm/loot_spec.rb +21 -23
- data/spec/app/models/mdm/macro_spec.rb +1 -3
- data/spec/app/models/mdm/mod_ref_spec.rb +1 -3
- data/spec/app/models/mdm/module/action_spec.rb +8 -10
- data/spec/app/models/mdm/module/arch_spec.rb +8 -10
- data/spec/app/models/mdm/module/author_spec.rb +19 -14
- data/spec/app/models/mdm/module/detail_spec.rb +184 -75
- data/spec/app/models/mdm/module/mixin_spec.rb +8 -10
- data/spec/app/models/mdm/module/platform_spec.rb +8 -10
- data/spec/app/models/mdm/module/ref_spec.rb +8 -10
- data/spec/app/models/mdm/module/target_spec.rb +10 -12
- data/spec/app/models/mdm/nexpose_console_spec.rb +35 -37
- data/spec/app/models/mdm/note_spec.rb +23 -25
- data/spec/app/models/mdm/profile_spec.rb +1 -3
- data/spec/app/models/mdm/ref_spec.rb +9 -12
- data/spec/app/models/mdm/route_spec.rb +6 -8
- data/spec/app/models/mdm/service_spec.rb +38 -40
- data/spec/app/models/mdm/session_event_spec.rb +10 -12
- data/spec/app/models/mdm/session_spec.rb +13 -15
- data/spec/app/models/mdm/tag_spec.rb +29 -30
- data/spec/app/models/mdm/task_cred_spec.rb +9 -11
- data/spec/app/models/mdm/task_host_spec.rb +9 -11
- data/spec/app/models/mdm/task_service_spec.rb +9 -11
- data/spec/app/models/mdm/task_session_spec.rb +7 -9
- data/spec/app/models/mdm/task_spec.rb +27 -29
- data/spec/app/models/mdm/user_spec.rb +17 -19
- data/spec/app/models/mdm/vuln_attempt_spec.rb +14 -16
- data/spec/app/models/mdm/vuln_detail_spec.rb +26 -28
- data/spec/app/models/mdm/vuln_ref_spec.rb +8 -10
- data/spec/app/models/mdm/vuln_spec.rb +24 -26
- data/spec/app/models/mdm/web_form_spec.rb +11 -13
- data/spec/app/models/mdm/web_page_spec.rb +19 -21
- data/spec/app/models/mdm/web_site_spec.rb +21 -23
- data/spec/app/models/mdm/web_vuln_spec.rb +63 -65
- data/spec/app/models/mdm/wmap_request_spec.rb +1 -3
- data/spec/app/models/mdm/wmap_target_spec.rb +1 -3
- data/spec/app/models/mdm/workspace_spec.rb +97 -100
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +3 -5
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +13 -15
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +10 -12
- data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +21 -23
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +9 -11
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +21 -23
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +22 -15
- data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/module_run_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +18 -20
- data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +6 -8
- data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +2 -4
- data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +6 -8
- data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +9 -11
- data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +5 -7
- data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +17 -19
- data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +5 -7
- data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +61 -23
- data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +8 -10
- data/spec/app/validators/parameters_validator_spec.rb +29 -29
- data/spec/app/validators/password_is_strong_validator_spec.rb +54 -46
- data/spec/lib/base64_serializer_spec.rb +19 -21
- data/spec/lib/ipaddr_spec.rb +1 -3
- data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +18 -12
- data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +4 -6
- data/spec/lib/metasploit_data_models/match/child_spec.rb +2 -4
- data/spec/lib/metasploit_data_models/match/parent_spec.rb +4 -6
- data/spec/lib/metasploit_data_models/version_spec.rb +3 -139
- data/spec/lib/metasploit_data_models_spec.rb +4 -0
- data/spec/spec_helper.rb +86 -12
- data/spec/support/shared/examples/mdm/module/detail/does_not_support_stance_with_mtype.rb +2 -2
- data/spec/support/shared/examples/mdm/module/detail/supports_stance_with_mtype.rb +4 -4
- data/spec/support/shared/examples/metasploit_data_models/search/operation/ipaddress/match.rb +2 -2
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb +5 -5
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_metasploit_model_search_operation_base.rb +5 -5
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_equality.rb +3 -3
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_metasploit_model_search_group_base.rb +7 -6
- metadata +74 -14
- data/app/models/metasploit_data_models/automatic_exploitation.rb +0 -16
- data/lib/tasks/yard.rake +0 -33
@@ -1,31 +1,29 @@
|
|
1
|
+
# An attempt to exploit a {#vuln}.
|
1
2
|
class Mdm::VulnAttempt < ActiveRecord::Base
|
2
3
|
|
3
4
|
#
|
4
5
|
# Associations
|
5
6
|
#
|
6
7
|
|
7
|
-
#
|
8
|
-
# Loot gathered from this attempt.
|
8
|
+
# Loot gathered from this attempt.
|
9
9
|
#
|
10
|
-
#
|
11
|
-
#
|
10
|
+
# @return [Mdm::Loot] if {#exploited} is `true`.
|
11
|
+
# @return [nil] if {#exploited} is `false`.
|
12
12
|
belongs_to :loot,
|
13
13
|
class_name: 'Mdm::Loot',
|
14
14
|
inverse_of: :vuln_attempt
|
15
15
|
|
16
|
-
#
|
17
|
-
# The session opened by this attempt.
|
16
|
+
# The session opened by this attempt.
|
18
17
|
#
|
19
|
-
#
|
20
|
-
#
|
18
|
+
# @return [Mdm::Session] if {#exploited} is `true`.
|
19
|
+
# @return [nil] if {#exploited} is `false`.
|
21
20
|
belongs_to :session,
|
22
21
|
class_name: 'Mdm::Session',
|
23
22
|
inverse_of: :vuln_attempt
|
24
23
|
|
25
|
-
#
|
26
|
-
# The {Mdm::Vuln vulnerability} that this attempt was exploiting.
|
24
|
+
# The {Mdm::Vuln vulnerability} that this attempt was exploiting.
|
27
25
|
#
|
28
|
-
#
|
26
|
+
# @return [Mdm::Vuln]
|
29
27
|
belongs_to :vuln,
|
30
28
|
class_name: 'Mdm::Vuln',
|
31
29
|
counter_cache: :vuln_attempt_count,
|
@@ -35,12 +33,39 @@ class Mdm::VulnAttempt < ActiveRecord::Base
|
|
35
33
|
# Attributes
|
36
34
|
#
|
37
35
|
|
38
|
-
# @!attribute
|
36
|
+
# @!attribute attempted_at
|
37
|
+
# When this attempt was made.
|
38
|
+
#
|
39
|
+
# @return [DateTime]
|
40
|
+
|
41
|
+
# @!attribute exploited
|
39
42
|
# Whether this attempt was successful.
|
40
43
|
#
|
41
44
|
# @return [true] if {#vuln} was exploited.
|
42
45
|
# @return [false] if {#vuln} was not exploited.
|
43
46
|
|
47
|
+
# @!attribute fail_detail
|
48
|
+
# Long details about why this attempt failed.
|
49
|
+
#
|
50
|
+
# @return [String] if {#exploited} is `false`.
|
51
|
+
# @return [nil] if {#exploited} is `true`.
|
52
|
+
|
53
|
+
# @!attribute fail_reason
|
54
|
+
# Short reason why this attempt failed.
|
55
|
+
#
|
56
|
+
# @return [String] if {#exploited} is `false`.
|
57
|
+
# @return [nil] if {#exploited} is `true`
|
58
|
+
|
59
|
+
# @!attribute module
|
60
|
+
# {Mdm::Module::Detail#fullname Full name of exploit Metasploit Module} that was used in this attempt.
|
61
|
+
#
|
62
|
+
# @return [String]
|
63
|
+
|
64
|
+
# @!attribute username
|
65
|
+
# The {Mdm::User#username name of the user} that made this attempt.
|
66
|
+
#
|
67
|
+
# @return [String]
|
68
|
+
|
44
69
|
#
|
45
70
|
# Validations
|
46
71
|
#
|
@@ -1,17 +1,150 @@
|
|
1
|
+
# {Mdm::Vuln Vulnerability details} supplied from an external source, such as Nexpose.
|
1
2
|
class Mdm::VulnDetail < ActiveRecord::Base
|
2
|
-
|
3
3
|
#
|
4
4
|
# Associations
|
5
5
|
#
|
6
6
|
|
7
|
+
# The vulnerability this detail is about.
|
8
|
+
belongs_to :vuln, class_name: 'Mdm::Vuln', counter_cache: :vuln_detail_count, inverse_of: :vuln_details
|
9
|
+
|
10
|
+
#
|
11
|
+
#
|
12
|
+
# Attributes
|
13
|
+
#
|
14
|
+
#
|
15
|
+
|
16
|
+
# @!attribute description
|
17
|
+
# Long description of this vulnerability.
|
18
|
+
#
|
19
|
+
# @return [String]
|
20
|
+
|
21
|
+
# @!attribute src
|
22
|
+
# Source of this vulnerability detail.
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
|
26
|
+
# @!attribute title
|
27
|
+
# Title of this vulnerability.
|
28
|
+
#
|
29
|
+
# @return [String]
|
30
|
+
|
31
|
+
# @!attribute proof
|
32
|
+
# Proof of this vulnerability existing on the target.
|
33
|
+
#
|
34
|
+
# @return [String]
|
35
|
+
|
36
|
+
# @!attribute solution
|
37
|
+
# Solution to fix this vulnerability.
|
38
|
+
#
|
39
|
+
# @return [String]
|
40
|
+
|
41
|
+
#
|
42
|
+
# @!group Common Vulnerability Scoring System
|
43
|
+
#
|
44
|
+
|
45
|
+
# @!attribute cvss_score
|
46
|
+
# Composite Common Vulnerability Scoring System (CVSS) Score
|
47
|
+
#
|
48
|
+
# @return [Float]
|
49
|
+
|
50
|
+
# @!attribute cvss_vector
|
51
|
+
# {#cvss_score} broken down into its encoded components
|
52
|
+
#
|
53
|
+
# @return [String]
|
54
|
+
# @see http://nvd.nist.gov/cvss.cfm?vectorinfo
|
55
|
+
|
56
|
+
#
|
57
|
+
# @!endgroup
|
58
|
+
#
|
59
|
+
|
60
|
+
#
|
61
|
+
# @!group Nexpose
|
62
|
+
#
|
63
|
+
|
64
|
+
# association is declared here so it can be in Nexpose group
|
65
|
+
|
66
|
+
# The Nexpose console that supplied this information.
|
7
67
|
belongs_to :nexpose_console,
|
8
68
|
class_name: 'Mdm::NexposeConsole',
|
69
|
+
foreign_key: :nx_console_id,
|
9
70
|
inverse_of: :vuln_details
|
10
71
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
72
|
+
# @!attribute nx_added
|
73
|
+
# When this vulnerability was added in Nexpose.
|
74
|
+
#
|
75
|
+
# @return [DateTime]
|
76
|
+
|
77
|
+
# @!attribute nx_device_id
|
78
|
+
# ID of target device in Nexpose.
|
79
|
+
#
|
80
|
+
# @return [Integer]
|
81
|
+
|
82
|
+
# @!attribute nx_modified
|
83
|
+
# The last time this vulnerability was modified in Nexpose.
|
84
|
+
#
|
85
|
+
# @return [DateTime]
|
86
|
+
|
87
|
+
# @!attribute nx_proof_key
|
88
|
+
# Key to {#proof} in Nexpose.
|
89
|
+
#
|
90
|
+
# @return [String]
|
91
|
+
|
92
|
+
# @!attribute nx_published
|
93
|
+
# When this vulnerability was published according to Nexpose.
|
94
|
+
#
|
95
|
+
# @return [DateTime]
|
96
|
+
|
97
|
+
# @!attribute nx_scan_id
|
98
|
+
# ID of scan that found this vulnerability in Nexpose.
|
99
|
+
#
|
100
|
+
# @return [Integer]
|
101
|
+
|
102
|
+
# @!attribute nx_tags
|
103
|
+
# Tags on this vulnerability in Nexpose.
|
104
|
+
#
|
105
|
+
# @return [String]
|
106
|
+
|
107
|
+
# @!attribute nx_vuln_id
|
108
|
+
# ID of this vulnerability in Nexpose.
|
109
|
+
#
|
110
|
+
# @return [String]
|
111
|
+
|
112
|
+
# @!attribute nx_vuln_status
|
113
|
+
# Status of this vulnerability in Nexpose.
|
114
|
+
#
|
115
|
+
# @return [String]
|
116
|
+
|
117
|
+
# @!attribute nx_vulnerable_since
|
118
|
+
# When this vulnerability was first identified for the target in Nexpose.
|
119
|
+
#
|
120
|
+
# @return [DateTime]
|
121
|
+
|
122
|
+
# @!attribute nx_severity
|
123
|
+
# Severity of this vulnerability according to Nexpose.
|
124
|
+
#
|
125
|
+
# @return [Float]
|
126
|
+
|
127
|
+
#
|
128
|
+
# @!endgroup
|
129
|
+
#
|
130
|
+
|
131
|
+
#
|
132
|
+
# @!group Nexpose PCI
|
133
|
+
#
|
134
|
+
|
135
|
+
# @!attribute nx_pci_compliance_status
|
136
|
+
# Status of PCI compliance with regards to this vulnerability according to Nexpose.
|
137
|
+
#
|
138
|
+
# @return [String]
|
139
|
+
|
140
|
+
# @!attribute nx_pci_severity
|
141
|
+
# The severity for the vulnerability under PCI according to Nexpose.
|
142
|
+
#
|
143
|
+
# @return [Float]
|
144
|
+
|
145
|
+
#
|
146
|
+
# @!endgroup
|
147
|
+
#
|
15
148
|
|
16
149
|
#
|
17
150
|
# Validations
|
data/app/models/mdm/vuln_ref.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# Join model between {Mdm::Vuln} and {Mdm::Ref}.
|
1
2
|
class Mdm::VulnRef < ActiveRecord::Base
|
2
3
|
self.table_name = 'vulns_refs'
|
3
4
|
|
@@ -5,10 +6,12 @@ class Mdm::VulnRef < ActiveRecord::Base
|
|
5
6
|
# Associations
|
6
7
|
#
|
7
8
|
|
9
|
+
# {Mdm::Ref Reference} to {#vuln}.
|
8
10
|
belongs_to :ref,
|
9
11
|
class_name: 'Mdm::Ref',
|
10
12
|
inverse_of: :vulns_refs
|
11
13
|
|
14
|
+
# {Mdm::Vuln Vulnerability} imported or discovered by metasploit.
|
12
15
|
belongs_to :vuln,
|
13
16
|
class_name: 'Mdm::Vuln',
|
14
17
|
inverse_of: :vulns_refs
|
data/app/models/mdm/web_form.rb
CHANGED
@@ -1,17 +1,51 @@
|
|
1
|
+
# A filled-in form on a {#web_site}.
|
1
2
|
class Mdm::WebForm < ActiveRecord::Base
|
2
3
|
|
3
4
|
#
|
4
5
|
# Associations
|
5
6
|
#
|
6
7
|
|
8
|
+
# {Mdm::WebSite Web site} on which this form is.
|
7
9
|
belongs_to :web_site,
|
8
10
|
class_name: 'Mdm::WebSite',
|
9
11
|
inverse_of: :web_forms
|
10
12
|
|
13
|
+
#
|
14
|
+
# Attributes
|
15
|
+
#
|
16
|
+
|
17
|
+
# @!attribute created_at
|
18
|
+
# When this web form was created.
|
19
|
+
#
|
20
|
+
# @return [DateTime]
|
21
|
+
|
22
|
+
# @!attribute method
|
23
|
+
# HTTP method (or verb) used to submitted this form, such as GET or POST.
|
24
|
+
#
|
25
|
+
# @return [String]
|
26
|
+
|
27
|
+
# @!attribute path
|
28
|
+
# Path portion of URL to which this form was submitted.
|
29
|
+
#
|
30
|
+
# @return [String]
|
31
|
+
|
32
|
+
# @!attribute query
|
33
|
+
# URL query that submitted for this form.
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
|
37
|
+
# @!attribute updated_at
|
38
|
+
# The last time this web form was updated.
|
39
|
+
#
|
40
|
+
# @return [DateTime]
|
41
|
+
|
11
42
|
#
|
12
43
|
# Serializations
|
13
44
|
#
|
14
45
|
|
46
|
+
# Parameters submitted in this form.
|
47
|
+
#
|
48
|
+
# @return [Array<Array(String, String)>>]
|
15
49
|
serialize :params, MetasploitDataModels::Base64Serializer.new
|
16
50
|
|
17
51
|
Metasploit::Concern.run(self)
|
data/app/models/mdm/web_page.rb
CHANGED
@@ -1,17 +1,86 @@
|
|
1
|
+
# Web page requested from a {#web_site}.
|
1
2
|
class Mdm::WebPage < ActiveRecord::Base
|
2
3
|
|
3
4
|
#
|
4
5
|
# Associations
|
5
6
|
#
|
6
7
|
|
8
|
+
# Mdm::WebSite Web site} from which this page was requested.
|
7
9
|
belongs_to :web_site,
|
8
10
|
class_name: 'Mdm::WebSite',
|
9
11
|
inverse_of: :web_pages
|
10
12
|
|
13
|
+
#
|
14
|
+
# Attributes
|
15
|
+
#
|
16
|
+
|
17
|
+
# @!attribute auth
|
18
|
+
# Credentials sent to server to authenticate to web site to allow access to this web page.
|
19
|
+
#
|
20
|
+
# @return [String]
|
21
|
+
|
22
|
+
# @!attribute body
|
23
|
+
# Body of response from server.
|
24
|
+
#
|
25
|
+
# @return [String]
|
26
|
+
|
27
|
+
# @!attribute code
|
28
|
+
# HTTP Status code return from {#web_site} when requesting this web page.
|
29
|
+
#
|
30
|
+
# @return [Integer]
|
31
|
+
|
32
|
+
# @!attribute cookie
|
33
|
+
# Cookies derived from {#headers}.
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
|
37
|
+
# @!attribute created_at
|
38
|
+
# When this web page was created.
|
39
|
+
#
|
40
|
+
# @return [DateTime]
|
41
|
+
|
42
|
+
# @!attribute ctype
|
43
|
+
# The content type derived from the {#headers} of the returned web page.
|
44
|
+
#
|
45
|
+
# @return [String]
|
46
|
+
|
47
|
+
# @!attribute location
|
48
|
+
# Location derived from {#headers}.
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
|
52
|
+
# @!attribute mtime
|
53
|
+
# The last modified time of the web page derived from the {#headers}.
|
54
|
+
#
|
55
|
+
# @return [DateTime]
|
56
|
+
|
57
|
+
# @!attribute path
|
58
|
+
# Path portion of URL that was used to access this web page.
|
59
|
+
#
|
60
|
+
# @return [String]
|
61
|
+
|
62
|
+
# @!attribute query
|
63
|
+
# Query portion of URLthat was used to access this web page.
|
64
|
+
#
|
65
|
+
# @return [String]
|
66
|
+
|
67
|
+
# @!attribute request
|
68
|
+
# Request sent to server to cause this web page to be returned.
|
69
|
+
#
|
70
|
+
# @return [String]
|
71
|
+
|
72
|
+
# @!attribute updated_at
|
73
|
+
# The last time this web page was updated.
|
74
|
+
#
|
75
|
+
# @return [DateTime]
|
76
|
+
|
11
77
|
#
|
12
78
|
# Serializations
|
13
79
|
#
|
14
80
|
|
81
|
+
# Headers sent from server.
|
82
|
+
#
|
83
|
+
# @return [Hash{String => String}]
|
15
84
|
serialize :headers, MetasploitDataModels::Base64Serializer.new
|
16
85
|
|
17
86
|
Metasploit::Concern.run(self)
|
data/app/models/mdm/web_site.rb
CHANGED
@@ -1,43 +1,90 @@
|
|
1
|
+
# A Web Site running on a {#service}.
|
1
2
|
class Mdm::WebSite < ActiveRecord::Base
|
2
3
|
|
3
4
|
#
|
4
5
|
# Associations
|
5
6
|
#
|
6
7
|
|
8
|
+
# The service on which this web site is running.
|
7
9
|
belongs_to :service,
|
8
10
|
class_name: 'Mdm::Service',
|
9
11
|
foreign_key: 'service_id',
|
10
12
|
inverse_of: :web_sites
|
11
13
|
|
14
|
+
# Filled-in forms within this web site.
|
12
15
|
has_many :web_forms,
|
13
16
|
class_name: 'Mdm::WebForm',
|
14
17
|
dependent: :destroy,
|
15
18
|
inverse_of: :web_site
|
16
19
|
|
20
|
+
# Web pages found on this web site.
|
17
21
|
has_many :web_pages,
|
18
22
|
class_name: 'Mdm::WebPage',
|
19
23
|
dependent: :destroy,
|
20
24
|
inverse_of: :web_site
|
21
25
|
|
26
|
+
# Vulnerabilities found on this web site.
|
22
27
|
has_many :web_vulns,
|
23
28
|
class_name: 'Mdm::WebVuln',
|
24
29
|
dependent: :destroy,
|
25
30
|
inverse_of: :web_site
|
26
31
|
|
32
|
+
#
|
33
|
+
# Attributes
|
34
|
+
#
|
35
|
+
|
36
|
+
# @!attribute [rw] comments
|
37
|
+
# User entered comments about this web site.
|
38
|
+
#
|
39
|
+
# @return [String]
|
40
|
+
|
41
|
+
# @!attribute [rw] created_at
|
42
|
+
# When this web site was created.
|
43
|
+
#
|
44
|
+
# @return [DateTime]
|
45
|
+
|
46
|
+
# @!attribute [rw] updated_at
|
47
|
+
# The last time this web site was updated.
|
48
|
+
#
|
49
|
+
# @return [DateTime]
|
50
|
+
|
51
|
+
# @!attribute [rw] vhost
|
52
|
+
# The virtual host for the web site in case `service.host.name` or `service.host.address` is no the host for this
|
53
|
+
# web site.
|
54
|
+
#
|
55
|
+
# @return [String]
|
56
|
+
|
27
57
|
#
|
28
58
|
# Serializations
|
29
59
|
#
|
30
60
|
|
61
|
+
# @!attribute [rw] options
|
62
|
+
# @todo Determine format and purpose of Mdm::WebSite#options.
|
31
63
|
serialize :options, ::MetasploitDataModels::Base64Serializer.new
|
32
64
|
|
65
|
+
#
|
66
|
+
# Instance Methods
|
67
|
+
#
|
68
|
+
|
69
|
+
# Number of {#web_forms}.
|
70
|
+
#
|
71
|
+
# @return [Integer]
|
33
72
|
def form_count
|
34
73
|
web_forms.size
|
35
74
|
end
|
36
75
|
|
76
|
+
# Number of {#web_pages}.
|
77
|
+
#
|
78
|
+
# @return [Integer]
|
37
79
|
def page_count
|
38
80
|
web_pages.size
|
39
81
|
end
|
40
82
|
|
83
|
+
# Converts this web site to its URL, including scheme, host and port.
|
84
|
+
#
|
85
|
+
# @param ignore_vhost [Boolean] if `false` use {#vhost} for host portion of URL. If `true` use {Mdm::Host#address} of
|
86
|
+
# {Mdm::Service#host} of {#service} for host portion of URL.
|
87
|
+
# @return [String] <scheme>://<host>[:<port>]
|
41
88
|
def to_url(ignore_vhost=false)
|
42
89
|
proto = self.service.name == "https" ? "https" : "http"
|
43
90
|
host = ignore_vhost ? self.service.host.address.to_s : self.vhost
|
@@ -54,6 +101,9 @@ class Mdm::WebSite < ActiveRecord::Base
|
|
54
101
|
url
|
55
102
|
end
|
56
103
|
|
104
|
+
# Number of {#web_vulns}.
|
105
|
+
#
|
106
|
+
# @return [Integer]
|
57
107
|
def vuln_count
|
58
108
|
web_vulns.size
|
59
109
|
end
|