Module: Arachni::Module::ElementDB
Overview
Holds a database of all auditable elements of the current page,<br/> including elements that have appeared dynamically during the audit.
The database is updated by the Trainer.
For each page that is audited the database is reset.
Class Method Summary collapse
Instance Method Summary collapse
- #cookie_in_jar?(cookie) ⇒ Boolean
-
#init_cookies(cookies) ⇒ Object
Initializes @@cookies with the cookies found during the crawl/analysis.
- #init_db_from_page(page) ⇒ Object
-
#init_forms(forms) ⇒ Object
Initializes @@forms with the cookies found during the crawl/analysis.
-
#init_links(links) ⇒ Object
Initializes @@links with the links found during the crawl/analysis.
-
#update_cookies(cookies) ⇒ Object
Updates @@cookies wth new cookies that may have dynamically appeared<br/> after analyzing the HTTP responses during the audit.
-
#update_forms(forms) ⇒ Object
Updates @@forms wth new forms that may have dynamically appeared<br/> after analyzing the HTTP responses during the audit.
-
#update_links(links) ⇒ Object
Updates @@links wth new links that may have dynamically appeared<br/> after analyzing the HTTP responses during the audit.
Methods included from Utilities
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
Class Method Details
.reset ⇒ Object
48 49 50 51 52 |
# File 'lib/arachni/module/element_db.rb', line 48 def self.reset @@forms.clear @@links.clear .clear end |
Instance Method Details
#cookie_in_jar?(cookie) ⇒ Boolean
153 154 155 156 |
# File 'lib/arachni/module/element_db.rb', line 153 def ( ) .each { |c| return true if c.raw['name'] == .raw['name'] } false end |
#init_cookies(cookies) ⇒ Object
Initializes @@cookies with the cookies found during the crawl/analysis
77 78 79 |
# File 'lib/arachni/module/element_db.rb', line 77 def ( ) = end |
#init_db_from_page(page) ⇒ Object
54 55 56 57 58 |
# File 'lib/arachni/module/element_db.rb', line 54 def init_db_from_page( page ) init_links( page.links ) init_forms( page.forms ) ( page. ) end |
#init_forms(forms) ⇒ Object
Initializes @@forms with the cookies found during the crawl/analysis
63 64 65 |
# File 'lib/arachni/module/element_db.rb', line 63 def init_forms( forms ) forms.each { |form| @@forms << form.id } end |
#init_links(links) ⇒ Object
Initializes @@links with the links found during the crawl/analysis
70 71 72 |
# File 'lib/arachni/module/element_db.rb', line 70 def init_links( links ) links.each { |link| @@links << link.id } end |
#update_cookies(cookies) ⇒ Object
Updates @@cookies wth new cookies that may have dynamically appeared<br/> after analyzing the HTTP responses during the audit.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/arachni/module/element_db.rb', line 130 def ( ) return [], 0 if .size == 0 = 0 ||= [] .reverse.each do || .each_with_index do |, i| if .raw['name'] == .raw['name'] [i] = elsif !( ) << += 1 end end end .flatten! |= [, ] end |
#update_forms(forms) ⇒ Object
Updates @@forms wth new forms that may have dynamically appeared<br/> after analyzing the HTTP responses during the audit.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/arachni/module/element_db.rb', line 87 def update_forms( forms ) return [], 0 if forms.size == 0 form_cnt = 0 new_forms ||= [] forms.each do |form| next if @@forms.include?( form.id ) @@forms << form.id new_forms << form form_cnt += 1 end [new_forms, form_cnt] end |
#update_links(links) ⇒ Object
Updates @@links wth new links that may have dynamically appeared<br/> after analyzing the HTTP responses during the audit.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/arachni/module/element_db.rb', line 109 def update_links( links ) return [], 0 if links.size == 0 link_cnt = 0 new_links ||= [] links.each do |link| next if @@links.include?( link.id ) @@links << link.id new_links << link link_cnt += 1 end [new_links, link_cnt] end |