I have been trying for a couple of hours, but I can’t find a satisfying solution to my problem. Using the get all nodes API call, I have only been getting partial results. The output from evidence and issues is great, but merging them together into one JSON is more trouble than it’s worth. Is there any way for me to construct my own API call?
@xRestriction I don’t think that a script currently exists that would match your use case but I was thinking that you might be able to use that repo as a jumping-off point. What output are you aiming for with the JSON exporter?
I’d like to have the issue fields ( title, description, solution etc.) and then the evidence showing me which assets are affected and how it was tested.
Hello @xRestriction. Apologies for the late reply, but have you tried something like this:
module Dradis::Plugins::Json
class Exporter < Dradis::Plugins::Export::Base
def export(args={})
issues = content_service.all_issues
result = issues.map do |issue|
evidences = issue.evidence.map do |evidence|
{ evidence: evidence.content, node: evidence.node.label }
end
{ issue: issue.fields, evidence: evidences}
end
JSON.pretty_generate(result)
end
end
end
This should output all the issues with their evidence, and the evidence with their associated node/host.