ruby-nessus 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -54,7 +54,7 @@ You also have the ability to search for particular hostnames. In the near future
54
54
 
55
55
  puts host.scan_start_time
56
56
  puts host.scan_stop_time
57
- puts host.scan_run_time
57
+ puts host.scan_runtime
58
58
 
59
59
  host.events do |event|
60
60
  puts event.severity.in_words
@@ -85,7 +85,7 @@ There are a bunch of convenient methods added to make reporting a bit easier to
85
85
  scan.hosts do |host|
86
86
  puts host.hostname
87
87
 
88
- # high_severity_events, medium_severity_events, low_severity_events and informational_severity_events
88
+ # high_severity_events, medium_severity_events and low_severity_events
89
89
  host.high_severity_events do |high|
90
90
  puts high.port
91
91
  puts high.name if high.name
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/examples/example.rb CHANGED
@@ -20,7 +20,7 @@ Nessus::XML.new("example.nessus") do |scan|
20
20
 
21
21
  scan.hosts do |host|
22
22
  puts "Hostname: #{host.hostname}"
23
- puts "Open Ports: #{host.scanned_ports_count}"
23
+ puts "Open Ports: #{host.open_ports}"
24
24
  puts "High Severity Events: #{host.high_severity_events}"
25
25
  puts "Medium Severity Events: #{host.medium_severity_events}"
26
26
  puts "Low Severity Events: #{host.low_severity_events}"
