The project_stats.rb script searches through your projects to find and output output statistics like Issues by project, Issues in multiple projects, and Issues in a single project.
The script starts by gathering the necessary metrics (project and issue data), then moves on to three distinct output sections.
The script outputs details on each Project in your Dradis instance plus each Issue associated with that project and each host that Issue affects. This is accomplished with the following code:
project_data.each do |_, data| puts underline(data[:name]) data[:issues].each do |issue| print "* [#{issue[:tag]}] #{issue[:title]}" puts issue[:affected].any? ? " affecting #{issue[:affected].to_sentence}" : '' end puts; puts end
The script then outputs each Issue that is found in more than one project in your Dradis instance. If two projects contain an Issue with the same #[Title]#
, it will output in this section. This is accomplished with the following code:
puts underline 'Issues found in multiple projects' issue_data.select{ |title, data| data[:projects].length > 1 }.keys.uniq.sort.each do |title| puts "* #{title}" end
Finally, the script outputs each Issue that is only found in one project in your Dradis instance. If no other project contains an Issue with the same title, the unique Issue will output in this section. This is accomplished with the following code:
puts underline 'Issues only found in one project' issue_data.select{ |title, data| data[:projects].length == 1 }.keys.uniq.sort.each do |title| puts "* #{title}" end
This script is part of our scripting repository on GitHub. Check out the link for more scripting examples!
Next help article: [scripting] From Nessus output to custom report →
Your email is kept private. We don't do the spam thing.