nexpose_ticketing 0.5.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,35 +1,35 @@
1
- module NexposeTicketing
2
- class NXLogger
3
- TICKET_SERVICE_CONFIG_PATH = File.join(File.dirname(__FILE__), '/config/ticket_service.config')
4
- LOGGER_FILE = File.join(File.dirname(__FILE__), '/log/ticket_helper.log')
5
-
6
- attr_accessor :options
7
-
8
- def initialize
9
- service_data = begin
10
- YAML.load_file(TICKET_SERVICE_CONFIG_PATH)
11
- rescue ArgumentError => e
12
- raise "Could not parse YAML #{TICKET_SERVICE_CONFIG_PATH} : #{e.message}"
13
- end
14
-
15
- @options = service_data[:options]
16
- setup_logging(@options[:logging_enabled])
17
- end
18
-
19
- def setup_logging(enabled = false)
20
- if enabled
21
- require 'logger'
22
- directory = File.dirname(LOGGER_FILE)
23
- FileUtils.mkdir_p(directory) unless File.directory?(directory)
24
- @log = Logger.new(LOGGER_FILE, 'monthly')
25
- @log.level = Logger::INFO
26
- log_message('Logging enabled for helper.')
27
- end
28
- end
29
-
30
- # Logs a message if logging is enabled.
31
- def log_message(message)
32
- @log.info(message) if @options[:logging_enabled]
33
- end
34
- end
35
- end
1
+ module NexposeTicketing
2
+ class NXLogger
3
+ TICKET_SERVICE_CONFIG_PATH = File.join(File.dirname(__FILE__), '/config/ticket_service.config')
4
+ LOGGER_FILE = File.join(File.dirname(__FILE__), '/log/ticket_helper.log')
5
+
6
+ attr_accessor :options
7
+
8
+ def initialize
9
+ service_data = begin
10
+ YAML.load_file(TICKET_SERVICE_CONFIG_PATH)
11
+ rescue ArgumentError => e
12
+ raise "Could not parse YAML #{TICKET_SERVICE_CONFIG_PATH} : #{e.message}"
13
+ end
14
+
15
+ @options = service_data[:options]
16
+ setup_logging(@options[:logging_enabled])
17
+ end
18
+
19
+ def setup_logging(enabled = false)
20
+ if enabled
21
+ require 'logger'
22
+ directory = File.dirname(LOGGER_FILE)
23
+ FileUtils.mkdir_p(directory) unless File.directory?(directory)
24
+ @log = Logger.new(LOGGER_FILE, 'monthly')
25
+ @log.level = Logger::INFO
26
+ log_message('Logging enabled for helper.')
27
+ end
28
+ end
29
+
30
+ # Logs a message if logging is enabled.
31
+ def log_message(message)
32
+ @log.info(message) if @options[:logging_enabled]
33
+ end
34
+ end
35
+ end
@@ -40,7 +40,8 @@ module NexposeTicketing
40
40
  #
41
41
  def self.all_new_vulns(options = {})
42
42
  "SELECT DISTINCT on (da.ip_address, davs.solution_id) subs.asset_id, da.ip_address, subs.current_scan, subs.vulnerability_id, davs.solution_id, ds.nexpose_id,
43
- ds.url,proofAsText(ds.summary) as summary, proofAsText(ds.fix) as fix, fa.riskscore
43
+ ds.url,proofAsText(ds.summary) as summary, proofAsText(ds.fix) as fix, fa.riskscore, dv.cvss_score, dvr.source, dvr.reference,
44
+ fasva.first_discovered, fasva.most_recently_discovered
44
45
  FROM (SELECT fasv.asset_id, fasv.vulnerability_id, s.current_scan
45
46
  FROM fact_asset_scan_vulnerability_finding fasv
46
47
  JOIN
@@ -51,7 +52,10 @@ module NexposeTicketing
51
52
  GROUP BY fasv.asset_id, fasv.vulnerability_id, s.current_scan, fasv.scan_id
52
53
  HAVING NOT baselineComparison(fasv.scan_id, current_scan) = 'Old'
53
54
  ) subs
55
+ JOIN dim_vulnerability dv USING (vulnerability_id)
56
+ JOIN dim_vulnerability_reference dvr USING (vulnerability_id)
54
57
  JOIN dim_asset_vulnerability_solution davs USING (vulnerability_id)
58
+ JOIN fact_asset_vulnerability_age fasva ON subs.vulnerability_id = fasva.vulnerability_id AND subs.asset_id = fasva.asset_id
55
59
  JOIN dim_solution ds USING (solution_id)
56
60
  JOIN dim_asset da ON subs.asset_id = da.asset_id
57
61
  JOIN fact_asset fa ON fa.asset_id = da.asset_id
@@ -24,7 +24,7 @@ module NexposeTicketing
24
24
  # * *Returns* :
25
25
  # - An array of Nexpose::SiteSummary objects.
26
26
  #
27
- def all_site_details()
27
+ def all_site_details
28
28
  @nsc.sites
29
29
  end
30
30
 
@@ -331,10 +331,12 @@ module NexposeTicketing
331
331
  def createTagFilters(options = {})
332
332
  @defined_tags = nil
333
333
  if options.has_key?(:tags)
334
- if not options[:tags].nil? and not options[:tags].empty?
334
+ return if options[:tags].nil?
335
+ if options[:tags].is_a?(Fixnum)
336
+ @defined_tags = @nsc.list_tags.select{ |nexposeTag| nexposeTag.id == options[:tags] }
337
+ else
335
338
  ## Split the tags into an array
336
339
  tag_strings = options[:tags].strip.split(',')
337
-
338
340
  ## Grab the tag info for the ones we are looking for (if the exist in Nexpose).
339
341
  @defined_tags = @nsc.list_tags.select {|nexposeTag| tag_strings.include?(nexposeTag.name)}
340
342
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexpose_ticketing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Finol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-11 00:00:00.000000000 Z
11
+ date: 2015-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nexpose
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.0
19
+ version: 0.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.6.0
26
+ version: 0.8.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: savon
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,46 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.2'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 3.2.0
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '3.2'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 3.2.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec-mocks
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.2'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 3.2.0
85
+ type: :development
86
+ prerelease: false
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '3.2'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 3.2.0
55
95
  description: This gem provides a Ruby implementation of different integrations with
56
96
  ticketing services for Nexpose.
57
97
  email:
@@ -65,6 +105,8 @@ extensions: []
65
105
  extra_rdoc_files:
66
106
  - README.md
67
107
  files:
108
+ - Gemfile
109
+ - Gemfile.lock
68
110
  - README.md
69
111
  - bin/nexpose_jira
70
112
  - bin/nexpose_remedy