@@ -0,0 +1,88 @@
1
+ $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
2
+
3
+ require 'rubygems'
4
+ require 'ruby-nessus'
5
+ require 'prawn'
6
+ require 'prawn/layout'
7
+
8
+ @pdf = Prawn::Document.new
9
+
10
+ Nessus::XML.new("example.nessus") do |scan|
11
+
12
+ @pdf.font_size = 9
13
+
14
+ @pdf.footer [@pdf.margin_box.left, @pdf.margin_box.bottom + 25] do
15
+ @pdf.font "Helvetica" do
16
+ @pdf.stroke_horizontal_rule
17
+ @pdf.move_down(10)
18
+ @pdf.text "Ruby-Nessus - http://github.com/mephux/ruby-nessus", :size => 9, :align => :center
19
+ end
20
+ end
21
+
22
+ @pdf.text("#{scan.title.split(' - ')[1]}", :size => 20)
23
+
24
+ @pdf.move_down 2
25
+
26
+ @pdf.text("Policy: #{scan.policy_name}")
27
+ @pdf.text("Policy Description: #{scan.policy_name}")
28
+ @pdf.text("Runtime: #{scan.runtime}")
29
+
30
+ @pdf.move_down 10
31
+
32
+ @pdf.bounding_box [0,@pdf.cursor], :width => 490 do
33
+
34
+ @pdf.move_down 10
35
+
36
+ data = [["#{scan.host_count}", "#{scan.low_severity_count}", "#{scan.medium_severity_count}", "#{scan.high_severity_count}", "#{scan.open_ports_count}", "#{scan.total_event_count}"]]
37
+
38
+ @pdf.table data,
39
+ :position => :left,
40
+ :border_style => :grid,
41
+ :headers => ['Host Count', 'Low Severity Events', 'Medium Severity Events', 'High Severity Events', 'Open Ports', 'Total Event Count'],
42
+ :align => :left,
43
+ :font_size => 9,
44
+ :row_colors => :pdf_writer,
45
+ :align_headers => :left
46
+
47
+ @pdf.move_down 10
48
+
49
+ @pdf.stroke do
50
+ @pdf.line @pdf.bounds.top_left, @pdf.bounds.top_right
51
+ @pdf.line @pdf.bounds.bottom_left, @pdf.bounds.bottom_right
52
+ end
53
+
54
+ end
55
+
56
+ scan.hosts do |host|
57
+
58
+ @pdf.move_down(20)
59
+
60
+ @pdf.bounding_box [0,@pdf.cursor], :width => 490 do
61
+ @pdf.move_down(10)
62
+ @pdf.text("#{host.hostname}", :size => 18)
63
+ @pdf.text("Scan Time: #{host.scan_runtime}")
64
+ @pdf.text("Low: #{host.low_severity_events} Medium: #{host.medium_severity_events} High: #{host.high_severity_events} Total: #{host.event_count}")
65
+ @pdf.text("Operating System: #{host.operating_system}")
66
+ @pdf.move_down 10
67
+ @pdf.stroke do
68
+ @pdf.line @pdf.bounds.bottom_left, @pdf.bounds.bottom_right
69
+ end
70
+ end
71
+ @pdf.move_down(10)
72
+
73
+ @i = 0
74
+ host.events do |event|
75
+
76
+ next if event.severity.to_i <= 1
77
+ @pdf.text("#{@i+=1}. #{event.name}", :size => 11)
78
+ @pdf.text("\t\t\t- #{event.severity.in_words}")
79
+ @pdf.text("\t\t\t- #{event.port}")
80
+ @pdf.move_down(10)
81
+ end
82
+
83
+ end
84
+ end
85
+
86
+ puts "PDF Created Successfully!"
87
+
88
+ @pdf.render_file('ruby-nessus-example.pdf')
@@ -0,0 +1,529 @@
1
+ %PDF-1.3
2
+ ����
3
+ 1 0 obj
4
+ << /Creator (Prawn)
5
+ /Producer (Prawn)
6
+ >>
7
+ endobj
8
+ 2 0 obj
9
+ << /Type /Pages
10
+ /Count 1
11
+ /Kids [5 0 R]
12
+ >>
13
+ endobj
14
+ 3 0 obj
15
+ << /Pages 2 0 R
16
+ /Type /Catalog
17
+ >>
18
+ endobj
19
+ 4 0 obj
20
+ << /Length 6720
21
+ >>
22
+ stream
23
+ 0.000 0.000 0.000 rg
24
+ 0.000 0.000 0.000 RG
25
+ q
26
+
27
+ BT
28
+ 36 741.64 Td
29
+ /F1.0 20 Tf
30
+ [<527562> 20 <792d4e6573737573204578616d706c652050> 50 <6f6c696379>] TJ
31
+ ET
32
+
33
+
34
+ BT
35
+ 36 724.418 Td
36
+ /F1.0 9 Tf
37
+ [<50> 50 <6f6c6963793a> 50 <20527562> 20 <792d4e6573737573204578616d706c652050> 50 <6f6c696379>] TJ
38
+ ET
39
+
40
+
41
+ BT
42
+ 36 714.014 Td
43
+ /F1.0 9 Tf
44
+ [<50> 50 <6f6c696379204465736372> -15 <697074696f6e3a> 50 <20527562> 20 <792d4e6573737573204578616d706c652050> 50 <6f6c696379>] TJ
45
+ ET
46
+
47
+
48
+ BT
49
+ 36 703.61 Td
50
+ /F1.0 9 Tf
51
+ [<52756e74696d653a> 50 <203020686f757273203130206d696e> 10 <7574657320616e642036207365636f6e6473>] TJ
52
+ ET
53
+
54
+ 1.000 1.000 1.000 rg
55
+ 36.500 659.764 55.000 19.404 re
56
+ f
57
+ 0.000 0.000 0.000 rg
58
+ 1 w
59
+ 36.000 680.168 m
60
+ 36.000 658.764 l
61
+ S
62
+ 92.000 680.168 m
63
+ 92.000 658.764 l
64
+ S
65
+ 36.500 679.668 m
66
+ 91.500 679.668 l
67
+ S
68
+ 36.000 659.264 m
69
+ 92.000 659.264 l
70
+ S
71
+ 0.000 0.000 0.000 RG
72
+ 1 w
73
+
74
+ BT
75
+ 41 666.235 Td
76
+ /F1.0 9 Tf
77
+ [<486f737420436f756e74>] TJ
78
+ ET
79
+
80
+ 0.000 0.000 0.000 rg
81
+ 1.000 1.000 1.000 rg
82
+ 92.500 659.764 91.000 19.404 re
83
+ f
84
+ 0.000 0.000 0.000 rg
85
+ 1 w
86
+ 92.000 680.168 m
87
+ 92.000 658.764 l
88
+ S
89
+ 184.000 680.168 m
90
+ 184.000 658.764 l
91
+ S
92
+ 92.500 679.668 m
93
+ 183.500 679.668 l
94
+ S
95
+ 92.000 659.264 m
96
+ 184.000 659.264 l
97
+ S
98
+ 0.000 0.000 0.000 RG
99
+ 1 w
100
+
101
+ BT
102
+ 97 666.235 Td
103
+ /F1.0 9 Tf
104
+ [<4c6f> 15 <77205365> 30 <76> 25 <6572> -15 <697479204576> 25 <656e7473>] TJ
105
+ ET
106
+
107
+ 0.000 0.000 0.000 rg
108
+ 1.000 1.000 1.000 rg
109
+ 184.500 659.764 107.000 19.404 re
110
+ f
111
+ 0.000 0.000 0.000 rg
112
+ 1 w
113
+ 184.000 680.168 m
114
+ 184.000 658.764 l
115
+ S
116
+ 292.000 680.168 m
117
+ 292.000 658.764 l
118
+ S
119
+ 184.500 679.668 m
120
+ 291.500 679.668 l
121
+ S
122
+ 184.000 659.264 m
123
+ 292.000 659.264 l
124
+ S
125
+ 0.000 0.000 0.000 RG
126
+ 1 w
127
+
128
+ BT
129
+ 189 666.235 Td
130
+ /F1.0 9 Tf
131
+ [<4d656469756d205365> 30 <76> 25 <6572> -15 <697479204576> 25 <656e7473>] TJ
132
+ ET
133
+
134
+ 0.000 0.000 0.000 rg
135
+ 1.000 1.000 1.000 rg
136
+ 292.500 659.764 93.000 19.404 re
137
+ f
138
+ 0.000 0.000 0.000 rg
139
+ 1 w
140
+ 292.000 680.168 m
141
+ 292.000 658.764 l
142
+ S
143
+ 386.000 680.168 m
144
+ 386.000 658.764 l
145
+ S
146
+ 292.500 679.668 m
147
+ 385.500 679.668 l
148
+ S
149
+ 292.000 659.264 m
150
+ 386.000 659.264 l
151
+ S
152
+ 0.000 0.000 0.000 RG
153
+ 1 w
154
+
155
+ BT
156
+ 297 666.235 Td
157
+ /F1.0 9 Tf
158
+ [<48696768205365> 30 <76> 25 <6572> -15 <697479204576> 25 <656e7473>] TJ
159
+ ET
160
+
161
+ 0.000 0.000 0.000 rg
162
+ 1.000 1.000 1.000 rg
163
+ 386.500 659.764 55.000 19.404 re
164
+ f
165
+ 0.000 0.000 0.000 rg
166
+ 1 w
167
+ 386.000 680.168 m
168
+ 386.000 658.764 l
169
+ S
170
+ 442.000 680.168 m
171
+ 442.000 658.764 l
172
+ S
173
+ 386.500 679.668 m
174
+ 441.500 679.668 l
175
+ S
176
+ 386.000 659.264 m
177
+ 442.000 659.264 l
178
+ S
179
+ 0.000 0.000 0.000 RG
180
+ 1 w
181
+
182
+ BT
183
+ 391 666.235 Td
184
+ /F1.0 9 Tf
185
+ [<4f70656e2050> 50 <6f72> -40 <7473>] TJ
186
+ ET
187
+
188
+ 0.000 0.000 0.000 rg
189
+ 1.000 1.000 1.000 rg
190
+ 442.500 659.764 82.000 19.404 re
191
+ f
192
+ 0.000 0.000 0.000 rg
193
+ 1 w
194
+ 442.000 680.168 m
195
+ 442.000 658.764 l
196
+ S
197
+ 525.000 680.168 m
198
+ 525.000 658.764 l
199
+ S
200
+ 442.500 679.668 m
201
+ 524.500 679.668 l
202
+ S
203
+ 442.000 659.264 m
204
+ 525.000 659.264 l
205
+ S
206
+ 0.000 0.000 0.000 RG
207
+ 1 w
208
+
209
+ BT
210
+ 447 666.235 Td
211
+ /F1.0 9 Tf
212
+ [<54> 120 <6f74616c204576> 25 <656e7420436f756e74>] TJ
213
+ ET
214
+
215
+ 0.000 0.000 0.000 rg
216
+ 0.800 0.800 0.800 rg
217
+ 36.500 639.360 55.000 19.404 re
218
+ f
219
+ 0.000 0.000 0.000 rg
220
+ 1 w
221
+ 36.000 659.764 m
222
+ 36.000 638.360 l
223
+ S
224
+ 92.000 659.764 m
225
+ 92.000 638.360 l
226
+ S
227
+ 36.500 659.264 m
228
+ 91.500 659.264 l
229
+ S
230
+ 36.000 638.860 m
231
+ 92.000 638.860 l
232
+ S
233
+ 0.000 0.000 0.000 RG
234
+ 1 w
235
+
236
+ BT
237
+ 41 645.831 Td
238
+ /F1.0 9 Tf
239
+ [<31>] TJ
240
+ ET
241
+
242
+ 0.000 0.000 0.000 rg
243
+ 0.800 0.800 0.800 rg
244
+ 92.500 639.360 91.000 19.404 re
245
+ f
246
+ 0.000 0.000 0.000 rg
247
+ 1 w
248
+ 92.000 659.764 m
249
+ 92.000 638.360 l
250
+ S
251
+ 184.000 659.764 m
252
+ 184.000 638.360 l
253
+ S
254
+ 92.500 659.264 m
255
+ 183.500 659.264 l
256
+ S
257
+ 92.000 638.860 m
258
+ 184.000 638.860 l
259
+ S
260
+ 0.000 0.000 0.000 RG
261
+ 1 w
262
+
263
+ BT
264
+ 97 645.831 Td
265
+ /F1.0 9 Tf
266
+ [<3139>] TJ
267
+ ET
268
+
269
+ 0.000 0.000 0.000 rg
270
+ 0.800 0.800 0.800 rg
271
+ 184.500 639.360 107.000 19.404 re
272
+ f
273
+ 0.000 0.000 0.000 rg
274
+ 1 w
275
+ 184.000 659.764 m
276
+ 184.000 638.360 l
277
+ S
278
+ 292.000 659.764 m
279
+ 292.000 638.360 l
280
+ S
281
+ 184.500 659.264 m
282
+ 291.500 659.264 l
283
+ S
284
+ 184.000 638.860 m
285
+ 292.000 638.860 l
286
+ S
287
+ 0.000 0.000 0.000 RG
288
+ 1 w
289
+
290
+ BT
291
+ 189 645.831 Td
292
+ /F1.0 9 Tf
293
+ [<33>] TJ
294
+ ET
295
+
296
+ 0.000 0.000 0.000 rg
297
+ 0.800 0.800 0.800 rg
298
+ 292.500 639.360 93.000 19.404 re
299
+ f
300
+ 0.000 0.000 0.000 rg
301
+ 1 w
302
+ 292.000 659.764 m
303
+ 292.000 638.360 l
304
+ S
305
+ 386.000 659.764 m
306
+ 386.000 638.360 l
307
+ S
308
+ 292.500 659.264 m
309
+ 385.500 659.264 l
310
+ S
311
+ 292.000 638.860 m
312
+ 386.000 638.860 l
313
+ S
314
+ 0.000 0.000 0.000 RG
315
+ 1 w
316
+
317
+ BT
318
+ 297 645.831 Td
319
+ /F1.0 9 Tf
320
+ [<30>] TJ
321
+ ET
322
+
323
+ 0.000 0.000 0.000 rg
324
+ 0.800 0.800 0.800 rg
325
+ 386.500 639.360 55.000 19.404 re
326
+ f
327
+ 0.000 0.000 0.000 rg
328
+ 1 w
329
+ 386.000 659.764 m
330
+ 386.000 638.360 l
331
+ S
332
+ 442.000 659.764 m
333
+ 442.000 638.360 l
334
+ S
335
+ 386.500 659.264 m
336
+ 441.500 659.264 l
337
+ S
338
+ 386.000 638.860 m
339
+ 442.000 638.860 l
340
+ S
341
+ 0.000 0.000 0.000 RG
342
+ 1 w
343
+
344
+ BT
345
+ 391 645.831 Td
346
+ /F1.0 9 Tf
347
+ [<35>] TJ
348
+ ET
349
+
350
+ 0.000 0.000 0.000 rg
351
+ 0.800 0.800 0.800 rg
352
+ 442.500 639.360 82.000 19.404 re
353
+ f
354
+ 0.000 0.000 0.000 rg
355
+ 1 w
356
+ 442.000 659.764 m
357
+ 442.000 638.360 l
358
+ S
359
+ 525.000 659.764 m
360
+ 525.000 638.360 l
361
+ S
362
+ 442.500 659.264 m
363
+ 524.500 659.264 l
364
+ S
365
+ 442.000 638.860 m
366
+ 525.000 638.860 l
367
+ S
368
+ 0.000 0.000 0.000 RG
369
+ 1 w
370
+
371
+ BT
372
+ 447 645.831 Td
373
+ /F1.0 9 Tf
374
+ [<3232>] TJ
375
+ ET
376
+
377
+ 0.000 0.000 0.000 rg
378
+ 36.000 689.668 m
379
+ 526.000 689.668 l
380
+ 36.000 628.860 m
381
+ 526.000 628.860 l
382
+ S
383
+
384
+ BT
385
+ 36 585.936 Td
386
+ /F1.0 18 Tf
387
+ [<7363616e6d65> 15 <2e696e736563757265> 15 <2e6f7267>] TJ
388
+ ET
389
+
390
+
391
+ BT
392
+ 36 571.59 Td
393
+ /F1.0 9 Tf
394
+ [<5363616e20> 50 <54696d653a> 50 <203020686f757273203130206d696e> 10 <7574657320616e642034207365636f6e6473>] TJ
395
+ ET
396
+
397
+
398
+ BT
399
+ 36 561.186 Td
400
+ /F1.0 9 Tf
401
+ [<4c6f> 15 <773a> 50 <203139204d656469756d3a> 50 <203320486967683a> 50 <203020> 50 <54> 120 <6f74616c3a> 50 <203232>] TJ
402
+ ET
403
+
404
+
405
+ BT
406
+ 36 550.782 Td
407
+ /F1.0 9 Tf
408
+ [<4f706572> 10 <6174696e672053797374656d3a> 50 <204c696e> 10 <7578204b> 40 <6572> -25 <6e656c20322e36206f6e205265642048617420456e746572> -30 <7072> -15 <697365204c696e> 10 <75782035>] TJ
409
+ ET
410
+
411
+ 36.000 536.840 m
412
+ 526.000 536.840 l
413
+ S
414
+
415
+ BT
416
+ 36 518.942 Td
417
+ /F1.0 11 Tf
418
+ [<312e> 60 <20444e5320536572> -30 <76> 25 <657220436163686520536e6f6f70696e6720496e66> 30 <6f72> -25 <6d6174696f6e20446973636c6f73757265>] TJ
419
+ ET
420
+
421
+
422
+ BT
423
+ 36 507.662 Td
424
+ /F1.0 9 Tf
425
+ [<0909092d204d656469756d205365> 30 <76> 25 <6572> -15 <697479>] TJ
426
+ ET
427
+
428
+
429
+ BT
430
+ 36 497.258 Td
431
+ /F1.0 9 Tf
432
+ [<0909092d20646f6d61696e202835332f75647029>] TJ
433
+ ET
434
+
435
+
436
+ BT
437
+ 36 475.418 Td
438
+ /F1.0 11 Tf
439
+ [<322e> 60 <20444e5320536572> -30 <76> 25 <6572205265637572736976> 25 <652051756572> -30 <792043616368652050> 50 <6f69736f6e696e6720> 40 <57> 30 <65616b6e657373>] TJ
440
+ ET
441
+
442
+
443
+ BT
444
+ 36 464.138 Td
445
+ /F1.0 9 Tf
446
+ [<0909092d204d656469756d205365> 30 <76> 25 <6572> -15 <697479>] TJ
447
+ ET
448
+
449
+
450
+ BT
451
+ 36 453.734 Td
452
+ /F1.0 9 Tf
453
+ [<0909092d20646f6d61696e202835332f75647029>] TJ
454
+ ET
455
+
456
+
457
+ BT
458
+ 36 431.894 Td
459
+ /F1.0 11 Tf
460
+ [<332e> 60 <204854545020> 50 <545241> 30 <4345202f20> 50 <545241> 30 <434b204d6574686f647320416c6c6f> 15 <77> 10 <6564>] TJ
461
+ ET
462
+
463
+
464
+ BT
465
+ 36 420.614 Td
466
+ /F1.0 9 Tf
467
+ [<0909092d204d656469756d205365> 30 <76> 25 <6572> -15 <697479>] TJ
468
+ ET
469
+
470
+
471
+ BT
472
+ 36 410.21 Td
473
+ /F1.0 9 Tf
474
+ [<0909092d2068747470202838302f74637029>] TJ
475
+ ET
476
+
477
+ 36.000 61.000 m
478
+ 576.000 61.000 l
479
+ S
480
+
481
+ BT
482
+ 199.0035 44.538 Td
483
+ /F1.0 9 Tf
484
+ [<527562> 20 <792d4e6573737573202d20687474703a2f2f676974687562> 40 <2e636f6d2f6d65706875782f72> -15 <7562> 20 <792d6e6573737573>] TJ
485
+ ET
486
+
487
+ Q
488
+
489
+ endstream
490
+ endobj
491
+ 5 0 obj
492
+ << /Resources << /Font << /F1.0 7 0 R
493
+ >>
494
+ >>
495
+ /Type /Page
496
+ /Parent 2 0 R
497
+ /MediaBox [0 0 612.0 792.0]
498
+ /ProcSet 6 0 R
499
+ /Contents 4 0 R
500
+ >>
501
+ endobj
502
+ 6 0 obj
503
+ [/PDF /Text]
504
+ endobj
505
+ 7 0 obj
506
+ << /Encoding /WinAnsiEncoding
507
+ /Type /Font
508
+ /BaseFont /Helvetica
509
+ /Subtype /Type1
510
+ >>
511
+ endobj
512
+ xref
513
+ 0 8
514
+ 0000000000 65535 f
515
+ 0000000014 00000 n
516
+ 0000000070 00000 n
517
+ 0000000127 00000 n
518
+ 0000000176 00000 n
519
+ 0000006948 00000 n
520
+ 0000007095 00000 n
521
+ 0000007123 00000 n
522
+ trailer
523
+ << /Size 8
524
+ /Root 3 0 R
525
+ /Info 1 0 R
526
+ >>
527
+ startxref
528
+ 7220
529
+ %%EOF
@@ -43,7 +43,7 @@ module Nessus
43
43
  # The Host Scan Run Time
