Class: Risu::Base::PostProcessBase
- Inherits:
-
Object
- Object
- Risu::Base::PostProcessBase
show all
- Defined in:
- lib/risu/base/post_process_base.rb
Direct Known Subclasses
Parsers::Nessus::PostProcess::AbobeCreativeCloudDesktopRollup, Parsers::Nessus::PostProcess::AdobeAcrobat, Parsers::Nessus::PostProcess::AdobeAir, Parsers::Nessus::PostProcess::AdobeColdfusionPatchRollup, Parsers::Nessus::PostProcess::AdobeFlashPlayer, Parsers::Nessus::PostProcess::AdobeReader, Parsers::Nessus::PostProcess::AdobeShockwavePlayer, Parsers::Nessus::PostProcess::Apache, Parsers::Nessus::PostProcess::ApacheTomcatRollups, Parsers::Nessus::PostProcess::AppleICloudRollup, Parsers::Nessus::PostProcess::AppleQuicktime, Parsers::Nessus::PostProcess::AppleiTunesPatchRollup, Parsers::Nessus::PostProcess::ArtifexGhostscriptRollup, Parsers::Nessus::PostProcess::BlackBerryEnterpriseServerRollups, Parsers::Nessus::PostProcess::CABrightstorArcServe, Parsers::Nessus::PostProcess::CiscoAnyConnectPatchRollup, Parsers::Nessus::PostProcess::CiscoIOSPatchRollup, Parsers::Nessus::PostProcess::CiscoTelepresenceRollup, Parsers::Nessus::PostProcess::CoreFTP, Parsers::Nessus::PostProcess::DB2, Parsers::Nessus::PostProcess::DellIDracRollup, Parsers::Nessus::PostProcess::DowngradePlugins, Parsers::Nessus::PostProcess::DropbearSSHServerPatchRollup, Parsers::Nessus::PostProcess::ESXi, Parsers::Nessus::PostProcess::FileZillaClient, Parsers::Nessus::PostProcess::FirefoxRollups, Parsers::Nessus::PostProcess::Flexnet, Parsers::Nessus::PostProcess::FoxitPhantomPDFPatchRollup, Parsers::Nessus::PostProcess::FoxitReaderRollups, Parsers::Nessus::PostProcess::GoogleChrome, Parsers::Nessus::PostProcess::HPSystemMgtHomePage, Parsers::Nessus::PostProcess::ILoRollup, Parsers::Nessus::PostProcess::IntelMgtServerPatchRollup, Parsers::Nessus::PostProcess::IrfanViewPatchRollup, Parsers::Nessus::PostProcess::Java, Parsers::Nessus::PostProcess::LibreOfficePatchRollup, Parsers::Nessus::PostProcess::MicrosoftOfficeRollup, Parsers::Nessus::PostProcess::MicrosoftVisualStudioRollup, Parsers::Nessus::PostProcess::MicrosoftWindowsPatches, Parsers::Nessus::PostProcess::MongoDBRollup, Parsers::Nessus::PostProcess::MozzilaThunderbirdPatchRollup, Parsers::Nessus::PostProcess::NormalizePluginNames, Parsers::Nessus::PostProcess::OpenOfficePatchRollup, Parsers::Nessus::PostProcess::OpenSSHRollups, Parsers::Nessus::PostProcess::OpenSSLRollups, Parsers::Nessus::PostProcess::OracleDatabase, Parsers::Nessus::PostProcess::PHP, Parsers::Nessus::PostProcess::PuTTYRollup, Parsers::Nessus::PostProcess::RealPlayerPatchRollup, Parsers::Nessus::PostProcess::RiskScore, Parsers::Nessus::PostProcess::RootCauses, Parsers::Nessus::PostProcess::SambaRollup, Parsers::Nessus::PostProcess::ServU, Parsers::Nessus::PostProcess::SevenZipPatchRollup, Parsers::Nessus::PostProcess::SigPlusPro, Parsers::Nessus::PostProcess::SkypePatchRollup, Parsers::Nessus::PostProcess::SolarWindsDameWareRollup, Parsers::Nessus::PostProcess::SymantecEndpointPatchRollup, Parsers::Nessus::PostProcess::SymantecPcAnywhereRollups, Parsers::Nessus::PostProcess::TenableNessusRollup, Parsers::Nessus::PostProcess::TimbuktuProPatchRollup, Parsers::Nessus::PostProcess::VLCRollups, Parsers::Nessus::PostProcess::VMwarePlayer, Parsers::Nessus::PostProcess::VMwareVCenter, Parsers::Nessus::PostProcess::VmwareVsphereClientRollups, Parsers::Nessus::PostProcess::WinSCP, Parsers::Nessus::PostProcess::Wireshark
Class Attribute Summary collapse
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Class Attribute Details
.possible_postprocesses ⇒ Object
Returns the value of attribute possible_postprocesses.
30
31
32
|
# File 'lib/risu/base/post_process_base.rb', line 30
def possible_postprocesses
@possible_postprocesses
end
|
Instance Attribute Details
#info ⇒ Object
Returns the value of attribute info.
34
35
36
|
# File 'lib/risu/base/post_process_base.rb', line 34
def info
@info
end
|
Class Method Details
.inherited(child) ⇒ Object
37
38
39
|
# File 'lib/risu/base/post_process_base.rb', line 37
def self.inherited child
possible_postprocesses << child
end
|
Instance Method Details
#<=>(other) ⇒ Object
52
53
54
55
56
57
58
59
60
|
# File 'lib/risu/base/post_process_base.rb', line 52
def <=> other
if self.info[:plugin_id] < other.info[:plugin_id]
-1
elsif self.info[:plugin_id] > other.info[:plugin_id]
1
else
0
end
end
|
#==(other) ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/risu/base/post_process_base.rb', line 41
def == other
if self.info == nil || self.info[:plugin_id] == nil
false
elsif other == nil || other.info == nil || other.info[:plugin_id] == nil
false
else
self.info[:plugin_id] == other.info[:plugin_id]
end
end
|
#calculate_severity(current_severity, severity) ⇒ Object
189
190
191
192
193
194
195
|
# File 'lib/risu/base/post_process_base.rb', line 189
def calculate_severity current_severity, severity
if severity > current_severity
return severity
else
return current_severity
end
end
|
#create_item(host_id, severity) ⇒ Object
165
166
167
168
169
170
171
172
173
174
175
176
177
|
# File 'lib/risu/base/post_process_base.rb', line 165
def create_item host_id, severity
item = Item.new
item.host_id = host_id
item.plugin_id = @info[:plugin_id]
item.plugin_output = nil
item.port = 0
item.severity = severity
item.plugin_name = @info[:item_name]
item.rollup_finding = true
item.save
end
|
#create_plugin ⇒ Object
Create a plugin based on a combination of all plugins to be rolled up.
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# File 'lib/risu/base/post_process_base.rb', line 64
def create_plugin
plugin = Plugin.find_by_id(@info[:plugin_id])
if plugin == nil
plugin = Plugin.new
end
plugin.id = @info[:plugin_id]
plugin.plugin_name = @info[:plugin_name]
plugin.description = @info[:description]
plugin.plugin_version = @info[:version]
plugin.plugin_publication_date = @info[:publication_date]
plugin.plugin_modification_date = @info[:modification_date]
plugin.family_name = "Risu Rollup Plugins"
plugin.synopsis = "Software often has vulnerabilities that are corrected in newer versions. It was determined that an older version of the software is installed on this system."
plugin.solution = "If possible, update to the latest version of the software."
plugin.plugin_type = "Rollup"
plugin.rollup = true
plugin.compliance = false
begin
p = Plugin.where(:id => @info[:plugin_ids]).where.not(:vuln_publication_date => nil).order(:vuln_publication_date).first
unless p.nil?
plugin.vuln_publication_date = p.vuln_publication_date
end
end
begin
p = Plugin.where(:id => @info[:plugin_ids]).where.not(:cvss_base_score => nil).order(:cvss_base_score).last
unless p.nil?
plugin.cvss_base_score = p.cvss_base_score
plugin.cvss_vector = p.cvss_vector
end
end
begin
p = Plugin.where(:id => @info[:plugin_ids]).where.not(:cvss_temporal_score => nil).order(:cvss_temporal_score).last
unless p.nil?
plugin.cvss_temporal_score = p.cvss_temporal_score
plugin.cvss_temporal_vector = p.cvss_temporal_vector
end
end
if Plugin.where(:id => @info[:plugin_ids], :exploit_available => true).count > 0
plugin.exploit_available = true
end
if Plugin.where(:id => @info[:plugin_ids], :exploit_framework_core => "true").count > 0
plugin.exploit_framework_core = true
end
if Plugin.where(:id => @info[:plugin_ids], :exploit_framework_metasploit => "true").count > 0
plugin.exploit_framework_metasploit = true
end
if Plugin.where(:id => @info[:plugin_ids], :exploit_framework_canvas => "true").count > 0
plugin.exploit_framework_canvas = true
end
if Plugin.where(:id => @info[:plugin_ids], :exploit_framework_exploithub => "true").count > 0
plugin.exploit_framework_exploithub = true
end
if Plugin.where(:id => @info[:plugin_ids], :exploit_framework_d2_elliot => "true").count > 0
plugin.exploit_framework_d2_elliot = true
end
if Plugin.where(:id => @info[:plugin_ids], :in_the_news => true).count > 0
plugin.in_the_news = true
end
if Plugin.where(:id => @info[:plugin_ids], :exploited_by_malware => "true").count > 0
plugin.exploited_by_malware = true
end
["Critical", "High", "Medium", "Low", "Info"].each do |risk|
if Plugin.where(:id => @info[:plugin_ids], :risk_factor => risk).size > 0
plugin.risk_factor = risk
break
end
end
begin
p = Plugin.where(:id => @info[:plugin_ids]).where.not(:stig_severity => nil).order(:stig_severity).first
unless p.nil?
plugin.stig_severity = p.stig_severity
end
end
plugin.save
end
|
#has_findings ⇒ Object
180
181
182
|
# File 'lib/risu/base/post_process_base.rb', line 180
def has_findings
Item.where(:plugin_id => @info[:plugin_ids]).count > 0
end
|
#has_host_findings(host_id) ⇒ Object
184
185
186
|
# File 'lib/risu/base/post_process_base.rb', line 184
def has_host_findings(host_id)
Item.where(:plugin_id => @info[:plugin_ids]).where(:host_id => host_id).count > 0
end
|
#run ⇒ Object
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
# File 'lib/risu/base/post_process_base.rb', line 198
def run
if !has_findings()
return
end
if Plugin.where(:id => @info[:plugin_ids]).count > 0
create_plugin()
end
finding_severity = 0
Host.all.each do |host|
if !has_host_findings(host.id)
next
end
@info[:plugin_ids].each do |plugin_id|
Item.where(:plugin_id => plugin_id).each do |item|
severity = item.severity
item.real_severity = severity
item.severity = -1
item.save
finding_severity = calculate_severity(finding_severity, severity)
end
end
create_item(host.id, finding_severity)
end
end
|