nexpose_servicenow 0.4.16 → 0.4.18

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 069e970f4c54d280fa516be42dd68b28d7759eca
4
- data.tar.gz: 335ecf4c273e1e2f95a109d9b50a17e881576714
3
+ metadata.gz: c325a43d283e142343eb252319480592167450ab
4
+ data.tar.gz: a5177c3ac6503e29cb039a159dcf0b8c508f1bf8
5
5
  SHA512:
6
- metadata.gz: c7a070f0f11759224e8230ee419d0f955ae2b9e048c1b51ed619cfd23e3e6a424a85024a224e87a1cfb4688c042ea74c71ec2972a0a5359e8de89335f7a862c8
7
- data.tar.gz: 38d9dc74e024bc2744f32bdd0a6188f8d1ec6ef13cda9d42e816134e9d911132c8919290b9063da36786b7ed162b944df699167de2d8f446bc241968886dc3d2
6
+ metadata.gz: a47fb845d6acd135d3411dee4adb77a07ecc4a81bd48387f3f9bbd419d2d152552cfc0cfc42235210ebc512a87f8b2b97cf388382f1518de7de86cc3e5fe49bd
7
+ data.tar.gz: 7812e7398e897d8ba6d21c29164f5d430f9c63aafd1ffb6c8d68c89aca3c1b571842a20c48341f7b0afac3569449b1a172b35fb1544422349e36102369f90b87
@@ -16,7 +16,11 @@ module NexposeServiceNow
16
16
  options = ArgParser.parse(args)
17
17
 
18
18
  log = setup_logging(options)
19
- log.log_message("Options: #{options}")
19
+
20
+ censored_options = options.dup
21
+ censored_options[:nexpose_username] = "*****"
22
+ censored_options[:nexpose_password] = "*****"
23
+ log.log_message("Options: #{censored_options}")
20
24
 
21
25
  if options[:nexpose_ids].first.to_s == "0"
22
26
  log.log_message('Retrieving array of all site IDs')
@@ -115,7 +119,8 @@ module NexposeServiceNow
115
119
  end
116
120
 
117
121
  historical_data = HistoricalData.new(options)
118
- sites_to_scan = historical_data.sites_to_scan
122
+ imported_sites_only = options[:query].to_s.eql? 'vulnerable_old_items'
123
+ sites_to_scan = historical_data.sites_to_scan(imported_sites_only)
119
124
 
120
125
  return sites_to_scan unless (sites_to_scan.nil? || sites_to_scan.empty?)
121
126
 
@@ -127,8 +132,10 @@ module NexposeServiceNow
127
132
 
128
133
  #Print the chunk info
129
134
  def self.chunk_info_mode(report_details, options)
130
- chunker = Chunker.new(report_details, options[:row_limit])
131
135
  filtered_sites = filter_sites(options)
136
+ report_details = report_details.select { |d| d[:id] == -1 or filtered_sites.include? d[:id] }
137
+ chunker = Chunker.new(report_details, options[:row_limit])
138
+
132
139
  puts chunker.preprocess(filtered_sites)
133
140
  end
134
141
 
@@ -75,7 +75,7 @@ module NexposeServiceNow
75
75
 
76
76
  #Compares stored scan IDs versus remote scan IDs.
77
77
  #This determines which scans are included as filters.
78
- def sites_to_scan
78
+ def sites_to_scan(imported_sites_only=false)
79
79
  return @ids unless File.exist? @remote_file
80
80
 
81
81
  @log.log_message 'Filtering for sites with new scans'
@@ -89,8 +89,11 @@ module NexposeServiceNow
89
89
  remote_scan_id = remote_csv.find { |r| r['site_id'] == id.to_s } || {}
90
90
  remote_scan_id = remote_scan_id['last_scan_id'] || 1
91
91
 
92
- local_scan_id = local_csv.find { |r| r['site_id'] == id.to_s }
93
- local_scan_id = local_scan_id['last_scan_id']
92
+ local_scan_id = local_csv.find { |r| r['site_id'] == id.to_s } || {}
93
+ local_scan_id = local_scan_id['last_scan_id'] || 0
94
+
95
+ # Check if only allowing sites which were previously imported
96
+ next if local_scan_id.to_s == "0" && imported_sites_only
94
97
 
95
98
  filtered_sites << id if local_scan_id.to_i < remote_scan_id.to_i
96
99
  end