44
44
  # @example
45
45
  # scan.scan_run_time #=> '2 hours 5 minutes and 16 seconds'
46
- def scan_run_time
46
+ def scan_runtime
47
47
  if scan_start_time.empty? | scan_stop_time.empty?; return "N/A"; end
48
48
  h = ("#{Time.parse(scan_stop_time).strftime('%H').to_i - Time.parse(scan_start_time).strftime('%H').to_i}").gsub('-', '')
49
49
  m = ("#{Time.parse(scan_stop_time).strftime('%M').to_i - Time.parse(scan_start_time).strftime('%M').to_i}").gsub('-', '')
@@ -68,6 +68,7 @@ module Nessus
68
68
  def mac_addr
69
69
  @mac_addr ||= @host.at('mac_addr').inner_text
70
70
  end
71
+ alias mac_address mac_addr
71
72
 
72
73
  # Return the Host DNS Name.
73
74
  # @return [String]
@@ -86,13 +87,14 @@ module Nessus
86
87
  def os_name
87
88
  @os_name ||= @host.at('os_name').inner_text
88
89
  end
90
+ alias operating_system os_name
89
91
 
90
- # Return the scanned port count for a given host object.
92
+ # Return the open ports for a given host object.
91
93
  # @return [Integer]
92
- # Return the Scanned Port Count For A Given Host Object.
94
+ # Return the open ports for a given host object.
93
95
  # @example
