nessus 0.1.0.beta.8 → 0.1.0.beta.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nessus/client/report.rb +68 -1
- data/lib/nessus/version.rb +1 -1
- metadata +2 -2
data/lib/nessus/client/report.rb
CHANGED
@@ -115,6 +115,18 @@ module Nessus
|
|
115
115
|
end
|
116
116
|
|
117
117
|
# @return [Array<Hash>] reports by readablename regex
|
118
|
+
def report_find_by_name(name)
|
119
|
+
report_list.find_all do |report|
|
120
|
+
report['name'] == name
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def report_find_by_readablename(readablename)
|
125
|
+
report_list.find_all do |report|
|
126
|
+
report['readablename'] == readablename
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
118
130
|
def report_find_all(name)
|
119
131
|
report_list.find_all do |report|
|
120
132
|
report['readablename'] =~ /#{name}/i
|
@@ -149,10 +161,65 @@ module Nessus
|
|
149
161
|
end
|
150
162
|
}
|
151
163
|
end
|
152
|
-
|
153
164
|
report_hash = report_element_array.inject(:merge)
|
154
165
|
json_report = JSON.pretty_generate(report_hash)
|
155
166
|
end
|
167
|
+
|
168
|
+
def report_plugin_summary(report_findings)
|
169
|
+
ip_findings_arr = report_findings.map do |hostname, reports|
|
170
|
+
[
|
171
|
+
reports.map { |report|
|
172
|
+
if report['findings']['portdetails']['reportitem'].is_a? Hash
|
173
|
+
{
|
174
|
+
'plugin_id' => report['findings']['portdetails']['reportitem']['pluginid'],
|
175
|
+
'plugin_name' => report['findings']['portdetails']['reportitem']['pluginname'],
|
176
|
+
}
|
177
|
+
else
|
178
|
+
report['findings']['portdetails']['reportitem'].map do |report_item|
|
179
|
+
{
|
180
|
+
'plugin_id' => report_item['pluginid'],
|
181
|
+
'plugin_name' => report_item['pluginname']
|
182
|
+
}
|
183
|
+
end
|
184
|
+
end
|
185
|
+
}.flatten,
|
186
|
+
hostname
|
187
|
+
]
|
188
|
+
end
|
189
|
+
ip_findings = Hash[ip_findings_arr]
|
190
|
+
|
191
|
+
plugin_id_arr = ip_findings.keys.flatten.uniq.map do |ip_finding|
|
192
|
+
[
|
193
|
+
ip_finding['plugin_id'],
|
194
|
+
{
|
195
|
+
'hosts' => ip_findings.map { |ids, hostname|
|
196
|
+
if ids.map { |id| id['plugin_id'] }.include? ip_finding['plugin_id']
|
197
|
+
hostname
|
198
|
+
end
|
199
|
+
}.compact,
|
200
|
+
'plugin_name' => ip_finding['plugin_name']
|
201
|
+
}
|
202
|
+
]
|
203
|
+
end
|
204
|
+
plugin_id_to_hostname = Hash[plugin_id_arr]
|
205
|
+
end
|
206
|
+
|
207
|
+
def report_item(report_findings, host, plugin_id)
|
208
|
+
report_findings[host].map { |report|
|
209
|
+
if report['findings']['portdetails']['reportitem'].is_a? Hash
|
210
|
+
if report['findings']['portdetails']['reportitem']['pluginid'].eql? plugin_id
|
211
|
+
report['findings']['portdetails']['reportitem']
|
212
|
+
end
|
213
|
+
else
|
214
|
+
report['findings']['portdetails']['reportitem'].find_all do |report_item|
|
215
|
+
if report_item['pluginid'].eql? plugin_id
|
216
|
+
report_item
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
}.flatten.compact
|
221
|
+
end
|
222
|
+
|
156
223
|
# @!endgroup
|
157
224
|
end
|
158
225
|
end
|
data/lib/nessus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nessus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.beta.
|
4
|
+
version: 0.1.0.beta.9
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-12-
|
13
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|