@@ -122,11 +122,11 @@ module NexposeServiceNow
122
122
  end
123
123
 
124
124
  def self.software_instance(options={})
125
- "SELECT asset_id as Nexpose_ID, coalesce(da.host_name, CAST(da.asset_id as text)) as Installed_On, ds.name, ds.Family, ds.Vendor, ds.version, ds.cpe
126
- FROM fact_asset_scan_software
127
- LEFT OUTER JOIN (SELECT software_id, name as Name, vendor as Vendor, family as Family, version, cpe FROM dim_software) ds USING (software_id)
128
- LEFT OUTER JOIN (SELECT asset_id, host_name FROM dim_asset) da USING (asset_id)
129
- WHERE scan_id = lastScan(asset_id)"
125
+ "SELECT asset_id as Nexpose_ID, coalesce(da.host_name, CAST(da.asset_id as text)) as Installed_On, ds.name, ds.Product_Name, ds.version, ds.cpe
126
+ FROM fact_asset_scan_software
127
+ LEFT OUTER JOIN (SELECT software_id, name, vendor || ' ' || family as Product_Name, version, cpe FROM dim_software) ds USING (software_id)
128
+ LEFT OUTER JOIN (SELECT asset_id, host_name FROM dim_asset) da USING (asset_id)
129
+ WHERE scan_id = lastScan(asset_id)"
130
130
  end
131
131
 
132
132
  def self.service_instance(options={})
@@ -1,5 +1,5 @@
1
1
  module NexposeServiceNow
2
- VERSION = "0.4.16"
2
+ VERSION = "0.4.18"
3
3
  VENDOR = "ServiceNow"
4
4
  PRODUCT = "CMDB"
5
5
  end
@@ -6,15 +6,24 @@ require 'nexpose_servicenow/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "nexpose_servicenow"
8
8
  spec.version = NexposeServiceNow::VERSION
9
- spec.authors = ["David Valente", 'JJ Cassidy']
9
+ spec.authors = ["David Valente"]
10
+ spec.email = ["david_valente@rapid7.com"]
10
11
 
11
12
  spec.require_paths = ["lib"]
12
- spec.summary = %Q{Gem for Nexpose-ServiceNow marketplace application integration. Requires Servicenow Application component available on Servicenow application store.}
13
+ spec.summary = %Q{Gem for Nexpose-ServiceNow integration.}
13
14
  spec.description = %Q{Provides an interface to Nexpose for the Rapid7 ServiceNow MarketPlace application.}
14
15
  spec.executables = ["nexpose_servicenow"]
15
- spec.email = ['support@rapid7.com']
16
+ spec.homepage = "http://www.rapid7.com"
16
17
  spec.license = "MIT"
17
18
 
19
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
20
+ # delete this section to allow pushing this gem to any host.
21
+ if spec.respond_to?(:metadata)
22
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
23
+ else
24
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
25
+ end
26
+
18
27
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
28
  spec.bindir = "bin"
20
29
  spec.require_paths = ["lib"]
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexpose_servicenow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.16
4
+ version: 0.4.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Valente
8
- - JJ Cassidy
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2016-11-16 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
@@ -56,7 +55,7 @@ dependencies:
56
55
  description: Provides an interface to Nexpose for the Rapid7 ServiceNow MarketPlace
57
56
  application.
58
57
  email:
59
- - support@rapid7.com
58
+ - david_valente@rapid7.com
60
59
  executables:
61
60
  - nexpose_servicenow
62
61
  extensions: []
@@ -78,10 +77,11 @@ files:
78
77
  - lib/nexpose_servicenow/queries_original.rb
79
78
  - lib/nexpose_servicenow/version.rb
80
79
  - nexpose_servicenow.gemspec
81
- homepage:
80
+ homepage: http://www.rapid7.com
82
81
  licenses:
83
82
  - MIT
84
- metadata: {}
83
+ metadata:
84
+ allowed_push_host: https://rubygems.org
85
85
  post_install_message:
86
86
  rdoc_options: []
87
87
  require_paths:
@@ -101,6 +101,5 @@ rubyforge_project:
101
101
  rubygems_version: 2.4.8
102
102
  signing_key:
103
103
  specification_version: 4
104
- summary: Gem for Nexpose-ServiceNow marketplace application integration. Requires
105
- Servicenow Application component available on Servicenow application store.
104
+ summary: Gem for Nexpose-ServiceNow integration.
106
105
  test_files: []