94
- # host.scanned_ports_count #=> 213
95
- def scanned_ports_count
96
+ # host.open_ports #=> 213
97
+ def open_ports
96
98
  @scanned_ports ||= @host.at('num_ports').inner_text.to_i
97
99
  end
98
100
 
@@ -103,25 +105,25 @@ module Nessus
103
105
  # @return [Integer]
104
106
  # Return The Informational Event Count For A Given Host.
105
107
  # @example
106
- # host.informational_severity_events do |info|
107
- # puts info.name if info.name
108
+ # host.informational_events do |info|
109
+ # puts info.port
110
+ # puts info.data if info.data
108
111
  # end
109
- def informational_severity_events(&block)
110
- unless @informational_severity_events
111
- @informational_severity_events = []
112
- @informational_severity_count = 0
112
+ def informational_events(&block)
113
+ unless @informational_events
114
+ @informational_events = []
115
+ @informational_event_count = 0
113
116
 
114
117
  @host.xpath("//ReportItem").each do |event|
115
118
  next if event.at('severity').inner_text.to_i != 0
116
- @informational_severity_events << Event.new(event)
117
- @informational_severity_count += 1
119
+ @informational_events << Event.new(event)
120
+ @informational_event_count += 1
118
121
  end
119
-
120
- @informational_severity_count = @host.at('num_lo').inner_text.to_i
122
+
121
123
  end
