ruby-nessus 0.1.0 → 0.1.1

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/Rakefile CHANGED
@@ -13,13 +13,13 @@ begin
13
13
  require 'jeweler'
14
14
  Jeweler::Tasks.new do |gem|
15
15
  gem.name = "ruby-nessus"
16
- gem.summary = %Q{Ruby-Nessus is a ruby interface for the popular Nessus vulnerability scanner.}
17
- gem.description = %Q{Ruby-Nessus aims to deliver an easy yet powerful interface for interacting and manipulating Nessus scan results and configurations.}
16
+ gem.summary = "Ruby-Nessus is a ruby interface for the popular Nessus vulnerability scanner."
17
+ gem.description = "Ruby-Nessus aims to deliver an easy yet powerful interface for interacting and manipulating Nessus scan results and configurations."
18
18
  gem.email = "dustin.webber@gmail.com"
19
19
  gem.homepage = "http://github.com/mephux/ruby-nessus"
20
20
  gem.authors = ["Dustin Willis Webber"]
21
+ gem.add_dependency "nokogiri", ">= 1.4.0"
21
22
  gem.add_development_dependency "rspec", ">= 1.2.9"
22
- gem.add_development_dependency "nokogiri"
23
23
  gem.add_development_dependency "yard", ">=0.2.3.5"
24
24
  end
25
25
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/examples/example.rb CHANGED
@@ -8,17 +8,17 @@ require 'ruby-nessus'
8
8
 
9
9
  Nessus::XML.new("example.nessus") do |scan|
10
10
 
11
- puts "Title: #{scan.report_name}"
11
+ puts "Title: #{scan.title}"
12
12
  puts "Policy: #{puts scan.policy_name}"
13
- puts "Policy Description:\n#{puts scan.policy_name}"
13
+ puts "Policy Description: #{puts scan.policy_name}"
14
14
  puts "Start Time: #{scan.start_time}"
15
15
  puts "Stop Time: #{scan.stop_time}"
16
16
  puts "Run Time: #{scan.runtime}"
17
17
  puts "Host Count: #{scan.host_count}"
18
18
  puts "Percentage Of Medium Events: #{scan.event_percentage_for('medium', true)}%"
19
-
19
+
20
+
20
21
  scan.hosts do |host|
21
- next if host.event_count.zero?
22
22
  puts "Hostname: #{host.hostname}"
23
23
  puts "Open Ports: #{host.scanned_ports_count}"
24
24
  puts "High Severity Events: #{host.high_severity_events}"
data/lib/ruby-nessus.rb CHANGED
@@ -1,3 +1,2 @@
1
1
  # Ruby-Nessus Files
2
2
  require 'ruby-nessus/nessus'
3
- require 'ruby-nessus/version'
@@ -34,6 +34,8 @@ module Nessus
34
34
  def report_name
35
35
  @report_name ||= @xml.xpath("//NessusClientData//Report//ReportName").inner_text
36
36
  end
37
+ alias name report_name
38
+ alias title report_name
37
39
 
38
40
  # Return the scan start time.
39
41
  # @return [DateTime]
@@ -83,7 +85,7 @@ module Nessus
83
85
  # @return [Array]
84
86
  # The Nessus Scan Plugin Ids
85
87
  # @example
86
- # scan.policy_name #=> [1234,2343,9742,5452,5343,2423,1233]
88
+ # scan.plugin_ids #=> [1234,2343,9742,5452,5343,2423,1233]
87
89
  def plugin_ids
88
90
  unless @plugin_ids
89
91
  @plugin_ids = []
@@ -100,7 +102,7 @@ module Nessus
100
102
  # @return [Array]
101
103
  # The Nessus Scan Plugin Names
102
104
  # @example
103
- # scan.policy_name #=> ["PHP < 5.2.1 Multiple Vulnerabilities", "PHP < 4.4.1 / 5.0.6 Multiple Vulnerabilities"]
105
+ # scan.plugins #=> ["PHP < 5.2.1 Multiple Vulnerabilities", "PHP < 4.4.1 / 5.0.6 Multiple Vulnerabilities"]
104
106
  def plugins
105
107
  unless @plugins
106
108
  # get elements with attribute:
@@ -214,13 +216,11 @@ module Nessus
214
216
  def event_percentage_for(type, round_percentage=false)
215
217
  @sc ||= count_severity
216
218
  if %W(high medium low informational all).include?(type)
217
- c = @sc[:"#{type}"].to_f
218
- t = @sc[:all].to_f
219
- c1 = (c / t) * 100
219
+ calc = ((@sc[:"#{type}"].to_f / @sc[:all].to_f) * 100)
220
220
  if round_percentage
221
- return "#{c1.round}"
221
+ return "#{calc.round}"
222
222
  else
223
- return "#{c1}"
223
+ return "#{calc}"
224
224
  end
225
225
  else
226
226
  raise "Error: #{type} is not an acceptable severity. Possible options include: all, high, medium, low and informational."
@@ -256,7 +256,6 @@ module Nessus
256
256
  @low = 0
257
257
  @medium = 0
258
258
  @high = 0
259
- @all = 0
260
259
 
261
260
  @xml.xpath("//ReportItem//severity").each do |s|
262
261
  case s.inner_text.to_i
@@ -270,12 +269,12 @@ module Nessus
270
269
  @high += 1
271
270
  end
272
271
  end
273
-
274
- @count[:informational] = @informational
275
- @count[:low] = @low
276
- @count[:medium] = @medium
277
- @count[:high] = @high
278
- @count[:all] = (@informational + @low + @medium + @high)
272
+
273
+ @count = { :informational => @informational,
274
+ :low => @low,
275
+ :medium => @medium,
276
+ :high => @high,
277
+ :all => (@informational + @low + @medium + @high) }
279
278
  end
280
279
 
281
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Willis Webber
@@ -13,24 +13,24 @@ date: 2009-11-08 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: rspec
17
- type: :development
16
+ name: nokogiri
17
+ type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.2.9
23
+ version: 1.4.0
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: nokogiri
26
+ name: rspec
27
27
  type: :development
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: "0"
33
+ version: 1.2.9
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: yard
@@ -65,7 +65,6 @@ files:
65
65
  - lib/ruby-nessus/host.rb
66
66
  - lib/ruby-nessus/nessus.rb
67
67
  - lib/ruby-nessus/port.rb
68
- - lib/ruby-nessus/version.rb
69
68
  - lib/ruby-nessus/xml.rb
70
69
  - spec/ruby-nessus_spec.rb
71
70
  - spec/spec.opts
@@ -1,5 +0,0 @@
1
- module Nessus
2
- # Ruby-Nessus
3
- # Copyright (c) 2009 Dustin Willis Webber
4
- VERSION = '0.1.0'
5
- end