Class: Arachni::Module::Trainer
- Defined in:
- lib/arachni/module/trainer.rb
Overview
Trainer class
Analyzes key HTTP responses looking for new auditable elements.
Instance Attribute Summary collapse
-
#page ⇒ Object
Returns the value of attribute page.
Instance Method Summary collapse
-
#flush ⇒ Array<Arachni::Page>
Flushes the page buffer.
-
#initialize(opts) ⇒ Trainer
constructor
A new instance of Trainer.
-
#push(res) ⇒ Object
(also: #<<)
Passes the response on for analysis.
Methods included from Utilities
#cookie_encode, #cookies_from_document, #cookies_from_file, #cookies_from_response, #exception_jail, #exclude_path?, #extract_domain, #form_decode, #form_encode, #form_parse_request_body, #forms_from_document, #forms_from_response, #get_path, #hash_keys_to_str, #html_decode, #html_encode, #include_path?, #links_from_document, #links_from_response, #normalize_url, #page_from_response, #page_from_url, #parse_query, #parse_set_cookie, #parse_url_vars, #path_in_domain?, #path_too_deep?, #remove_constants, #seed, #skip_path?, #to_absolute, #uri_decode, #uri_encode, #uri_parse, #uri_parser, #url_sanitize
Methods included from ElementDB
#cookie_in_jar?, #init_cookies, #init_db_from_page, #init_forms, #init_links, reset, #update_cookies, #update_forms, #update_links
Methods included from Utilities
Methods included from Output
#fancy_name, #print_bad, #print_debug, #print_error, #print_info, #print_line, #print_ok, #print_status, #print_verbose
Methods included from UI::Output
#debug?, #debug_off, #debug_on, #disable_only_positives, #flush_buffer, #mute, #muted?, old_reset_output_options, #only_positives, #only_positives?, #print_bad, #print_debug, #print_debug_backtrace, #print_debug_pp, #print_error, #print_error_backtrace, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #reroute_to_file, #reroute_to_file?, reset_output_options, #set_buffer_cap, #uncap_buffer, #unmute, #verbose, #verbose?
Constructor Details
#initialize(opts) ⇒ Trainer
Returns a new instance of Trainer.
39 40 41 42 43 44 |
# File 'lib/arachni/module/trainer.rb', line 39 def initialize( opts ) @opts = opts @updated = false @pages = [] end |
Instance Attribute Details
#page ⇒ Object
Returns the value of attribute page.
36 37 38 |
# File 'lib/arachni/module/trainer.rb', line 36 def page @page end |
Instance Method Details
#flush ⇒ Array<Arachni::Page>
Flushes the page buffer
62 63 64 65 66 |
# File 'lib/arachni/module/trainer.rb', line 62 def flush pages = @pages.dup @pages.clear pages end |
#push(res) ⇒ Object Also known as: <<
Passes the response on for analysis.
If the response contains new elements it creates a new page with those elements and pushes it a buffer.
These new pages can then be retrieved by flushing the buffer (#flush).
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/arachni/module/trainer.rb', line 78 def push( res ) if !@page print_debug 'No seed page assigned yet.' return end @parser = Parser.new( res ) return false if !@parser.text? || @parser.skip?( @parser.url ) analyze( res ) true rescue => e print_error( e.to_s ) print_error_backtrace( e ) end |