122
124
 
123
- @informational_severity_events.each(&block)
124
- return @informational_severity_count
125
+ @informational_events.each(&block)
126
+ return @informational_event_count
125
127
  end
126
128
 
127
129
  # Returns All Low Event Objects For A Given Host.
@@ -135,6 +137,9 @@ module Nessus
135
137
  # puts low.name if low.name
136
138
  # end
137
139
  def low_severity_events(&block)
140
+
141
+ @low_severity_count = @host.at('num_lo').inner_text.to_i
142
+
138
143
  unless @low_severity_events
139
144
  @low_severity_events = []
140
145
 
@@ -143,7 +148,6 @@ module Nessus
143
148
  @low_severity_events << Event.new(event)
144
149
  end
145
150
 
146
- @low_severity_count = @host.at('num_lo').inner_text.to_i
147
151
  end
148
152
 
149
153
  @low_severity_events.each(&block)
@@ -161,6 +165,9 @@ module Nessus
161
165
  # puts medium.name if medium.name
162
166
  # end
163
167
  def medium_severity_events(&block)
168
+
169
+ @high_severity_count = @host.at('num_med').inner_text.to_i
170
+
164
171
  unless @medium_severity_events
165
172
  @medium_severity_events = []
166
173
 
@@ -169,7 +176,6 @@ module Nessus
169
176
  @medium_severity_events << Event.new(event)
