You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to import/export a site using the to/from hash methods the gem throws an error when importing.
NoMethodError: undefined method `each' for nil:NilClass
from /home/abunn/.rvm/gems/ruby-2.2.0/gems/nexpose-1.0.0/lib/nexpose/site.rb:440:in `from_hash'
from (irb):8
from /home/abunn/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
This appears to be due to the Site object in the 1.0 gem changing the :addresses attribute to :included_scan_targets, but the from_hash method not being updated.
The text was updated successfully, but these errors were encountered:
Prep Export: # Write the site configuration to a file. site = Site.load(nsc, site_id) File.write("site-#{site_id}.bak", site.to_json)
Import from json export into new Site: site_bak = JSON.parse(File.read("site-#{ARGV[1]}.bak")) site = Site.from_hash(site_bak) site.id = -1 # Set to use the local scan engine. site.engine_id = nsc.engines.find { |e| e.name == 'Local scan engine' }.id site_id = site.save(nsc)
For now, the solution could be telling the JSON.parse to symbolize_names site_bak = JSON.parse(File.read("site-#{ARGV[1]}.bak”), symbolize_names: true)
@abunn-r7 Planning on just closing this out. Do we need to fix this in the gem or just use the solution provided? site_bak = JSON.parse(File.read("site-#{ARGV[1]}.bak”), symbolize_names: true)
When attempting to import/export a site using the to/from hash methods the gem throws an error when importing.
This appears to be due to the Site object in the 1.0 gem changing the :addresses attribute to :included_scan_targets, but the from_hash method not being updated.
The text was updated successfully, but these errors were encountered: