Class: Arachni::Reporters::Stdout

Inherits:
Arachni::Reporter::Base show all
Defined in:
components/reporters/plugin_formatters/stdout/vector_collector.rb,
components/reporters/plugin_formatters/stdout/uncommon_headers.rb,
components/reporters/plugin_formatters/stdout/cookie_collector.rb,
components/reporters/plugin_formatters/stdout/http_dicattack.rb,
components/reporters/plugin_formatters/stdout/form_dicattack.rb,
components/reporters/plugin_formatters/stdout/content_types.rb,
components/reporters/plugin_formatters/stdout/waf_detector.rb,
components/reporters/plugin_formatters/stdout/login_script.rb,
components/reporters/plugin_formatters/stdout/uniformity.rb,
components/reporters/plugin_formatters/stdout/healthmap.rb,
components/reporters/plugin_formatters/stdout/autologin.rb,
components/reporters/plugin_formatters/stdout/metrics.rb,
components/reporters/plugin_formatters/stdout/exec.rb,
components/reporters/stdout.rb

Overview

Outputs the issues to stdout, used with the CLI UI. All UIs must have a default report.

Author:

Constant Summary

Constants inherited from Arachni::Reporter::Base

Arachni::Reporter::Base::REPORT_FP

Constants included from Arachni

BANNER, Cookie, Form, Header, JSON, Link, LinkTemplate, NestedCookie, Severity, UIForm, UIInput, VERSION, WEBSITE, WIKI, XML

Instance Attribute Summary

Attributes inherited from Arachni::Reporter::Base

#options, #report

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Arachni::Reporter::Base

#format_plugin_results, #has_outfile?, has_outfile?, #initialize, #outfile, outfile_option, #skip_responses?

Methods inherited from Component::Base

author, description, fullname, #shortname, shortname, shortname=, version

Methods included from Component::Output

#depersonalize_output, #depersonalize_output?, #intercept_print_message

Methods included from UI::Output

#caller_location, #debug?, #debug_level, #debug_level_1?, #debug_level_2?, #debug_level_3?, #debug_level_4?, #debug_off, #debug_on, #disable_only_positives, #error_buffer, #error_log_fd, #error_logfile, #has_error_log?, #included, #log_error, #mute, #muted?, #only_positives, #only_positives?, #print_bad, #print_debug, #print_debug_backtrace, #print_debug_exception, #print_debug_level_1, #print_debug_level_2, #print_debug_level_3, #print_debug_level_4, #print_error, #print_error_backtrace, #print_exception, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #reroute_to_file, #reroute_to_file?, reset_output_options, #set_error_logfile, #unmute, #verbose?, #verbose_off, #verbose_on

Methods included from Component::Utilities

#read_file

Methods included from Utilities

#available_port, available_port_mutex, #bytes_to_kilobytes, #bytes_to_megabytes, #caller_name, #caller_path, #cookie_decode, #cookie_encode, #cookies_from_file, #cookies_from_parser, #cookies_from_response, #exception_jail, #exclude_path?, #follow_protocol?, #form_decode, #form_encode, #forms_from_parser, #forms_from_response, #full_and_absolute_url?, #generate_token, #get_path, #hms_to_seconds, #html_decode, #html_encode, #include_path?, #links_from_parser, #links_from_response, #normalize_url, #page_from_response, #page_from_url, #parse_set_cookie, #path_in_domain?, #path_too_deep?, #port_available?, #rand_port, #random_seed, #redundant_path?, #regexp_array_match, #remove_constants, #request_parse_body, #seconds_to_hms, #skip_page?, #skip_path?, #skip_resource?, #skip_response?, #to_absolute, #uri_decode, #uri_encode, #uri_parse, #uri_parse_query, #uri_parser, #uri_rewrite

Methods included from Arachni

URI, collect_young_objects, #get_long_win32_filename, jruby?, null_device, profile?, windows?

Constructor Details

This class inherits a constructor from Arachni::Reporter::Base

Class Method Details

.infoObject



220
221
222
223
224
225
226
227
# File 'components/reporters/stdout.rb', line 220

def self.info
    {
        name:        'Stdout',
        description: %q{Prints the results to standard output.},
        author:      'Tasos "Zapotek" Laskos <[email protected]>',
        version:     '0.3.3'
    }
end

Instance Method Details



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'components/reporters/stdout.rb', line 164

def print_info_issue_details( issue )
    print_line
    if issue.active?
        if issue.vector.respond_to? :seed
            print_info "Seed:      #{issue.vector.seed.inspect}"
        end

        print_info "Injected:  #{issue.vector.affected_input_value.inspect}"
    end

    print_info "Signature: #{issue.signature}"     if issue.signature
    print_info "Proof:     #{issue.proof.inspect}" if issue.proof

    print_line
    print_info "Referring page: #{issue.referring_page.dom.url}"
    if issue.referring_page.dom.transitions.any?
        print_info 'DOM transitions:'
        issue.referring_page.dom.print_transitions( method(:print_info), '    ' )
    end

    print_line
    print_info "Affected page:  #{issue.page.dom.url}"

    if !issue.request.to_s.empty?
        print_info "HTTP request\n#{issue.request}"
    end

    if issue.page.dom.transitions.any?
        print_info 'DOM transitions:'
        issue.page.dom.print_transitions( method(:print_info), '    ' )
    end

    return if issue.remarks.empty?

    print_line
    print_info 'Remarks'
    print_info '-------'
    issue.remarks.each do |logger, remarks|
        print_info "  By #{logger}:"
        remarks.each do |remark|
            print_info "    *  #{word_wrap remark}"
        end
    end

    print_line