170
177
  end
171
178
 
172
- @high_severity_count = @host.at('num_med').inner_text.to_i
173
179
  end
174
180
 
175
181
  @medium_severity_events.each(&block)
@@ -187,6 +193,9 @@ module Nessus
187
193
  # puts high.name if high.name
188
194
  # end
189
195
  def high_severity_events(&block)
196
+
197
+ @high_severity_count = @host.at('num_hi').inner_text.to_i
198
+
190
199
  unless @high_severity_events
191
200
  @high_severity_events = []
192
201
 
@@ -194,8 +203,7 @@ module Nessus
194
203
  next if event.at('severity').inner_text.to_i != 3
195
204
  @high_severity_events << Event.new(event)
196
205
  end
197
-
198
- @high_severity_count = @host.at('num_hi').inner_text.to_i
206
+
199
207
  end
200
208
 
201
209
  @high_severity_events.each(&block)
@@ -208,7 +216,7 @@ module Nessus
208
216
  # @example
209
217
  # host.event_count #=> 3456
210
218
  def event_count
211
- (informational_severity_events + low_severity_events + medium_severity_events + high_severity_events).to_i
219
+ ((low_severity_events.to_i) + (medium_severity_events.to_i) + (high_severity_events.to_i)).to_i
212
220
  end
