prenus 0.0.10 → 0.0.11

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.
@@ -96,6 +96,8 @@ This will only work if you're in the Circos Tools tableviewer folder (in my inst
96
96
  This will dump the png into the img/ folder.
97
97
 
98
98
  == Changes
99
+ * Version 0.0.11 - A bunch of cosmetic changes. PLUS, a new optional command line flag to add HTML content to the top of the index.html file.
100
+ * Version 0.0.10 - Added new pie graph to HTML output, and updated pie graph generater to allow for setting of colours
99
101
  * Version 0.0.9 - Added Nokogiri gem dep
100
102
  * Version 0.0.8 - Default HTML output directory - plus - can filter out severity issues for HTML. Updated gemspec, removed internal gem
101
103
  * Version 0.0.7 - Included push update for XLS output - and updated version statements
data/bin/prenus CHANGED
@@ -19,7 +19,7 @@ require 'lib/input'
19
19
  require 'lib/gemcache/ruby-nessus/ruby-nessus'
20
20
 
21
21
  #Versioning and .. those things
22
- $verstring = "Version 0.0.10 - 1st of October, 2013 - Created by Christian \"xntrik\" Frichot.\n\n"
22
+ $verstring = "Version 0.0.11 - 7th of October, 2013 - Created by Christian \"xntrik\" Frichot.\n\n"
23
23
  $verstring += "Copyright 2013 Christian Frichot\n\n"
24
24
  $verstring += "See LICENSE.txt for more details\n"
25
25
 
@@ -71,6 +71,11 @@ class OptsConsole
71
71
  end
72
72
  end
73
73
 
74
+ # optional HTML content in a file to be inserted into the header
75
+ opts.on('--header-file FILE',"Optional HTML FILE to be inserted into the top of the index.html file when using HTML output") do |indexfile|
76
+ options[:indexfile] = indexfile
77
+ end
78
+
74
79
  # level - how deep to go on some of the inputs
75
80
  opts.on('-s', '--severity LEVEL', "Defaults to 3 for High -> Critical. For large datasets 4 is saner") do |sev|
76
81
  case sev.to_i
@@ -574,3 +574,14 @@ div.box {
574
574
  border: 1px solid #8080FF;
575
575
  background-color: #E5E5FF;
576
576
  }
577
+
578
+ a:link,
579
+ a:visited {
580
+ color: black;
581
+ text-decoration: underline;
582
+ }
583
+ a:hover,
584
+ a:active {
585
+ color: red;
586
+ text-decoration: none;
587
+ }
@@ -88,10 +88,10 @@ class Htmlout < Baseout
88
88
  end
89
89
 
90
90
  pie_data = []
91
- pie_data << ['Low',low_total.to_i,'green'] if @options[:severity] <= 1
92
- pie_data << ['Medium',med_total.to_i,'orange'] if @options[:severity] <= 2
93
- pie_data << ['High',high_total.to_i,'red'] if @options[:severity] <= 3
94
- pie_data << ['Critical',crit_total.to_i,'purple'] if @options[:severity] <= 4
91
+ pie_data << ['Low',low_total.to_i,'green'] if @options[:severity] <= 1 and low_total.to_i > 0
92
+ pie_data << ['Medium',med_total.to_i,'orange'] if @options[:severity] <= 2 and med_total.to_i > 0
93
+ pie_data << ['High',high_total.to_i,'red'] if @options[:severity] <= 3 and high_total.to_i > 0
94
+ pie_data << ['Critical',crit_total.to_i,'purple'] if @options[:severity] <= 4 and crit_total.to_i > 0
95
95
 
96
96
  pie_js(f,"pie_graph","Unique Vulnerability Breakdown","Unique Vuln Breakdown",pie_data,"document.location.href = 'vuln_overview.html';")
97
97
 
@@ -108,10 +108,10 @@ class Htmlout < Baseout
108
108
  end
109
109
 
110
110
  pie_data = []
