Class: PluginFormatters::WAFDetector

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

Overview

XML formatter for the results of the WAF Detector plugin

Author:

Instance Method Summary collapse

Instance Method Details

#iconObject



42
43
44
45
46
47
48
49
50
51
52
53
# File 'components/reporters/plugin_formatters/html/waf_detector.rb', line 42

def icon
    case results['status']
        when 'found'
            'check'

        when 'not_found'
            'times'

        when 'inconclusive'
            'question'
    end
end

#messageObject



38
39
40
# File 'components/reporters/plugin_formatters/html/waf_detector.rb', line 38

def message
    escapeHTML results['message'].capitalize.gsub( '_', ' ' )
end

#message_typeObject



55
56
57
58
59
60
61
62
63
64
65
66
# File 'components/reporters/plugin_formatters/html/waf_detector.rb', line 55

def message_type
    case results['status']
        when 'found'
            'success'

        when 'not_found'
            'danger'

        when 'inconclusive'
            'warning'
    end
end

#run(xml) ⇒ Object



16
17
18
# File 'components/reporters/plugin_formatters/stdout/waf_detector.rb', line 16

def run
    print_ok results['message']
end

#statusObject



34
35
36
# File 'components/reporters/plugin_formatters/html/waf_detector.rb', line 34

def status
    escapeHTML results['status'].capitalize
end

#tplObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'components/reporters/plugin_formatters/html/waf_detector.rb', line 21

def tpl
    <<-HTML
        <h3>Result</h3>

        <p class="alert alert-<%= message_type %>">
            <b class="fa fa-<%= icon %>"></b>

            <strong><%= status %></strong>:
            <%= message %>
        </p>
    HTML
end