Giter Club home page Giter Club logo

Comments (12)

bperry-r7 avatar bperry-r7 commented on August 15, 2024

Could you show me the code you are using to generate the report? Nothing changed afaik. I can try to reproduce.

from nexpose-client.

thesp0nge avatar thesp0nge commented on August 15, 2024

def self.generate_and_save(site_list, nsc)
site_list=Nexty::Sites.load_from_file(site_list)
site_list_score = 0

  report = Nexpose::ReportAdHoc.new(nsc, 'report-card', 'raw-xml')

  site_list.each do |site|
    s = nsc.find_site_by_name_2(site) || []

    if ! s[:site_id].nil?
      site_config = Nexpose::SiteConfig.new
      site_config.getSiteConfig(nsc, s[:site_id])

      scan_history = nsc.site_scan_history(s[:site_id])
      scan_history.sort! { |a,b| b[:start_time] <=> a[:start_time]}
      scan_history.take(4).each do |scan|
        report.addFilter('scan', scan[:scan_id])
      end
    end
  end

  file_name = "export_#{Time.now.strftime("%Y%m%d%H%M%s")}.csv"
  file = File.open(file_name, "w")
  file.write(report.generate)
  file.close

  file_name

end

I added also some prints in my nexpose-client report and it seems that response content type is different if format is CSV rather than RAW-XML. It happened starting from today after the Nexpose automatic product update. So nothing changed in API nor in my personal code... only Nexpose is :(

from nexpose-client.

bperry-r7 avatar bperry-r7 commented on August 15, 2024

You are correct, this was an oversight of the engineering team. The response for CSV has changed. I will be working today to fix this in our various API wrappers, should have a fixed version this evening. Very sorry about this and any inconvenience it has caused. We are looking into better testing requirements to catch this before releases.

Will also be getting your other pull request checked in with the Nexpose::Misc changes, stay tuned.

from nexpose-client.

bperry-r7 avatar bperry-r7 commented on August 15, 2024

Ok, an update. It appears that the way templates and CSV reports interact have changed with the last release. For CSV reports, you need to create a template of type 'data' rather than a 'document' type report. Type 'document' templates will no longer work with CSV reports.

Please create a template of type 'data' rather than type 'document' in the UI and see if this fixes your issue. I am still looking into this reporting code because, to be honest, a lot of it could have been written better. This also could have been better communicated through the release notes, even I wasn't aware this change was made. Oh well, c'est la vie.

from nexpose-client.

bperry-r7 avatar bperry-r7 commented on August 15, 2024

To reinforce this, if you look in nsc.log in your nexpose installation directory, you will see an error similar to this:

2012-03-21T20:11:22 [INFO] [Thread: Generating report Adhoc_1332360682634 (default:838)] CSVReportExporter exporting to /opt/rapid7/nexpose/nsc/htroot/reports/00000346/00000345
2012-03-21T20:11:22 [INFO] [Thread: Generating report Adhoc_1332360682634 (default:838)] Failed to generate report: Adhoc_1332360682634
com.rapid7.nexpose.report.ReportException: Invalid report template. Template type should be 'data'.
at com.rapid7.nexpose.report.CSVReportExporter.export(Unknown Source) ~[nxshared.jar:na]
at com.rapid7.nexpose.report.ReportCreationContext.generateReports(Unknown Source) [nxshared.jar:na]
at com.rapid7.nexpose.report.service.ReportService.generateReport(Unknown Source) [nxshared.jar:na]
at com.rapid7.nexpose.report.service.ReportGenerationThread.run(Unknown Source) [nxshared.jar:na]

from nexpose-client.

bperry-r7 avatar bperry-r7 commented on August 15, 2024

This also should only affect CSV reports.

from nexpose-client.

thesp0nge avatar thesp0nge commented on August 15, 2024

Perry, any update on this topic?

from nexpose-client.

thesp0nge avatar thesp0nge commented on August 15, 2024

No news guys?

from nexpose-client.

brandonprry avatar brandonprry commented on August 15, 2024

Hi, sorry I just saw this email. Was the above information not correct? After creating a template for the CSV reports you are still getting improper reports?

from nexpose-client.

thesp0nge avatar thesp0nge commented on August 15, 2024

Brandon (sorry I misunderstood your name in the nick), I mean... there are no changes in the API call that I must wait for?
By the way I hacked SiteDeviceListing class and I'll submit a pull request but I want to make sure I can take the repo as reference :)

from nexpose-client.

brandonprry avatar brandonprry commented on August 15, 2024

No, the API will not change, you need to specify a template that is specifically for a CSV report. You will need to create this through the UI.

from nexpose-client.

thesp0nge avatar thesp0nge commented on August 15, 2024

That's fine Brandon, you're the boss so if you tell API won't change I'll check the template way. Thank you indeed.

from nexpose-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.