111
- pie_data << ['Low',low_total.to_i,'green'] if @options[:severity] <= 1
112
- pie_data << ['Medium',med_total.to_i,'orange'] if @options[:severity] <= 2
113
- pie_data << ['High',high_total.to_i,'red'] if @options[:severity] <= 3
114
- pie_data << ['Critical',crit_total.to_i,'purple'] if @options[:severity] <= 4
111
+ pie_data << ['Low',low_total.to_i,'green'] if @options[:severity] <= 1 and low_total.to_i > 0
112
+ pie_data << ['Medium',med_total.to_i,'orange'] if @options[:severity] <= 2 and med_total.to_i > 0
113
+ pie_data << ['High',high_total.to_i,'red'] if @options[:severity] <= 3 and high_total.to_i > 0
114
+ pie_data << ['Critical',crit_total.to_i,'purple'] if @options[:severity] <= 4 and crit_total.to_i > 0
115
115
 
116
116
  pie_js(f,"pie_graph2","Total Vunerability Breakdown","Total Vuln Breakdown",pie_data,"document.location = href= 'vuln_overview.html';")
117
117
 
@@ -131,9 +131,13 @@ class Htmlout < Baseout
131
131
 
132
132
  close_html_header(f)
133
133
 
134
+ unless @options[:indexfile].nil?
135
+ IO.copy_stream(File.open(@options[:indexfile]),f)
136
+ end
137
+
134
138
  body = '<div style="width: 800px; margin-left: auto; margin-right: auto; padding-top: 30px;">'
135
- body += '<div id="pie_graph" style="min-width: 300px; height: 300px; margin: 0 auto; float: left"></div>'
136
- body += '<div id="pie_graph2" style="min-width: 300px; height: 300px; margin: 0 auto; float: left"></div>'
139
+ body += '<div id="pie_graph" style="min-width: 375px; height: 375px; margin: 0 auto; float: left"></div>'
140
+ body += '<div id="pie_graph2" style="min-width: 375px; height: 375px; margin: 0 auto; float: left"></div>'
137
141
  body += '</div>'
138
142
  body += '<div style="clear: both;"></div>'
139
143
  body += '<div id="bar_graph" style="min-width: 400px; height: 900px; margin: 0 auto"></div>'
@@ -145,10 +149,21 @@ class Htmlout < Baseout
145
149
  ips << host[1][:ip]
146
150
  end
147
151
 
148
- body += '<table id="hosts_table" class="display"><thead><tr><th>IP</th><th>Hostname</th><th>OS</th><th>Number of vulns (Low to Critical)</th></tr></thead><tbody>'
152
+ body += '<table id="hosts_table" class="display"><thead><tr><th>IP</th><th>Hostname</th><th>OS</th><th>Vulnerability Count (Low to Critical)</th></tr></thead><tbody>'
149
153
  ips.sort_by{|ip| ip.split('.').map{|octet| octet.to_i}}.each do |ip|
150
154
  @hosts.select{|k,v| v[:ip] == ip}.each do |k,v|
151
- body += '<tr><td><a href="host_' + k.to_s + '.html">' + ip + '</a></td><td>' + v[:hostname] + '</td><td>' + v[:os] + '</td><td>' + v[:total_excl_info].to_s + '</td></tr>'
155
+ tmp_actual_v_count = 0
156
+ tmp_actual_v_count += v[:low].to_i if @options[:severity] <= 1 and v[:low].to_i > 0
157
+ tmp_actual_v_count += v[:med].to_i if @options[:severity] <= 2 and v[:med].to_i > 0
158
+ tmp_actual_v_count += v[:high].to_i if @options[:severity] <= 3 and v[:high].to_i > 0
159
+ tmp_actual_v_count += v[:crit].to_i if @options[:severity] <= 4 and v[:crit].to_i > 0
160
+ body += '<tr><td>'
161
+ if tmp_actual_v_count > 0
162
+ body += '<a href="host_' + k.to_s + '.html">' + ip + '</a>'
163
+ else
164
+ body += ip
165
+ end
166
+ body += '</td><td>' + v[:hostname] + '</td><td>' + v[:os] + '</td><td>' + v[:total_excl_info].to_s + '</td></tr>'
152
167
  end
153
168
  end
154
169
  body += '</tbody></table>'
@@ -179,7 +194,7 @@ class Htmlout < Baseout
179
194
 
