Class: PluginFormatters::HealthMap
- Inherits:
-
Arachni::Plugin::Formatter
- Object
- Arachni::Plugin::Formatter
- PluginFormatters::HealthMap
- Includes:
- TemplateUtilities
- Defined in:
- components/reporters/plugin_formatters/stdout/healthmap.rb,
components/reporters/plugin_formatters/html/healthmap.rb,
components/reporters/plugin_formatters/xml/healthmap.rb
Overview
XML formatter for the results of the HealthMap plugin
Instance Method Summary collapse
Instance Method Details
#run(xml) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'components/reporters/plugin_formatters/stdout/healthmap.rb', line 16 def run print_info 'Legend:' print_ok 'No issues' print_bad 'Has issues' print_line results['map'].sort_by { |_, v| v }.each do |i| state = i.keys[0] url = i.values[0] if state == 'with_issues' print_bad( url ) else print_ok( url ) end end print_line print_info "Total: #{results['total']}" print_ok "Without issues: #{results['without_issues']}" print_bad "With issues: #{results['with_issues']} ( #{results['issue_percentage'].to_s}% )" end |
#tpl ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'components/reporters/plugin_formatters/html/healthmap.rb', line 23 def tpl <<-HTML <style type="text/css"> a.without_issues { color: blue; } a.with_issues { color: red; } </style> <div class="row"> <div class="col-md-2"> <dl class="dl-horizontal"> <dt> Total </dt> <dd> <%= results['total'] %> </dd> <dt> Without issues </dt> <dd> <%= results['without_issues'] %> </dd> <dt> With issues </dt> <dd> <%= results['with_issues'] %> </dd> <dt> Issue percentage </dt> <dd> <%= results['issue_percentage'] %> </dd> </dl> </div> <div class="col-md-10"> <ul class="list-unstyled"> <% results['map'].sort_by { |entry| entry.keys.first }.each do |entry| state, url = entry.to_a.first %> <li> <a class="<%= state == 'with_issues' ? 'text-danger' : 'text-success' %>" href="<%= escapeHTML url %>"> <%= escapeHTML url %> </a> </li> <% end %> </ul> </div> </div> HTML end |