213
221
 
214
222
  # Creates a new Event object to be parser
@@ -0,0 +1,13 @@
1
+ module Nessus
2
+
3
+ class Scan
4
+
5
+ #
6
+ def initialize
7
+
8
+ end
9
+
10
+
11
+ end
12
+
13
+ end
@@ -165,8 +165,8 @@ module Nessus
165
165
  # The Informational Severity Count
166
166
  # @example
167
167
  # scan.informational_severity_count #=> 1203
168
- def informational_severity_count
169
- count_severity[:informational].to_i
168
+ def open_ports_count
169
+ count_severity[:open_ports].to_i
170
170
  end
171
171
 
172
172
  # Return the High severity count.
@@ -215,7 +215,7 @@ module Nessus
215
215
  # scan.event_percentage_for("low", true) #=> 11%
216
216
  def event_percentage_for(type, round_percentage=false)
217
217
  @sc ||= count_severity
218
- if %W(high medium low informational all).include?(type)
218
+ if %W(high medium low all).include?(type)
219
219
  calc = ((@sc[:"#{type}"].to_f / @sc[:all].to_f) * 100)
220
220
  if round_percentage
221
221
  return "#{calc.round}"
@@ -252,7 +252,7 @@ module Nessus
252
252
  def count_severity
253
253
  unless @count