180
195
  close_html_header(f)
181
196
 
182
- body = '<a href="index.html">Home</a><br /><div id="vulns"><h2>Vulns</h2>'
197
+ body = '<a href="index.html">Home</a><br /><div id="vulns"><h2>Vulnerabilities</h2>'
183
198
 
184
199
  body += '<table id="vulns_table" class="display"><thead><tr><th>Nessus ID</th><th>Severity</th><th>Name</th><th>Family</th><th>Ports</th><th>Number of impacted hosts</th></tr></thead><tbody>'
185
200
  @events.each do |k,v|
@@ -291,10 +306,10 @@ class Htmlout < Baseout
291
306
  pie_js(f,"pie_graph","Criticality Breakdown","Criticality Breakdown",[['Informational ONLY',values[:info].to_i,'blue']])
292
307
  else
293
308
  pie_data = []
294
- pie_data << ['Low',values[:low].to_i,'green'] if @options[:severity] <= 1
295
- pie_data << ['Medium',values[:med].to_i,'orange'] if @options[:severity] <= 2
296
- pie_data << ['High',values[:high].to_i,'red'] if @options[:severity] <= 3
297
- pie_data << ['Critical',values[:crit].to_i,'purple'] if @options[:severity] <= 4
309
+ pie_data << ['Low',values[:low].to_i,'green'] if @options[:severity] <= 1 and values[:low].to_i > 0
310
+ pie_data << ['Medium',values[:med].to_i,'orange'] if @options[:severity] <= 2 and values[:med].to_i > 0
311
+ pie_data << ['High',values[:high].to_i,'red'] if @options[:severity] <= 3 and values[:high].to_i > 0
312
+ pie_data << ['Critical',values[:crit].to_i,'purple'] if @options[:severity] <= 4 and values[:crit].to_i > 0
298
313
  pie_js(f,"pie_graph","Criticality Breakdown","Criticality Breakdown",pie_data,"document.location.href = '#' + event.point.name;")
299
314
  end
300
315
 
@@ -305,10 +320,10 @@ class Htmlout < Baseout
305
320
  body += '<div id="pie_graph" style="min-width: 400px; height: 400px; margin: 0 auto"></div>'
306
321
  body += '</div>'
307
322
 
308
- body += '<div id="vulns"><h2>Vulns</h2>'
323
+ body += '<div id="vulns"><h2>Vulnerabilities</h2>'
309
324
 
310
325
 
311
- if @options[:severity] <= 4
326
+ if @options[:severity] <= 4 and values[:crit].to_i > 0
312
327
  body += '<div id="critical"><a name="Critical"></a><h3>Critical</h3>'
313
328
 
314
329
  body += '<table id="critical_table" class="display"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'
@@ -325,7 +340,7 @@ class Htmlout < Baseout
325
340
  body += '</tbody></table></div>'
326
341
  end
327
342
 
328
- if @options[:severity] <= 3
343
+ if @options[:severity] <= 3 and values[:high].to_i > 0
329
344
 
330
345
  body += '<div id="high"><a name="High"></a><h3>High</h3>'
331
346
 
@@ -342,7 +357,7 @@ class Htmlout < Baseout
342
357
  body += '</tbody></table></div>'
343
358
  end
344
359
 
345
- if @options[:severity] <= 2
360
+ if @options[:severity] <= 2 and values[:med].to_i > 0
346
361
 
347
362
  body += '<div id="medium"><a name="Medium"></a><h3>Medium</h3>'
348
363
 
@@ -360,7 +375,7 @@ class Htmlout < Baseout
360
375
 
361
376
  end
362
377
 
363
- if @options[:severity] <= 1
378
+ if @options[:severity] <= 1 and values[:low].to_i > 0
364
379
 
365
380
  body += '<div id="low"><a name="Low"></a><h3>Low</h3>'
366
381
 
@@ -377,7 +392,7 @@ class Htmlout < Baseout
377
392
  body += '</tbody></table></div>'
378
393
  end
379
394
 
380
- if @options[:severity] <= 0
395
+ if @options[:severity] <= 0 and values[:info].to_i > 0
381
396
 