end

#runObject



15
16
17
18
19
20
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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'components/reporters/stdout.rb', line 15

def run
    # We're going to be printing a lot of stuff, not just simple status
    # messages, so avoid prefixing every message with the component's name.
    depersonalize_output

    print_line
    print_line
    print_line '=' * 80
    print_line
    print_line

    print_ok 'Web Application Security Report - Arachni Framework'
    print_line
    print_info "Report generated on: #{Time.now}"
    print_info "Report false positives at: #{REPORT_FP}"
    print_line

    print_ok 'System settings:'
    print_info '---------------'

    print_info "Version:           #{report.version}"
    print_info "Seed:              #{report.seed}"
    print_info "Audit started on:  #{report.start_datetime}"
    print_info "Audit finished on: #{report.finish_datetime}"
    print_info "Runtime:           #{report.delta_time}"
    print_line
    print_info "URL:        #{report.options[:url]}"
    print_info "User agent: #{report.options[:http][:user_agent]}"
    print_line
    print_status 'Audited elements: '
    print_info '* Links'     if report.options[:audit][:links]
    print_info '* Forms'     if report.options[:audit][:forms]
    print_info '* Cookies'   if report.options[:audit][:cookies]
    print_info '* Headers'   if report.options[:audit][:headers]
    print_info '* XMLs'      if report.options[:audit][:xmls]
    print_info '* JSONs'     if report.options[:audit][:jsons]
    print_info '* UI inputs' if report.options[:audit][:ui_inputs]
    print_info '* UI forms'  if report.options[:audit][:ui_forms]
    print_line
    print_status "Checks: #{report.options[:checks].join( ', ' )}"

    if report.options[:scope][:exclude_path_patterns].any? ||
        report.options[:scope][:include_path_patterns].any? ||
        report.options[:scope][:redundant_path_patterns].any?

        print_line
        print_status 'Filters: '

        if report.options[:scope][:exclude_path_patterns] &&
            report.options[:scope][:exclude_path_patterns].any?

            print_info '  Exclude:'
            report.options[:scope][:exclude_path_patterns].each { |ex| print_info "    #{ex}" }
        end

        if report.options[:scope][:include_path_patterns] &&
            report.options[:scope][:include_path_patterns].any?

            print_info '  Include:'
            report.options[:scope][:include_path_patterns].each { |inc| print_info "    #{inc}" }
        end

        if report.options[:scope][:redundant_path_patterns] &&
            report.options[:scope][:redundant_path_patterns].any?

            print_info '  Redundant:'
            report.options[:scope][:redundant_path_patterns].each do |regexp, counter|
                print_info "    #{regexp}:#{counter}"
            end
        end
    end

    if report.options[:cookies] && report.options[:cookies].any?
        print_line
        print_status 'Cookies: '
        report.options[:cookies].each do |cookie|
            print_info "  #{cookie[0]} = #{cookie[1]}"
        end
    end

    print_line
    print_info '==========================='
    print_line
    print_ok "#{report.issues.size} issues were detected."
    print_line

    report.issues.each_with_index do |issue, i|
        trusted = issue.trusted? ? 'Trusted' : 'Untrusted'

        print_ok "[#{i+1}] #{issue.name} (#{trusted})"
        print_info '~~~~~~~~~~~~~~~~~~~~'

        print_info "Digest:     #{issue.digest}"
        print_info "Severity:   #{issue.severity.to_s.capitalize}"
        print_info 'Description: '
        print_info issue.description
        print_info "Tags: #{issue.tags.join(', ')}" if issue.tags.is_a?( Array )

        if issue.cwe_url
            print_line
            print_info "CWE: #{issue.cwe_url}"
        end

        if issue.references
            print_info 'References:'
            issue.references.each{ |ref| print_info "  #{ref[0]} - #{ref[1]}" }
        end

        print_line
        print_info "URL:        #{issue.vector.action}"
        print_info "Element:    #{issue.vector.type}"

        if issue.vector.respond_to? :inputs
            print_info "All inputs: #{issue.vector.inputs.keys.join(', ')}"
        end

        if issue.active?
            print_info "Method:     #{issue.vector.method.to_s.upcase}"
            print_info "Input name: #{issue.affected_input_name}"
        end

        print_info_issue_details issue
        print_line
    end

    return if report.plugins.empty?

    print_line
    print_ok 'Plugin data:'
    print_info '---------------'
    print_line

    # Let the plugin formatters do their thing and print the plugin results
    # and let our block handle the boring crap.
    format_plugin_results do |name|
        print_line
        print_status report.plugins[name][:name]
        print_info '~~~~~~~~~~~~~~'

        print_info "Description: #{report.plugins[name][:description]}"
        print_line
    end

    print_line
    print_info "Arachni is heading towards obsolescence, try out its next-gen successor Ecsypno SCNR:"
    print_info "    https://ecsypno.com/"

end

#word_wrap(text, line_width = 80) ⇒ Object

Stolen from Rails.



212
213
214
215
216
217
218
# File 'components/reporters/stdout.rb', line 212

def word_wrap( text, line_width = 80 )
    return '' if text.to_s.empty?
    text.split("\n").collect do |line|
        line.length > line_width ?
            line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip : line
    end * "\n"
end