Class: PluginFormatters::ContentTypes

Inherits:
Arachni::Plugin::Formatter
  • Object
show all
Includes:
TemplateUtilities
Defined in:
components/reporters/plugin_formatters/stdout/content_types.rb,
components/reporters/plugin_formatters/html/content_types.rb,
components/reporters/plugin_formatters/xml/content_types.rb

Overview

XML formatter for the results of the ContentTypes plugin

Author:

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
# File 'components/reporters/plugin_formatters/stdout/content_types.rb', line 16

def run
    results.each do |type, responses|
        print_ok type

        responses.each do |res|
            print_status "    URL:    #{res['url']}"
            print_info   "    Method: #{res['method']}"

            if res['parameters'] && res['method'].downcase == 'post'
                print_info '    Parameters:'
                res['parameters'].each do |k, v|
                    print_info "        #{k} => #{v}"
                end
            end

            print_line
        end

        print_line
    end
end

#tplObject



21
22
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
# File 'components/reporters/plugin_formatters/html/content_types.rb', line 21

def tpl
    <<-HTML
    <ul>
        <% results.each do |type, responses| %>
            <li>
                <code><%= escapeHTML type %></code>

                <dl class="dl-horizontal">
                    <% responses.each do |response| %>
                        <dt>
                            <%= response['method'] %>
                        </dt>
                        <dd>
                            <a href="<%= escapeHTML response['url'] %>">
                                <%= escapeHTML response['url'] %>
                            </a>

                            <ul>
                            <% if response['parameters'] && response['method'].to_s.downcase == 'post' %>
                                <% response['parameters'].each do |name, val| %>
                                <li>
                                    <code><%= escapeHTML name %></code>
                                    =
                                    <code><%= escapeHTML val %></code>
                                </li>
                                <% end %>
                            <% end %>
                            <ul>
                        </dd>
                    <% end %>
                </dl>
            </li>
        <% end %>
    </ul>
    HTML
end