382
397
  body += '<div id="informational"><a name="Informational"></a><h3>Informational</h3>'
383
398
 
@@ -396,11 +411,11 @@ class Htmlout < Baseout
396
411
 
397
412
 
398
413
  body += "<script>$(document).ready(function() {\n ";
399
- body += "$('#critical_table').dataTable({\"bPaginate\": false});\n" if @options[:severity] > 4
400
- body += "$('#high_table').dataTable({\"bPaginate\": false});\n" if @options[:severity] > 3
401
- body += "$('#medium_table').dataTable({\"bPaginate\": false});\n" if @options[:severity] > 2
402
- body += "$('#low_table').dataTable({\"bPaginate\": false});\n" if @options[:severity] > 1
403
- body += "$('#informational_table').dataTable({\"bPaginate\": false});\n" if @options[:severity] > 0
414
+ body += "$('#critical_table').dataTable({\"bPaginate\": false});\n" if @options[:severity] <= 4
415
+ body += "$('#high_table').dataTable({\"bPaginate\": false});\n" if @options[:severity] <= 3
416
+ body += "$('#medium_table').dataTable({\"bPaginate\": false});\n" if @options[:severity] <= 2
417
+ body += "$('#low_table').dataTable({\"bPaginate\": false});\n" if @options[:severity] <= 1
418
+ body += "$('#informational_table').dataTable({\"bPaginate\": false});\n" if @options[:severity] <= 0
404
419
  body += "});</script>"
405
420
 
406
421
  body += '</div></div>'
@@ -571,6 +586,9 @@ class Htmlout < Baseout
571
586
  var chart;
572
587
  $(document).ready(function() {
573
588
  chart = new Highcharts.Chart({
589
+ credits: {
590
+ enabled: false
591
+ },
574
592
  chart: {
575
593
  renderTo: '#{renderto}',
576
594
  type: 'bar'
@@ -598,6 +616,7 @@ class Htmlout < Baseout
598
616
  },
599
617
  yAxis: {
600
618
  min: 0,
619
+ allowDecimals: false,
601
620
  title: {
602
621
  text: 'Findings'
603
622
  }
@@ -615,11 +634,17 @@ class Htmlout < Baseout
615
634
  plotOptions: {
616
635
  series: {
617
636
  stacking: 'normal',
637
+ //threshold: 1,
618
638
  dataLabels: {
619
639
  enabled: true,
620
640
  color: '#000000',
621
641
  x: 0,
622
- align: 'center'
642
+ align: 'center',
643
+ formatter: function() {
644
+ if (this.y !=0) {
645
+ return this.y;
646
+ }
647
+ }
623
648
  },
624
649
  events: {
625
650
  click: function(event) {
@@ -727,6 +752,9 @@ class Htmlout < Baseout
727
752
  var chart;
728
753
  $(document).ready(function() {
729
754
  chart = new Highcharts.Chart({
755
+ credits: {
756
+ enabled: false
757
+ },
730
758
  chart: {
731
759
  renderTo: '#{renderto}',
732
760
  plotBackgroundColor: null,
@@ -738,11 +766,12 @@ class Htmlout < Baseout
738
766
  },
739
767
  tooltip: {
740
768
  formatter: function() {
741
- return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
769
+ return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
742
770
  }
743
771
  },
744
772
  plotOptions: {
745
773
  pie: {
774
+ size: '60%',
746
775
  allowPointSelect: true,
747
776
  cursor: 'pointer',
748
777
  dataLabels: {
@@ -751,11 +780,12 @@ class Htmlout < Baseout
751
780
  connectorColor: '#000000',
752
781
  formatter: function() {
753
782
  return '<b>'+ this.point.name +'</b>: '+ this.y;
754
- }
783
+ },
784
+ distance: 20
755
785
  }
756
786
  eos
757
787
 
758
- if not clickfunction.nil?
788
+ unless clickfunction.nil?
759
789
  fp.puts ',events: { click: function(event) { ' + clickfunction + '} }'
760
790
  end
761
791
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prenus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-02 00:00:00.000000000 Z
12
+ date: 2013-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow