Module: Arachni::Framework::Parts::Report
- Included in:
- Arachni::Framework
- Defined in:
- lib/arachni/framework/parts/report.rb
Overview
Provides a Report::Manager and related helpers.
Instance Attribute Summary collapse
Instance Method Summary collapse
- #initialize ⇒ Object
-
#list_reporters(patterns = nil) ⇒ Array<Hash>
Information about all available Reporters.
-
#report ⇒ Report
Scan results.
-
#report_as(name, external_report = report) ⇒ String
Runs a reporter component and returns the contents of the generated report.
Instance Attribute Details
#reporters ⇒ Arachni::Reporter::Manager (readonly)
19 20 21 |
# File 'lib/arachni/framework/parts/report.rb', line 19 def reporters @reporters end |
Instance Method Details
#initialize ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/arachni/framework/parts/report.rb', line 21 def initialize super # Deep clone the redundancy rules to preserve their original counters # for the reports. @original_redundant_path_patterns = .scope.redundant_path_patterns.deep_clone @reporters = Arachni::Reporter::Manager.new end |
#list_reporters(patterns = nil) ⇒ Array<Hash>
Returns Information about all available Reporters.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/arachni/framework/parts/report.rb', line 95 def list_reporters( patterns = nil ) loaded = @reporters.loaded begin @reporters.clear @reporters.available.map do |report| path = @reporters.name_to_path( report ) next if !list_reporter?( path, patterns ) @reporters[report].info.merge( options: @reporters[report].info[:options] || [], shortname: report, path: path, author: [@reporters[report].info[:author]]. flatten.map { |a| a.strip } ) end.compact ensure @reporters.clear @reporters.load loaded end end |
#report ⇒ Report
Returns Scan results.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/arachni/framework/parts/report.rb', line 34 def report opts = .to_hash.deep_clone # restore the original redundancy rules and their counters opts[:scope][:redundant_path_patterns] = @original_redundant_path_patterns Arachni::Report.new( options: , sitemap: sitemap, issues: Arachni::Data.issues.sort, plugins: @plugins.results, start_datetime: @start_datetime, finish_datetime: @finish_datetime ) end |
#report_as(name, external_report = report) ⇒ String
Runs a reporter component and returns the contents of the generated report.
Only accepts reporters which support an ‘outfile` option.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/arachni/framework/parts/report.rb', line 68 def report_as( name, external_report = report ) if !@reporters.available.include?( name.to_s ) fail Component::Error::NotFound, "Reporter '#{name}' could not be found." end loaded = @reporters.loaded begin @reporters.clear if !@reporters[name].has_outfile? fail Component::Options::Error::Invalid, "Reporter '#{name}' cannot format the audit results as a String." end outfile = "#{Dir.tmpdir}/#{generate_token}" @reporters.run( name, external_report, outfile: outfile ) IO.binread( outfile ) ensure File.delete( outfile ) if outfile @reporters.clear @reporters.load loaded end end |