Class: Arachni::Reports::HTML

Inherits:
Arachni::Report::Base show all
Includes:
Arachni::Report::Registrar, Arachni::UI::Output
Defined in:
reports/html.rb

Overview

Creates an HTML report of the audit.

Requires the Liquid (www.liquidmarkup.org/) gem:

  sudo gem install liquid

@author: Anastasios “Zapotek” Laskos

                                     <tasos.laskos@gmail.com>
                                     <zapotek@segfault.gr>

@version: $Rev: 381 $

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from Arachni::Report::Registrar

included

Methods included from Arachni::UI::Output

#debug!, #debug?, #only_positives!, #only_positives?, #print_debug, #print_debug_backtrace, #print_debug_pp, #print_error, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #verbose!, #verbose?

Constructor Details

- (HTML) initialize(audit_store, options, outfile = html)

A new instance of HTML

Parameters:

  • (AuditStore) audit_store
  • (Hash) options

    options passed to the report

  • (String) outfile (defaults to: html)

    where to save the report



43
44
45
46
47
48
49
# File 'reports/html.rb', line 43

def initialize( audit_store, options, outfile = html )
    @audit_store   = audit_store
    @options       = options
    @outfile       = outfile + '.html'
    
    @tpl = File.dirname( __FILE__ ) + '/html/templates/index.tpl'
end

Class Method Details

+ (Object) info



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'reports/html.rb', line 68

def self.info
    {
        'Name'           => 'HTML Report',
        'Options'        => {
            'headers' =>
                ['true/false (Default: true)', 'Include headers in the report?' ],
            'html_response' =>
                [ 'true/false (Default: true)', 'Include the HTML response in the report?' ]
        },
        'Description'    => %q{Exports a report as an HTML document.},
        'Author'         => 'zapotek',
        'Version'        => '$Rev: 381 $',
    }
end

Instance Method Details

- (Object) run

Runs the HTML report.



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'reports/html.rb', line 54

def run( )

    print_line( )
    print_status( 'Creating HTML report...' )

    @template = Liquid::Template.parse( IO.read( @tpl ) )
    
    out = @template.render( __prepare_data( ) )
    
    __save( @outfile, out )

    print_status( 'Saved in \'' + @outfile + '\'.' )
end