254
254
  @count = {}
255
- @informational = 0
255
+ @open_ports = 0
256
256
  @low = 0
257
257
  @medium = 0
258
258
  @high = 0
@@ -260,7 +260,7 @@ module Nessus
260
260
  @xml.xpath("//ReportItem//severity").each do |s|
261
261
  case s.inner_text.to_i
262
262
  when 0
263
- @informational += 1
263
+ @open_ports += 1
264
264
  when 1
265
265
  @low += 1
266
266
  when 2
@@ -270,11 +270,11 @@ module Nessus
270
270
  end
271
271
  end
272
272
 
273
- @count = { :informational => @informational,
273
+ @count = { :open_ports => @open_ports,
274
274
  :low => @low,
275
275
  :medium => @medium,
276
276
  :high => @high,
277
- :all => (@informational + @low + @medium + @high) }
277
+ :all => (@low + @medium + @high) }
278
278
  end
279
279
 
280
280
  return @count
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-nessus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Willis Webber
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-08 00:00:00 -06:00
12
+ date: 2009-11-09 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -59,12 +59,15 @@ files:
59
59
  - VERSION
60
60
  - examples/example.nessus
61
61
  - examples/example.rb
62
+ - examples/pdf_example.rb
63
+ - examples/ruby-nessus-example.pdf
62
64
  - lib/ruby-nessus.rb
63
65
  - lib/ruby-nessus/core_ext/helpers.rb
64
66
  - lib/ruby-nessus/event.rb
65
67
  - lib/ruby-nessus/host.rb
66
68
  - lib/ruby-nessus/nessus.rb
67
69
  - lib/ruby-nessus/port.rb
70
+ - lib/ruby-nessus/scan.rb
68
71
  - lib/ruby-nessus/xml.rb
69
72
  - spec/ruby-nessus_spec.rb
70
73
  - spec/spec.opts
@@ -103,3 +106,4 @@ test_files:
103
106
  - spec/ruby-nessus_spec.rb
104
107
  - spec/spec_helper.rb
105
108
  - examples/example.rb
109
+ - examples/pdf_example.rb