arachni 1.3.2 → 1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +108 -0
- data/Gemfile +2 -6
- data/LICENSE.md +1 -1
- data/README.md +34 -16
- data/Rakefile +1 -1
- data/arachni.gemspec +28 -20
- data/bin/arachni +1 -1
- data/bin/arachni_console +1 -1
- data/bin/arachni_multi +1 -1
- data/bin/arachni_reporter +1 -1
- data/bin/arachni_rest_server +13 -0
- data/bin/arachni_restore +1 -1
- data/bin/arachni_rpc +1 -1
- data/bin/arachni_rpcd +1 -1
- data/bin/arachni_rpcd_monitor +1 -1
- data/bin/arachni_script +1 -1
- data/components/checks/active/code_injection.rb +8 -10
- data/components/checks/active/code_injection_php_input_wrapper.rb +5 -6
- data/components/checks/active/code_injection_timing.rb +1 -1
- data/components/checks/active/csrf.rb +1 -1
- data/components/checks/active/file_inclusion.rb +20 -26
- data/components/checks/active/ldap_injection.rb +4 -5
- data/components/checks/active/no_sql_injection.rb +11 -20
- data/components/checks/active/no_sql_injection/substrings/mongodb +1 -0
- data/components/checks/active/no_sql_injection_differential.rb +3 -4
- data/components/checks/active/os_cmd_injection.rb +5 -9
- data/components/checks/active/os_cmd_injection_timing.rb +1 -1
- data/components/checks/active/path_traversal.rb +4 -17
- data/components/checks/active/response_splitting.rb +8 -2
- data/components/checks/active/rfi.rb +4 -5
- data/components/checks/active/session_fixation.rb +9 -3
- data/components/checks/active/source_code_disclosure.rb +5 -20
- data/components/checks/active/sql_injection.rb +30 -18
- data/components/checks/active/sql_injection/{regexp_ignore.txt → ignore_substrings} +0 -0
- data/components/checks/active/sql_injection/regexps/db2.yaml +2 -0
- data/components/checks/active/sql_injection/regexps/frontbase.yaml +1 -0
- data/components/checks/active/sql_injection/regexps/informix.yaml +1 -0
- data/components/checks/active/sql_injection/regexps/ingres.yaml +2 -0
- data/components/checks/active/sql_injection/regexps/maxdb.yaml +2 -0
- data/components/checks/active/sql_injection/regexps/mssql.yaml +8 -0
- data/components/checks/active/sql_injection/regexps/mysql.yaml +4 -0
- data/components/checks/active/sql_injection/regexps/oracle.yaml +4 -0
- data/components/checks/active/sql_injection/regexps/pgsql.yaml +3 -0
- data/components/checks/active/sql_injection/regexps/sqlite.yaml +2 -0
- data/components/checks/active/sql_injection/regexps/sybase.yaml +2 -0
- data/components/checks/active/sql_injection/substrings/access +3 -0
- data/components/checks/active/sql_injection/substrings/db2 +2 -0
- data/components/checks/active/sql_injection/{patterns → substrings}/emc +1 -1
- data/components/checks/active/sql_injection/{patterns → substrings}/firebird +0 -1
- data/components/checks/active/sql_injection/substrings/hsqldb +1 -0
- data/components/checks/active/sql_injection/{patterns → substrings}/informix +1 -2
- data/components/checks/active/sql_injection/substrings/ingres +1 -0
- data/components/checks/active/sql_injection/{patterns → substrings}/interbase +0 -0
- data/components/checks/active/sql_injection/substrings/mssql +17 -0
- data/components/checks/active/sql_injection/{patterns → substrings}/mysql +3 -6
- data/components/checks/active/sql_injection/substrings/oracle +2 -0
- data/components/checks/active/sql_injection/{patterns → substrings}/pgsql +3 -6
- data/components/checks/active/sql_injection/substrings/sqlite +3 -0
- data/components/checks/active/sql_injection/substrings/sybase +1 -0
- data/components/checks/active/sql_injection_differential.rb +5 -7
- data/components/checks/active/sql_injection_differential/payloads.txt +1 -1
- data/components/checks/active/sql_injection_timing.rb +1 -1
- data/components/checks/active/trainer.rb +5 -4
- data/components/checks/active/unvalidated_redirect.rb +1 -1
- data/components/checks/active/unvalidated_redirect_dom.rb +1 -1
- data/components/checks/active/xpath_injection.rb +3 -4
- data/components/checks/active/xss.rb +33 -12
- data/components/checks/active/xss_dom.rb +7 -4
- data/components/checks/active/xss_dom_script_context.rb +1 -1
- data/components/checks/active/xss_event.rb +43 -20
- data/components/checks/active/xss_path.rb +5 -4
- data/components/checks/active/xss_script_context.rb +41 -11
- data/components/checks/active/xss_tag.rb +14 -15
- data/components/checks/active/xxe.rb +5 -16
- data/components/checks/passive/allowed_methods.rb +1 -1
- data/components/checks/passive/backdoors.rb +4 -2
- data/components/checks/passive/backup_directories.rb +4 -2
- data/components/checks/passive/backup_files.rb +4 -2
- data/components/checks/passive/common_admin_interfaces.rb +4 -3
- data/components/checks/passive/common_directories.rb +3 -1
- data/components/checks/passive/common_files.rb +3 -1
- data/components/checks/passive/directory_listing.rb +4 -4
- data/components/checks/passive/grep/captcha.rb +1 -1
- data/components/checks/passive/grep/cookie_set_for_parent_domain.rb +1 -1
- data/components/checks/passive/grep/credit_card.rb +5 -7
- data/components/checks/passive/grep/cvs_svn_users.rb +1 -1
- data/components/checks/passive/grep/emails.rb +135 -8
- data/components/checks/passive/grep/form_upload.rb +1 -1
- data/components/checks/passive/grep/hsts.rb +4 -3
- data/components/checks/passive/grep/html_objects.rb +1 -1
- data/components/checks/passive/grep/http_only_cookies.rb +5 -3
- data/components/checks/passive/grep/insecure_cookies.rb +5 -3
- data/components/checks/passive/grep/insecure_cors_policy.rb +1 -1
- data/components/checks/passive/grep/mixed_resource.rb +1 -1
- data/components/checks/passive/grep/password_autocomplete.rb +1 -1
- data/components/checks/passive/grep/private_ip.rb +1 -1
- data/components/checks/passive/grep/ssn.rb +6 -3
- data/components/checks/passive/grep/unencrypted_password_forms.rb +1 -1
- data/components/checks/passive/grep/x_frame_options.rb +4 -3
- data/components/checks/passive/htaccess_limit.rb +1 -1
- data/components/checks/passive/http_put.rb +1 -1
- data/components/checks/passive/insecure_client_access_policy.rb +2 -2
- data/components/checks/passive/insecure_cross_domain_policy_access.rb +2 -2
- data/components/checks/passive/insecure_cross_domain_policy_headers.rb +2 -2
- data/components/checks/passive/interesting_responses.rb +1 -1
- data/components/checks/passive/localstart_asp.rb +1 -1
- data/components/checks/passive/origin_spoof_access_restriction_bypass.rb +1 -1
- data/components/checks/passive/webdav.rb +1 -1
- data/components/checks/passive/xst.rb +1 -1
- data/components/fingerprinters/frameworks/aspx_mvc.rb +1 -1
- data/components/fingerprinters/frameworks/cakephp.rb +1 -1
- data/components/fingerprinters/frameworks/cherrypy.rb +1 -1
- data/components/fingerprinters/frameworks/django.rb +1 -1
- data/components/fingerprinters/frameworks/jsf.rb +1 -1
- data/components/fingerprinters/frameworks/nette.rb +1 -1
- data/components/fingerprinters/frameworks/rack.rb +1 -1
- data/components/fingerprinters/frameworks/rails.rb +1 -1
- data/components/fingerprinters/frameworks/symfony.rb +1 -1
- data/components/fingerprinters/languages/asp.rb +1 -1
- data/components/fingerprinters/languages/aspx.rb +1 -1
- data/components/fingerprinters/languages/java.rb +1 -1
- data/components/fingerprinters/languages/php.rb +1 -1
- data/components/fingerprinters/languages/python.rb +1 -1
- data/components/fingerprinters/languages/ruby.rb +1 -1
- data/components/fingerprinters/os/bsd.rb +1 -1
- data/components/fingerprinters/os/linux.rb +1 -1
- data/components/fingerprinters/os/solaris.rb +1 -1
- data/components/fingerprinters/os/unix.rb +1 -1
- data/components/fingerprinters/os/windows.rb +1 -1
- data/components/fingerprinters/servers/apache.rb +1 -1
- data/components/fingerprinters/servers/gunicorn.rb +1 -1
- data/components/fingerprinters/servers/iis.rb +1 -1
- data/components/fingerprinters/servers/jetty.rb +1 -1
- data/components/fingerprinters/servers/nginx.rb +1 -1
- data/components/fingerprinters/servers/tomcat.rb +1 -1
- data/components/path_extractors/anchors.rb +1 -1
- data/components/path_extractors/areas.rb +1 -1
- data/components/path_extractors/comments.rb +1 -1
- data/components/path_extractors/data_url.rb +1 -1
- data/components/path_extractors/forms.rb +1 -1
- data/components/path_extractors/frames.rb +1 -1
- data/components/path_extractors/generic.rb +1 -1
- data/components/path_extractors/links.rb +1 -1
- data/components/path_extractors/meta_refresh.rb +3 -3
- data/components/path_extractors/scripts.rb +1 -1
- data/components/plugins/autologin.rb +16 -24
- data/components/plugins/beep_notify.rb +1 -1
- data/components/plugins/content_types.rb +1 -1
- data/components/plugins/cookie_collector.rb +1 -1
- data/components/plugins/defaults/autothrottle.rb +1 -1
- data/components/plugins/defaults/healthmap.rb +1 -1
- data/components/plugins/defaults/meta/remedies/discovery.rb +10 -9
- data/components/plugins/defaults/meta/remedies/timing_attacks.rb +1 -1
- data/components/plugins/defaults/meta/uniformity.rb +1 -1
- data/components/plugins/email_notify.rb +3 -5
- data/components/plugins/exec.rb +1 -1
- data/components/plugins/form_dicattack.rb +1 -1
- data/components/plugins/headers_collector.rb +1 -1
- data/components/plugins/http_dicattack.rb +1 -1
- data/components/plugins/login_script.rb +47 -22
- data/components/plugins/metrics.rb +1 -1
- data/components/plugins/proxy.rb +69 -44
- data/components/plugins/proxy/panel/help.html.erb +1 -18
- data/components/plugins/proxy/panel/inspect.html.erb +4 -3
- data/components/plugins/proxy/panel/page_accordion.html.erb +78 -43
- data/components/plugins/proxy/panel/panel.html.erb +2 -7
- data/components/plugins/proxy/template_scope.rb +1 -1
- data/components/plugins/restrict_to_dom_state.rb +3 -15
- data/components/plugins/script.rb +1 -1
- data/components/plugins/uncommon_headers.rb +1 -1
- data/components/plugins/vector_collector.rb +1 -1
- data/components/plugins/vector_feed.rb +3 -11
- data/components/plugins/waf_detector.rb +1 -1
- data/components/reporters/ap.rb +1 -1
- data/components/reporters/html.rb +2 -2
- data/components/reporters/json.rb +1 -1
- data/components/reporters/marshal.rb +1 -1
- data/components/reporters/plugin_formatters/html/autologin.rb +1 -1
- data/components/reporters/plugin_formatters/html/content_types.rb +1 -1
- data/components/reporters/plugin_formatters/html/cookie_collector.rb +1 -1
- data/components/reporters/plugin_formatters/html/exec.rb +1 -1
- data/components/reporters/plugin_formatters/html/form_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/html/healthmap.rb +1 -1
- data/components/reporters/plugin_formatters/html/http_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/html/login_script.rb +1 -1
- data/components/reporters/plugin_formatters/html/metrics.rb +1 -1
- data/components/reporters/plugin_formatters/html/uncommon_headers.rb +1 -1
- data/components/reporters/plugin_formatters/html/uniformity.rb +1 -1
- data/components/reporters/plugin_formatters/html/vector_collector.rb +1 -1
- data/components/reporters/plugin_formatters/html/waf_detector.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/autologin.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/content_types.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/cookie_collector.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/exec.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/form_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/healthmap.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/http_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/login_script.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/metrics.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/uncommon_headers.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/uniformity.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/vector_collector.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/waf_detector.rb +1 -1
- data/components/reporters/plugin_formatters/xml/autologin.rb +1 -1
- data/components/reporters/plugin_formatters/xml/content_types.rb +1 -1
- data/components/reporters/plugin_formatters/xml/cookie_collector.rb +1 -1
- data/components/reporters/plugin_formatters/xml/exec.rb +1 -1
- data/components/reporters/plugin_formatters/xml/form_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/xml/healthmap.rb +1 -1
- data/components/reporters/plugin_formatters/xml/http_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/xml/login_script.rb +1 -1
- data/components/reporters/plugin_formatters/xml/metrics.rb +1 -1
- data/components/reporters/plugin_formatters/xml/uncommon_headers.rb +1 -1
- data/components/reporters/plugin_formatters/xml/uniformity.rb +1 -1
- data/components/reporters/plugin_formatters/xml/vector_collector.rb +1 -1
- data/components/reporters/plugin_formatters/xml/waf_detector.rb +1 -1
- data/components/reporters/stdout.rb +1 -1
- data/components/reporters/txt.rb +1 -1
- data/components/reporters/xml.rb +29 -4
- data/components/reporters/yaml.rb +1 -1
- data/lib/arachni.rb +48 -3
- data/lib/arachni/banner.rb +1 -1
- data/lib/arachni/browser.rb +601 -358
- data/lib/arachni/browser/element_locator.rb +25 -6
- data/lib/arachni/browser/javascript.rb +103 -35
- data/lib/arachni/browser/javascript/dom_monitor.rb +1 -1
- data/lib/arachni/browser/javascript/proxy.rb +28 -16
- data/lib/arachni/browser/javascript/proxy/stub.rb +1 -1
- data/lib/arachni/browser/javascript/scripts/dom_monitor.js +138 -67
- data/lib/arachni/browser/javascript/scripts/polyfills.js +28 -0
- data/lib/arachni/browser/javascript/scripts/taint_tracer.js +27 -6
- data/lib/arachni/browser/javascript/taint_tracer.rb +1 -1
- data/lib/arachni/browser/javascript/taint_tracer/frame.rb +1 -1
- data/lib/arachni/browser/javascript/taint_tracer/frame/called_function.rb +1 -1
- data/lib/arachni/browser/javascript/taint_tracer/sink/base.rb +1 -1
- data/lib/arachni/browser/javascript/taint_tracer/sink/data_flow.rb +1 -1
- data/lib/arachni/browser/javascript/taint_tracer/sink/execution_flow.rb +1 -1
- data/lib/arachni/browser_cluster.rb +10 -14
- data/lib/arachni/browser_cluster/job.rb +1 -1
- data/lib/arachni/browser_cluster/job/result.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/browser_provider.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/{resource_exploration.rb → dom_exploration.rb} +5 -5
- data/lib/arachni/browser_cluster/jobs/{resource_exploration → dom_exploration}/event_trigger.rb +7 -4
- data/lib/arachni/browser_cluster/jobs/{resource_exploration → dom_exploration}/event_trigger/result.rb +3 -3
- data/lib/arachni/browser_cluster/jobs/{resource_exploration → dom_exploration}/result.rb +2 -2
- data/lib/arachni/browser_cluster/jobs/taint_trace.rb +3 -3
- data/lib/arachni/browser_cluster/jobs/taint_trace/event_trigger.rb +2 -2
- data/lib/arachni/browser_cluster/jobs/taint_trace/event_trigger/result.rb +2 -2
- data/lib/arachni/browser_cluster/jobs/taint_trace/result.rb +1 -1
- data/lib/arachni/browser_cluster/worker.rb +12 -40
- data/lib/arachni/check.rb +1 -1
- data/lib/arachni/check/auditor.rb +15 -1
- data/lib/arachni/check/base.rb +1 -1
- data/lib/arachni/check/manager.rb +1 -1
- data/lib/arachni/component.rb +1 -1
- data/lib/arachni/component/base.rb +5 -5
- data/lib/arachni/component/manager.rb +39 -13
- data/lib/arachni/component/options.rb +1 -1
- data/lib/arachni/component/options/address.rb +1 -1
- data/lib/arachni/component/options/base.rb +1 -1
- data/lib/arachni/component/options/bool.rb +1 -1
- data/lib/arachni/component/options/float.rb +1 -1
- data/lib/arachni/component/options/int.rb +1 -1
- data/lib/arachni/component/options/multiple_choice.rb +1 -1
- data/lib/arachni/component/options/object.rb +1 -1
- data/lib/arachni/component/options/path.rb +1 -1
- data/lib/arachni/component/options/port.rb +1 -1
- data/lib/arachni/component/options/string.rb +1 -1
- data/lib/arachni/component/options/url.rb +1 -1
- data/lib/arachni/component/output.rb +1 -1
- data/lib/arachni/component/utilities.rb +1 -1
- data/lib/arachni/data.rb +1 -1
- data/lib/arachni/data/framework.rb +1 -1
- data/lib/arachni/data/framework/rpc.rb +1 -1
- data/lib/arachni/data/issues.rb +1 -1
- data/lib/arachni/data/plugins.rb +1 -1
- data/lib/arachni/data/session.rb +1 -1
- data/lib/arachni/element/base.rb +19 -5
- data/lib/arachni/element/body.rb +1 -1
- data/lib/arachni/element/capabilities/analyzable.rb +1 -1
- data/lib/arachni/element/capabilities/analyzable/differential.rb +15 -5
- data/lib/arachni/element/capabilities/analyzable/signature.rb +147 -89
- data/lib/arachni/element/capabilities/analyzable/timeout.rb +43 -16
- data/lib/arachni/element/capabilities/auditable.rb +20 -15
- data/lib/arachni/element/capabilities/dom_only.rb +5 -4
- data/lib/arachni/element/capabilities/inputtable.rb +62 -12
- data/lib/arachni/element/capabilities/mutable.rb +74 -13
- data/lib/arachni/element/capabilities/refreshable.rb +1 -1
- data/lib/arachni/element/capabilities/submittable.rb +5 -2
- data/lib/arachni/element/capabilities/with_auditor.rb +1 -1
- data/lib/arachni/element/capabilities/with_auditor/output.rb +5 -5
- data/lib/arachni/element/capabilities/with_dom.rb +1 -1
- data/lib/arachni/element/capabilities/with_node.rb +2 -2
- data/lib/arachni/element/capabilities/with_scope.rb +1 -1
- data/lib/arachni/element/capabilities/with_scope/scope.rb +1 -1
- data/lib/arachni/element/capabilities/with_source.rb +4 -4
- data/lib/arachni/element/cookie.rb +57 -34
- data/lib/arachni/element/cookie/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/cookie/capabilities/mutable.rb +10 -1
- data/lib/arachni/element/cookie/capabilities/with_dom.rb +1 -1
- data/lib/arachni/element/cookie/dom.rb +1 -1
- data/lib/arachni/element/dom.rb +1 -15
- data/lib/arachni/element/dom/capabilities/auditable.rb +1 -1
- data/lib/arachni/element/dom/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/dom/capabilities/locatable.rb +29 -0
- data/lib/arachni/element/dom/capabilities/mutable.rb +11 -1
- data/lib/arachni/element/dom/capabilities/submittable.rb +2 -2
- data/lib/arachni/element/form.rb +33 -14
- data/lib/arachni/element/form/capabilities/auditable.rb +1 -1
- data/lib/arachni/element/form/capabilities/mutable.rb +18 -17
- data/lib/arachni/element/form/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/form/capabilities/with_dom.rb +2 -1
- data/lib/arachni/element/form/dom.rb +3 -2
- data/lib/arachni/element/generic_dom.rb +1 -1
- data/lib/arachni/element/header.rb +16 -4
- data/lib/arachni/element/header/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/header/capabilities/mutable.rb +11 -1
- data/lib/arachni/element/json.rb +2 -2
- data/lib/arachni/element/json/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/json/capabilities/mutable.rb +8 -2
- data/lib/arachni/element/link.rb +14 -7
- data/lib/arachni/element/link/capabilities/auditable.rb +1 -1
- data/lib/arachni/element/link/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/link/capabilities/with_dom.rb +8 -1
- data/lib/arachni/element/link/dom.rb +2 -1
- data/lib/arachni/element/link/dom/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/link_template.rb +8 -3
- data/lib/arachni/element/link_template/capabilities/auditable.rb +1 -1
- data/lib/arachni/element/link_template/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/link_template/capabilities/with_dom.rb +1 -1
- data/lib/arachni/element/link_template/dom.rb +2 -1
- data/lib/arachni/element/link_template/dom/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/path.rb +1 -1
- data/lib/arachni/element/server.rb +3 -3
- data/lib/arachni/element/ui_form.rb +24 -21
- data/lib/arachni/element/ui_form/dom.rb +12 -3
- data/lib/arachni/element/ui_input.rb +17 -11
- data/lib/arachni/element/{input → ui_input}/dom.rb +11 -2
- data/lib/arachni/element/xml.rb +3 -3
- data/lib/arachni/element/xml/capabilities/inputtable.rb +7 -1
- data/lib/arachni/element/xml/capabilities/mutable.rb +7 -13
- data/lib/arachni/element_filter.rb +1 -1
- data/lib/arachni/error.rb +1 -1
- data/lib/arachni/ethon/easy.rb +1 -1
- data/lib/arachni/framework.rb +2 -5
- data/lib/arachni/framework/parts/audit.rb +8 -2
- data/lib/arachni/framework/parts/browser.rb +8 -9
- data/lib/arachni/framework/parts/check.rb +2 -6
- data/lib/arachni/framework/parts/data.rb +23 -8
- data/lib/arachni/framework/parts/platform.rb +1 -1
- data/lib/arachni/framework/parts/plugin.rb +2 -8
- data/lib/arachni/framework/parts/report.rb +3 -9
- data/lib/arachni/framework/parts/scope.rb +1 -1
- data/lib/arachni/framework/parts/state.rb +8 -8
- data/lib/arachni/http.rb +1 -1
- data/lib/arachni/http/client.rb +72 -68
- data/lib/arachni/http/client/dynamic_404_handler.rb +85 -60
- data/lib/arachni/http/cookie_jar.rb +48 -27
- data/lib/arachni/http/headers.rb +4 -3
- data/lib/arachni/http/message.rb +17 -3
- data/lib/arachni/http/message/scope.rb +1 -1
- data/lib/arachni/http/proxy_server.rb +46 -344
- data/lib/arachni/http/proxy_server/connection.rb +316 -0
- data/lib/arachni/http/proxy_server/ssl_interceptor.rb +102 -0
- data/lib/arachni/http/proxy_server/tunnel.rb +54 -0
- data/lib/arachni/http/request.rb +126 -29
- data/lib/arachni/http/request/scope.rb +1 -1
- data/lib/arachni/http/response.rb +42 -12
- data/lib/arachni/http/response/scope.rb +1 -1
- data/lib/arachni/issue.rb +2 -2
- data/lib/arachni/issue/severity.rb +1 -1
- data/lib/arachni/issue/severity/base.rb +1 -1
- data/lib/arachni/option_group.rb +1 -1
- data/lib/arachni/option_groups.rb +1 -1
- data/lib/arachni/option_groups/audit.rb +20 -4
- data/lib/arachni/option_groups/browser_cluster.rb +8 -4
- data/lib/arachni/option_groups/datastore.rb +1 -1
- data/lib/arachni/option_groups/dispatcher.rb +1 -1
- data/lib/arachni/option_groups/http.rb +2 -2
- data/lib/arachni/option_groups/input.rb +6 -3
- data/lib/arachni/option_groups/output.rb +1 -1
- data/lib/arachni/option_groups/paths.rb +10 -3
- data/lib/arachni/option_groups/rpc.rb +1 -1
- data/lib/arachni/option_groups/scope.rb +35 -6
- data/lib/arachni/option_groups/session.rb +1 -1
- data/lib/arachni/option_groups/snapshot.rb +1 -1
- data/lib/arachni/options.rb +1 -1
- data/lib/arachni/page.rb +26 -12
- data/lib/arachni/page/dom.rb +29 -22
- data/lib/arachni/page/dom/transition.rb +2 -2
- data/lib/arachni/page/scope.rb +1 -1
- data/lib/arachni/parser.rb +42 -5
- data/lib/arachni/platform.rb +1 -1
- data/lib/arachni/platform/fingerprinter.rb +1 -1
- data/lib/arachni/platform/list.rb +1 -1
- data/lib/arachni/platform/manager.rb +2 -2
- data/lib/arachni/plugin.rb +1 -1
- data/lib/arachni/plugin/base.rb +1 -1
- data/lib/arachni/plugin/formatter.rb +1 -1
- data/lib/arachni/plugin/manager.rb +7 -13
- data/lib/arachni/processes.rb +1 -1
- data/lib/arachni/processes/dispatchers.rb +2 -2
- data/lib/arachni/processes/executables/base.rb +45 -4
- data/lib/arachni/processes/executables/browser.rb +91 -0
- data/lib/arachni/processes/executables/rest_service.rb +14 -0
- data/lib/arachni/processes/helpers.rb +1 -1
- data/lib/arachni/processes/helpers/dispatchers.rb +1 -1
- data/lib/arachni/processes/helpers/instances.rb +1 -1
- data/lib/arachni/processes/helpers/processes.rb +1 -1
- data/lib/arachni/processes/instances.rb +5 -5
- data/lib/arachni/processes/manager.rb +68 -9
- data/lib/arachni/report.rb +1 -1
- data/lib/arachni/reporter.rb +1 -1
- data/lib/arachni/reporter/base.rb +1 -1
- data/lib/arachni/reporter/formatter_manager.rb +4 -2
- data/lib/arachni/reporter/manager.rb +3 -2
- data/lib/arachni/reporter/options.rb +1 -1
- data/lib/arachni/rest/server.rb +231 -0
- data/lib/arachni/rest/server/instance_helpers.rb +37 -0
- data/lib/arachni/rpc/client/base.rb +1 -1
- data/lib/arachni/rpc/client/dispatcher.rb +1 -1
- data/lib/arachni/rpc/client/instance.rb +1 -1
- data/lib/arachni/rpc/client/instance/framework.rb +1 -1
- data/lib/arachni/rpc/client/instance/service.rb +1 -1
- data/lib/arachni/rpc/serializer.rb +1 -1
- data/lib/arachni/rpc/server/active_options.rb +20 -3
- data/lib/arachni/rpc/server/base.rb +1 -1
- data/lib/arachni/rpc/server/check/manager.rb +1 -1
- data/lib/arachni/rpc/server/dispatcher.rb +4 -4
- data/lib/arachni/rpc/server/dispatcher/node.rb +1 -1
- data/lib/arachni/rpc/server/dispatcher/service.rb +1 -1
- data/lib/arachni/rpc/server/framework.rb +3 -1
- data/lib/arachni/rpc/server/framework/distributor.rb +1 -1
- data/lib/arachni/rpc/server/framework/master.rb +1 -1
- data/lib/arachni/rpc/server/framework/multi_instance.rb +1 -1
- data/lib/arachni/rpc/server/framework/slave.rb +1 -1
- data/lib/arachni/rpc/server/instance.rb +1 -3
- data/lib/arachni/rpc/server/output.rb +1 -1
- data/lib/arachni/rpc/server/plugin/manager.rb +1 -1
- data/lib/arachni/ruby.rb +1 -2
- data/lib/arachni/ruby/array.rb +1 -1
- data/lib/arachni/ruby/hash.rb +1 -1
- data/lib/arachni/ruby/object.rb +15 -1
- data/lib/arachni/ruby/set.rb +1 -1
- data/lib/arachni/ruby/string.rb +23 -4
- data/lib/arachni/ruby/webrick.rb +1 -1
- data/lib/arachni/ruby/webrick/cookie.rb +1 -1
- data/lib/arachni/ruby/webrick/httprequest.rb +1 -1
- data/lib/arachni/scope.rb +1 -1
- data/lib/arachni/{watir → selenium/webdriver}/element.rb +12 -13
- data/lib/arachni/session.rb +19 -4
- data/lib/arachni/snapshot.rb +9 -5
- data/lib/arachni/state.rb +1 -1
- data/lib/arachni/state/audit.rb +1 -1
- data/lib/arachni/state/element_filter.rb +1 -1
- data/lib/arachni/state/framework.rb +1 -1
- data/lib/arachni/state/framework/rpc.rb +1 -1
- data/lib/arachni/state/http.rb +1 -1
- data/lib/arachni/state/options.rb +1 -1
- data/lib/arachni/state/plugins.rb +1 -1
- data/lib/arachni/support.rb +2 -1
- data/lib/arachni/support/buffer.rb +1 -1
- data/lib/arachni/support/buffer/autoflush.rb +1 -1
- data/lib/arachni/support/buffer/base.rb +1 -1
- data/lib/arachni/support/cache.rb +1 -1
- data/lib/arachni/support/cache/base.rb +20 -8
- data/lib/arachni/support/cache/least_cost_replacement.rb +1 -1
- data/lib/arachni/support/cache/least_recently_pushed.rb +1 -1
- data/lib/arachni/support/cache/least_recently_used.rb +8 -9
- data/lib/arachni/support/cache/preference.rb +7 -20
- data/lib/arachni/support/cache/random_replacement.rb +1 -1
- data/lib/arachni/support/crypto.rb +1 -1
- data/lib/arachni/support/crypto/rsa_aes_cbc.rb +1 -1
- data/lib/arachni/support/database.rb +1 -1
- data/lib/arachni/support/database/base.rb +2 -2
- data/lib/arachni/support/database/hash.rb +1 -1
- data/lib/arachni/support/database/queue.rb +1 -1
- data/lib/arachni/support/glob.rb +35 -0
- data/lib/arachni/support/lookup.rb +1 -1
- data/lib/arachni/support/lookup/base.rb +1 -1
- data/lib/arachni/support/lookup/hash_set.rb +1 -1
- data/lib/arachni/support/lookup/moolb.rb +1 -1
- data/lib/arachni/support/mixins.rb +1 -1
- data/lib/arachni/support/mixins/observable.rb +1 -1
- data/lib/arachni/support/mixins/terminal.rb +1 -1
- data/lib/arachni/support/profiler.rb +12 -10
- data/lib/arachni/support/signature.rb +12 -5
- data/lib/arachni/trainer.rb +18 -4
- data/lib/arachni/ui/foo/output.rb +17 -1
- data/lib/arachni/uri.rb +285 -203
- data/lib/arachni/uri/scope.rb +13 -2
- data/lib/arachni/utilities.rb +22 -5
- data/lib/arachni/version.rb +1 -1
- data/lib/version +1 -1
- data/spec/arachni/browser/element_locator_spec.rb +42 -14
- data/spec/arachni/browser/javascript/dom_monitor_spec.rb +34 -304
- data/spec/arachni/browser/javascript/polyfills_spec.rb +35 -0
- data/spec/arachni/browser/javascript/taint_tracer_spec.rb +24 -4
- data/spec/arachni/browser/javascript_spec.rb +92 -65
- data/spec/arachni/browser_cluster/job_spec.rb +3 -3
- data/spec/arachni/browser_cluster/jobs/{resource_exploration → dom_exploration}/event_trigger/result_spec.rb +1 -1
- data/spec/arachni/browser_cluster/jobs/{resource_exploration → dom_exploration}/event_trigger_spec.rb +4 -4
- data/spec/arachni/browser_cluster/jobs/{resource_exploration → dom_exploration}/result_spec.rb +1 -1
- data/spec/arachni/browser_cluster/jobs/{resource_exploration_spec.rb → dom_exploration_spec.rb} +4 -4
- data/spec/arachni/browser_cluster/jobs/taint_tracer_spec.rb +9 -9
- data/spec/arachni/browser_cluster/worker_spec.rb +46 -67
- data/spec/arachni/browser_cluster_spec.rb +19 -17
- data/spec/arachni/browser_spec.rb +506 -183
- data/spec/arachni/check/auditor_spec.rb +70 -25
- data/spec/arachni/component/manager_spec.rb +19 -20
- data/spec/arachni/data/framework/rpc_spec.rb +1 -1
- data/spec/arachni/data/framework_spec.rb +1 -1
- data/spec/arachni/data/issues_spec.rb +3 -3
- data/spec/arachni/element/capabilities/analyzable/differential_spec.rb +44 -0
- data/spec/arachni/element/capabilities/analyzable/signature_spec.rb +33 -162
- data/spec/arachni/element/capabilities/analyzable/timeout_spec.rb +4 -4
- data/spec/arachni/element/cookie_spec.rb +98 -49
- data/spec/arachni/element/form/dom_spec.rb +1 -22
- data/spec/arachni/element/form_spec.rb +7 -7
- data/spec/arachni/element/header_spec.rb +2 -2
- data/spec/arachni/element/json_spec.rb +2 -2
- data/spec/arachni/element/link/dom_spec.rb +1 -22
- data/spec/arachni/element/link_spec.rb +17 -1
- data/spec/arachni/element/link_template/dom_spec.rb +1 -22
- data/spec/arachni/element/link_template_spec.rb +3 -3
- data/spec/arachni/element/ui_form/{ui_form_dom_spec.rb → dom_spec.rb} +72 -22
- data/spec/arachni/element/ui_form_spec.rb +1 -0
- data/spec/arachni/element/ui_input/dom_spec.rb +64 -22
- data/spec/arachni/element/ui_input_spec.rb +1 -0
- data/spec/arachni/element/xml_spec.rb +1 -0
- data/spec/arachni/framework/parts/audit_spec.rb +7 -5
- data/spec/arachni/framework/parts/browser_spec.rb +8 -8
- data/spec/arachni/framework/parts/check_spec.rb +1 -1
- data/spec/arachni/framework/parts/data_spec.rb +4 -4
- data/spec/arachni/framework/parts/scope_spec.rb +2 -2
- data/spec/arachni/framework_spec.rb +1 -1
- data/spec/arachni/http/client/dynamic_404_handlers_spec.rb +26 -13
- data/spec/arachni/http/client_spec.rb +80 -45
- data/spec/arachni/http/cookie_jar_spec.rb +6 -6
- data/spec/arachni/http/proxy_server_spec.rb +69 -66
- data/spec/arachni/http/request_spec.rb +147 -23
- data/spec/arachni/http/response/scope_spec.rb +12 -12
- data/spec/arachni/http/response_spec.rb +62 -4
- data/spec/arachni/issue_spec.rb +6 -6
- data/spec/arachni/option_groups/audit_spec.rb +25 -8
- data/spec/arachni/option_groups/browser_cluster_spec.rb +27 -1
- data/spec/arachni/option_groups/dispatcher_spec.rb +3 -3
- data/spec/arachni/option_groups/input_spec.rb +9 -9
- data/spec/arachni/option_groups/paths_spec.rb +2 -2
- data/spec/arachni/option_groups/scope_spec.rb +32 -16
- data/spec/arachni/options_spec.rb +4 -4
- data/spec/arachni/page/dom/transition_spec.rb +17 -10
- data/spec/arachni/page/dom_spec.rb +19 -0
- data/spec/arachni/page/scope_spec.rb +4 -4
- data/spec/arachni/page_spec.rb +15 -15
- data/spec/arachni/platform/manager_spec.rb +2 -2
- data/spec/arachni/plugin/base_spec.rb +1 -0
- data/spec/arachni/reporter/base_spec.rb +2 -2
- data/spec/arachni/reporter/manager_spec.rb +2 -2
- data/spec/arachni/rest/server_spec.rb +495 -0
- data/spec/arachni/rpc/server/active_options_spec.rb +63 -12
- data/spec/arachni/rpc/server/base_spec.rb +1 -1
- data/spec/arachni/rpc/server/framework/distributor_spec.rb +2 -2
- data/spec/arachni/rpc/server/framework_multi_spec.rb +6 -6
- data/spec/arachni/rpc/server/framework_spec.rb +4 -4
- data/spec/arachni/rpc/server/instance_spec.rb +24 -24
- data/spec/arachni/ruby/array_spec.rb +2 -2
- data/spec/arachni/ruby/string_spec.rb +52 -0
- data/spec/arachni/session_spec.rb +19 -2
- data/spec/arachni/snapshot_spec.rb +1 -1
- data/spec/arachni/state/audit_spec.rb +1 -1
- data/spec/arachni/state/framework_spec.rb +2 -2
- data/spec/arachni/support/cache/least_recently_used_spec.rb +0 -2
- data/spec/arachni/support/glob_spec.rb +75 -0
- data/spec/arachni/support/lookup/hash_set_spec.rb +1 -1
- data/spec/arachni/support/lookup/moolb_spec.rb +2 -2
- data/spec/arachni/support/signature_spec.rb +4 -4
- data/spec/arachni/trainer_spec.rb +48 -4
- data/spec/arachni/uri/scope_spec.rb +54 -10
- data/spec/arachni/uri_spec.rb +110 -89
- data/spec/arachni/utilities_spec.rb +8 -8
- data/spec/components/checks/active/code_injection_spec.rb +9 -9
- data/spec/components/checks/active/file_inclusion_spec.rb +20 -20
- data/spec/components/checks/active/ldap_injection_spec.rb +1 -1
- data/spec/components/checks/active/no_sql_injection_spec.rb +1 -1
- data/spec/components/checks/active/os_cmd_injection_spec.rb +3 -3
- data/spec/components/checks/active/path_traversal_spec.rb +11 -11
- data/spec/components/checks/active/response_splitting_spec.rb +2 -2
- data/spec/components/checks/active/rfi_spec.rb +3 -3
- data/spec/components/checks/active/session_fixation_spec.rb +1 -1
- data/spec/components/checks/active/source_code_disclosure_spec.rb +4 -4
- data/spec/components/checks/active/sql_injection_spec.rb +58 -59
- data/spec/components/checks/active/unvalidated_redirect_spec.rb +2 -2
- data/spec/components/checks/active/xpath_injection_spec.rb +3 -3
- data/spec/components/checks/active/xss_dom_script_context_spec.rb +1 -1
- data/spec/components/checks/active/xss_dom_spec.rb +1 -1
- data/spec/components/checks/active/xss_script_context_spec.rb +5 -5
- data/spec/components/checks/active/xss_spec.rb +5 -5
- data/spec/components/checks/passive/grep/credit_card_spec.rb +1 -1
- data/spec/components/checks/passive/grep/emails_spec.rb +12 -2
- data/spec/components/checks/passive/grep/ssn_spec.rb +1 -1
- data/spec/components/path_extractors/meta_refresh_spec.rb +3 -1
- data/spec/components/plugins/exec_spec.rb +2 -2
- data/spec/components/plugins/login_script_spec.rb +22 -2
- data/spec/components/plugins/vector_feed_spec.rb +3 -3
- data/spec/spec_helper.rb +10 -4
- data/spec/support/factories/browser_cluster/job.rb +1 -0
- data/spec/support/fixtures/check_with_invalid_platforms/with_invalid_platforms.rb +1 -1
- data/spec/support/fixtures/checks/test.rb +1 -1
- data/spec/support/fixtures/checks/test2.rb +1 -1
- data/spec/support/fixtures/checks/test3.rb +1 -1
- data/spec/support/fixtures/fingerprinters/test.rb +1 -1
- data/spec/support/fixtures/plugins/bad.rb +1 -1
- data/spec/support/fixtures/plugins/defaults/default.rb +1 -1
- data/spec/support/fixtures/plugins/distributable.rb +1 -1
- data/spec/support/fixtures/plugins/loop.rb +1 -1
- data/spec/support/fixtures/plugins/suspendable.rb +1 -1
- data/spec/support/fixtures/plugins/wait.rb +1 -1
- data/spec/support/fixtures/plugins/with_options.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p0.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p00.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p1.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p2.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p22.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p222.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p_nil.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p_nil2.rb +1 -1
- data/spec/support/fixtures/report.afr +0 -0
- data/spec/support/fixtures/reporters/base_spec/plugin_formatters/with_formatters/foobar.rb +1 -1
- data/spec/support/fixtures/reporters/base_spec/with_formatters.rb +1 -1
- data/spec/support/fixtures/reporters/base_spec/with_outfile.rb +1 -1
- data/spec/support/fixtures/reporters/base_spec/without_outfile.rb +1 -1
- data/spec/support/fixtures/reporters/manager_spec/afr.rb +1 -1
- data/spec/support/fixtures/reporters/manager_spec/error.rb +1 -1
- data/spec/support/fixtures/reporters/manager_spec/foo.rb +1 -1
- data/spec/support/fixtures/run_check/body.rb +1 -1
- data/spec/support/fixtures/run_check/cookies.rb +1 -1
- data/spec/support/fixtures/run_check/empty.rb +1 -1
- data/spec/support/fixtures/run_check/flch.rb +1 -1
- data/spec/support/fixtures/run_check/forms.rb +1 -1
- data/spec/support/fixtures/run_check/headers.rb +1 -1
- data/spec/support/fixtures/run_check/links.rb +1 -1
- data/spec/support/fixtures/run_check/nil.rb +1 -1
- data/spec/support/fixtures/run_check/path.rb +1 -1
- data/spec/support/fixtures/run_check/server.rb +1 -1
- data/spec/support/fixtures/signature_check/signature.rb +1 -1
- data/spec/support/fixtures/wait_check/wait.rb +1 -1
- data/spec/support/helpers/framework.rb +1 -1
- data/spec/support/helpers/misc.rb +1 -1
- data/spec/support/helpers/paths.rb +1 -1
- data/spec/support/helpers/request_helpers.rb +38 -0
- data/spec/support/helpers/requires.rb +1 -1
- data/spec/support/helpers/resets.rb +1 -1
- data/spec/support/helpers/web_server.rb +1 -1
- data/spec/support/lib/factory.rb +1 -1
- data/spec/support/lib/web_server_client.rb +1 -1
- data/spec/support/lib/web_server_dispatcher.rb +1 -1
- data/spec/support/lib/web_server_manager.rb +2 -2
- data/spec/support/servers/arachni/browser.rb +182 -15
- data/spec/support/servers/arachni/browser/javascript/angular-1.2.8.js +1 -1
- data/spec/support/servers/arachni/browser/javascript/angular-route.js +1 -1
- data/spec/support/servers/arachni/browser/javascript/dom_monitor.rb +27 -4
- data/spec/support/servers/arachni/element/capabilities/analyzable/differential.rb +103 -0
- data/spec/support/servers/arachni/element/capabilities/analyzable/timeout.rb +5 -2
- data/spec/support/servers/arachni/element/header.rb +1 -1
- data/spec/support/servers/arachni/http/client.rb +46 -0
- data/spec/support/servers/arachni/http/client/dynamic_404_handler.rb +7 -1
- data/spec/support/servers/checks/active/code_injection.rb +5 -5
- data/spec/support/servers/checks/active/no_sql_injection.rb +0 -6
- data/spec/support/servers/checks/active/no_sql_injection_differential.rb +1 -1
- data/spec/support/servers/checks/active/sql_injection.rb +5 -2
- data/spec/support/servers/checks/active/sql_injection_differential.rb +1 -1
- data/spec/support/servers/checks/active/trainer_check.rb +6 -6
- data/spec/support/servers/checks/passive/backdoors.rb +1 -0
- data/spec/support/servers/checks/passive/backup_directories.rb +2 -0
- data/spec/support/servers/checks/passive/backup_files.rb +2 -0
- data/spec/support/servers/checks/passive/grep/emails.rb +6 -6
- data/spec/support/shared/check.rb +28 -0
- data/spec/support/shared/element/capabilities/auditable.rb +76 -13
- data/spec/support/shared/element/capabilities/dom_only.rb +5 -6
- data/spec/support/shared/element/capabilities/inputtable.rb +74 -4
- data/spec/support/shared/element/capabilities/mutable.rb +86 -14
- data/spec/support/shared/element/capabilities/submittable.rb +12 -0
- data/spec/support/shared/element/capabilities/with_dom.rb +13 -4
- data/spec/support/shared/element/capabilities/with_node.rb +1 -1
- data/spec/support/shared/element/capabilities/with_source.rb +1 -6
- data/spec/support/shared/element/dom/locatable.rb +20 -0
- data/spec/support/shared/element/dom/submittable.rb +4 -17
- data/spec/support/shared/http/message.rb +37 -5
- data/spec/support/shared/support/cache.rb +5 -4
- data/ui/cli/framework.rb +4 -3
- data/ui/cli/framework/option_parser.rb +20 -8
- data/ui/cli/option_parser.rb +1 -1
- data/ui/cli/output.rb +40 -4
- data/ui/cli/reporter.rb +1 -1
- data/ui/cli/reporter/option_parser.rb +4 -4
- data/ui/cli/rest/server.rb +43 -0
- data/ui/cli/rest/server/option_parser.rb +115 -0
- data/ui/cli/restored_framework.rb +1 -1
- data/ui/cli/restored_framework/option_parser.rb +1 -1
- data/ui/cli/rpc/client/dispatcher_monitor.rb +1 -1
- data/ui/cli/rpc/client/dispatcher_monitor/option_parser.rb +1 -1
- data/ui/cli/rpc/client/instance.rb +1 -1
- data/ui/cli/rpc/client/local.rb +1 -1
- data/ui/cli/rpc/client/local/option_parser.rb +1 -1
- data/ui/cli/rpc/client/remote.rb +1 -1
- data/ui/cli/rpc/client/remote/option_parser.rb +1 -1
- data/ui/cli/rpc/server/dispatcher.rb +1 -1
- data/ui/cli/rpc/server/dispatcher/option_parser.rb +1 -1
- data/ui/cli/utilities.rb +1 -1
- metadata +197 -84
- data/components/checks/active/no_sql_injection/patterns/mongodb +0 -1
- data/components/checks/active/no_sql_injection/regexp_ignore.txt +0 -0
- data/components/checks/active/sql_injection/patterns/access +0 -3
- data/components/checks/active/sql_injection/patterns/db2 +0 -5
- data/components/checks/active/sql_injection/patterns/frontbase +0 -1
- data/components/checks/active/sql_injection/patterns/hsqldb +0 -1
- data/components/checks/active/sql_injection/patterns/ingres +0 -3
- data/components/checks/active/sql_injection/patterns/maxdb +0 -2
- data/components/checks/active/sql_injection/patterns/mssql +0 -25
- data/components/checks/active/sql_injection/patterns/oracle +0 -6
- data/components/checks/active/sql_injection/patterns/sqlite +0 -5
- data/components/checks/active/sql_injection/patterns/sybase +0 -3
- data/lib/arachni/ruby/io.rb +0 -39
- data/lib/arachni/selenium/webdriver/remote/http/typhoeus.rb +0 -63
- data/spec/arachni/ruby/io_spec.rb +0 -26
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright 2010-
|
2
|
+
Copyright 2010-2016 Tasos Laskos <tasos.laskos@arachni-scanner.com>
|
3
3
|
|
4
4
|
This file is part of the Arachni Framework project and is subject to
|
5
5
|
redistribution and commercial restrictions. Please see the Arachni Framework
|
@@ -14,6 +14,8 @@ class Browser
|
|
14
14
|
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
|
15
15
|
class ElementLocator
|
16
16
|
|
17
|
+
ARACHNI_ID = 'data-arachni-id'
|
18
|
+
|
17
19
|
# @return [Symbol]
|
18
20
|
# Tag name of the element.
|
19
21
|
attr_accessor :tag_name
|
@@ -62,14 +64,31 @@ class ElementLocator
|
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
65
|
-
# @return [
|
66
|
-
# Locates and returns the element based on {#
|
67
|
+
# @return [Selenium::WebDriver::Element]
|
68
|
+
# Locates and returns the element based on {#css}.
|
67
69
|
def locate( browser )
|
68
|
-
browser.
|
70
|
+
browser.selenium.find_element( :css, css )
|
69
71
|
end
|
70
72
|
|
71
73
|
def css
|
72
|
-
|
74
|
+
attrs = {}
|
75
|
+
|
76
|
+
# If there's an ID attribute that's good enough, don't include anything
|
77
|
+
# else to avoid risking broken selectors due to dynamic attributes and
|
78
|
+
# values.
|
79
|
+
if attributes['id']
|
80
|
+
attrs['id'] = attributes['id']
|
81
|
+
|
82
|
+
# Alternatively, exclude data attributes (except from ours ) to prevent
|
83
|
+
# issues and use whatever other attributes are available.
|
84
|
+
else
|
85
|
+
attrs = attributes.reject do |k, v|
|
86
|
+
k = k.to_s
|
87
|
+
k.start_with?( 'data-' ) && k != ARACHNI_ID
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
"#{tag_name}#{attrs.map { |k, v| "[#{k}=#{v.inspect}]"}.join}"
|
73
92
|
end
|
74
93
|
|
75
94
|
# @return [String]
|
@@ -114,7 +133,7 @@ class ElementLocator
|
|
114
133
|
end
|
115
134
|
|
116
135
|
def self.from_html( html )
|
117
|
-
from_node
|
136
|
+
from_node Parser.parse_fragment( html )
|
118
137
|
end
|
119
138
|
|
120
139
|
def self.from_node( node )
|
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright 2010-
|
2
|
+
Copyright 2010-2016 Tasos Laskos <tasos.laskos@arachni-scanner.com>
|
3
3
|
|
4
4
|
This file is part of the Arachni Framework project and is subject to
|
5
5
|
redistribution and commercial restrictions. Please see the Arachni Framework
|
@@ -22,7 +22,8 @@ class Javascript
|
|
22
22
|
require_relative 'javascript/dom_monitor'
|
23
23
|
|
24
24
|
CACHE = {
|
25
|
-
|
25
|
+
events_for: Support::Cache::LeastRecentlyPushed.new( 1_000 ),
|
26
|
+
select_events: Support::Cache::LeastRecentlyPushed.new( 1_000 )
|
26
27
|
}
|
27
28
|
|
28
29
|
TOKEN = 'arachni_js_namespace'
|
@@ -43,7 +44,7 @@ class Javascript
|
|
43
44
|
|
44
45
|
NO_EVENTS_FOR_ELEMENTS = Set.new([
|
45
46
|
:base, :bdo, :br, :head, :html, :iframe, :meta, :param, :script, :style,
|
46
|
-
:title, :link
|
47
|
+
:title, :link, :hr
|
47
48
|
])
|
48
49
|
|
49
50
|
# Events that apply to all elements.
|
@@ -68,7 +69,7 @@ class Javascript
|
|
68
69
|
:onreset
|
69
70
|
],
|
70
71
|
|
71
|
-
# These need to be covered via
|
72
|
+
# These need to be covered via Selenium's API, #send_keys etc.
|
72
73
|
input: [
|
73
74
|
:onselect,
|
74
75
|
:onchange,
|
@@ -80,7 +81,7 @@ class Javascript
|
|
80
81
|
:oninput
|
81
82
|
],
|
82
83
|
|
83
|
-
# These need to be covered via
|
84
|
+
# These need to be covered via Selenium's API, #send_keys etc.
|
84
85
|
textarea: [
|
85
86
|
:onselect,
|
86
87
|
:onchange,
|
@@ -138,12 +139,31 @@ class Javascript
|
|
138
139
|
@event_whitelist ||= Set.new( events.flatten.map(&:to_s) )
|
139
140
|
end
|
140
141
|
|
141
|
-
# @param [Symbol]
|
142
|
+
# @param [Symbol] tag_name
|
142
143
|
#
|
143
|
-
# @return [
|
144
|
+
# @return [Set<Symbol>]
|
144
145
|
# Events for `element`.
|
145
|
-
def self.events_for(
|
146
|
-
|
146
|
+
def self.events_for( tag_name )
|
147
|
+
CACHE[:events_for].fetch tag_name.to_sym do
|
148
|
+
Set.new(
|
149
|
+
GLOBAL_EVENTS + (EVENTS_PER_ELEMENT[tag_name.to_sym] || [])
|
150
|
+
).freeze
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# @param [Symbol] tag_name
|
155
|
+
# @param [Hash] events
|
156
|
+
# Event data with the event name as the key.
|
157
|
+
#
|
158
|
+
# @return [Hash]
|
159
|
+
# `events` filtered to only include valid events for the given element type.
|
160
|
+
def self.select_events( tag_name, events )
|
161
|
+
CACHE[:select_events].fetch [tag_name, events] do
|
162
|
+
supported = events_for( tag_name )
|
163
|
+
events.reject do |name, _|
|
164
|
+
!supported.include?( ('on' + name.to_s.gsub( /^on/, '' )).to_sym )
|
165
|
+
end.freeze
|
166
|
+
end
|
147
167
|
end
|
148
168
|
|
149
169
|
# @param [Hash] attributes
|
@@ -152,11 +172,13 @@ class Javascript
|
|
152
172
|
# @return [Hash]
|
153
173
|
# `attributes` that include {.events}.
|
154
174
|
def self.select_event_attributes( attributes = {} )
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
175
|
+
# NOTICE: Don't cache this, attributes can include all kinds of weird
|
176
|
+
# random crap (framework-specific data nonce attributes etc.) which will
|
177
|
+
# keep filling the cache due to constant misses.
|
178
|
+
attributes.inject({}) do |h, (event, handler)|
|
179
|
+
next h if !event_whitelist.include?( event.to_s )
|
180
|
+
h.merge!( event.to_sym => handler )
|
181
|
+
end.freeze
|
160
182
|
end
|
161
183
|
|
162
184
|
# @param [Browser] browser
|
@@ -231,8 +253,8 @@ class Javascript
|
|
231
253
|
#
|
232
254
|
# @return [Object]
|
233
255
|
# Result of `script`.
|
234
|
-
def run(
|
235
|
-
@browser.
|
256
|
+
def run( *args )
|
257
|
+
@browser.selenium.execute_script *args
|
236
258
|
end
|
237
259
|
|
238
260
|
# Executes the given code but unwraps Watir elements.
|
@@ -242,8 +264,13 @@ class Javascript
|
|
242
264
|
#
|
243
265
|
# @return [Object]
|
244
266
|
# Result of `script`.
|
245
|
-
def run_without_elements(
|
246
|
-
unwrap_elements run(
|
267
|
+
def run_without_elements( *args )
|
268
|
+
unwrap_elements run( *args )
|
269
|
+
end
|
270
|
+
|
271
|
+
def has_sinks?
|
272
|
+
return false if !supported?
|
273
|
+
taint_tracer.has_sinks( @taint )
|
247
274
|
end
|
248
275
|
|
249
276
|
# @return (see TaintTracer#debug)
|
@@ -300,8 +327,6 @@ class Javascript
|
|
300
327
|
dom_monitor.elements_with_events.map do |element|
|
301
328
|
next if NO_EVENTS_FOR_ELEMENTS.include? element['tag_name'].to_sym
|
302
329
|
|
303
|
-
attributes = element['attributes']
|
304
|
-
|
305
330
|
element['events'] = (element['events'].map do |event, fn|
|
306
331
|
next if !(self.class.event_whitelist.include?( event ) ||
|
307
332
|
self.class.event_whitelist.include?( "on#{event}" ))
|
@@ -309,7 +334,15 @@ class Javascript
|
|
309
334
|
[event.to_sym, fn]
|
310
335
|
end.compact)
|
311
336
|
|
312
|
-
element['events'] |= self.class.select_event_attributes( attributes ).to_a
|
337
|
+
element['events'] |= self.class.select_event_attributes( element['attributes'] ).to_a
|
338
|
+
element['events'] = self.class.select_events( element['tag_name'], element['events'] ).dup
|
339
|
+
|
340
|
+
categorized = {}
|
341
|
+
element['events'].each do |event, callback|
|
342
|
+
categorized[event] ||= []
|
343
|
+
categorized[event] << callback
|
344
|
+
end
|
345
|
+
element['events'] = categorized
|
313
346
|
|
314
347
|
element
|
315
348
|
end.compact
|
@@ -382,7 +415,7 @@ class Javascript
|
|
382
415
|
|
383
416
|
body = response.body.dup
|
384
417
|
|
385
|
-
update_taints( body )
|
418
|
+
update_taints( body, response )
|
386
419
|
update_custom_code( body )
|
387
420
|
|
388
421
|
response.body = body
|
@@ -410,10 +443,11 @@ class Javascript
|
|
410
443
|
|
411
444
|
# Include and initialize our JS interfaces.
|
412
445
|
response.body = <<-EOHTML
|
446
|
+
<script src="#{script_url_for( :polyfills )}"></script> #{html_comment}
|
413
447
|
<script src="#{script_url_for( :taint_tracer )}"></script> #{html_comment}
|
414
448
|
<script src="#{script_url_for( :dom_monitor )}"></script> #{html_comment}
|
415
449
|
<script>
|
416
|
-
#{wrapped_taint_tracer_initializer}
|
450
|
+
#{wrapped_taint_tracer_initializer( response )}
|
417
451
|
#{js_initialization_signal};
|
418
452
|
|
419
453
|
#{wrapped_custom_code}
|
@@ -423,8 +457,6 @@ class Javascript
|
|
423
457
|
EOHTML
|
424
458
|
end
|
425
459
|
|
426
|
-
response.headers['content-length'] = response.body.size
|
427
|
-
|
428
460
|
true
|
429
461
|
end
|
430
462
|
|
@@ -440,9 +472,12 @@ class Javascript
|
|
440
472
|
|
441
473
|
# Let's check that the response at least looks like it contains HTML
|
442
474
|
# code of interest.
|
443
|
-
body = response.body.downcase
|
475
|
+
body = response.body.downcase.strip
|
444
476
|
return false if !HTML_IDENTIFIERS.find { |tag| body.include? tag.downcase }
|
445
477
|
|
478
|
+
# If there's a doctype then we're good to go.
|
479
|
+
return true if body.start_with?( '<!doctype html' )
|
480
|
+
|
446
481
|
# The last check isn't fool-proof, so don't do it when loading the page
|
447
482
|
# for the first time, but only when the page loads stuff via AJAX and whatnot.
|
448
483
|
#
|
@@ -455,8 +490,10 @@ class Javascript
|
|
455
490
|
#
|
456
491
|
# For example, it may have been JSON with the wrong content-type that
|
457
492
|
# includes HTML -- it happens.
|
493
|
+
#
|
494
|
+
# Beware, if there's a doctype in the beginning this will fail.
|
458
495
|
begin
|
459
|
-
return false if
|
496
|
+
return false if Parser.parse_xml( response.body ).children.empty?
|
460
497
|
rescue => e
|
461
498
|
print_debug "Does not look like HTML: #{response.url}"
|
462
499
|
print_debug "\n#{response.body}"
|
@@ -477,22 +514,48 @@ class Javascript
|
|
477
514
|
"<!-- Injected by #{self.class} -->"
|
478
515
|
end
|
479
516
|
|
480
|
-
def taints
|
481
|
-
taints =
|
517
|
+
def taints( response )
|
518
|
+
taints = {}
|
519
|
+
|
520
|
+
[@taint].flatten.compact.each do |t|
|
521
|
+
taints[t] = {
|
522
|
+
stop_at_first: false,
|
523
|
+
trace: true
|
524
|
+
}
|
525
|
+
end
|
482
526
|
|
483
527
|
# Include cookie names and values in the trace so that the browser will
|
484
528
|
# be able to infer if they're being used, to avoid unnecessary audits.
|
485
529
|
if Options.audit.cookie_doms?
|
486
|
-
|
530
|
+
cookies = begin
|
531
|
+
HTTP::Client.cookie_jar.for_url( response.url )
|
532
|
+
rescue
|
533
|
+
print_debug "Could not get cookies for URL '#{response.url}' from Cookiejar (#{e})."
|
534
|
+
print_debug_exception e
|
535
|
+
HTTP::Client.cookies
|
536
|
+
end
|
537
|
+
|
538
|
+
cookies.each do |c|
|
539
|
+
next if c.http_only?
|
540
|
+
|
541
|
+
c.inputs.to_a.flatten.each do |input|
|
542
|
+
next if input.empty?
|
543
|
+
|
544
|
+
taints[input] ||= {
|
545
|
+
stop_at_first: true,
|
546
|
+
trace: false
|
547
|
+
}
|
548
|
+
end
|
549
|
+
end
|
487
550
|
end
|
488
551
|
|
489
|
-
taints
|
552
|
+
taints
|
490
553
|
end
|
491
554
|
|
492
|
-
def update_taints( body )
|
555
|
+
def update_taints( body, response )
|
493
556
|
body.gsub!(
|
494
557
|
/\/\* #{token}_initialize_start \*\/(.*)\/\* #{token}_initialize_stop \*\//,
|
495
|
-
wrapped_taint_tracer_initializer
|
558
|
+
wrapped_taint_tracer_initializer( response )
|
496
559
|
)
|
497
560
|
end
|
498
561
|
|
@@ -503,9 +566,9 @@ class Javascript
|
|
503
566
|
)
|
504
567
|
end
|
505
568
|
|
506
|
-
def wrapped_taint_tracer_initializer
|
569
|
+
def wrapped_taint_tracer_initializer( response )
|
507
570
|
"/* #{token}_initialize_start */ " <<
|
508
|
-
"#{@taint_tracer.stub.function( :initialize, taints )} " <<
|
571
|
+
"#{@taint_tracer.stub.function( :initialize, taints( response ) )} " <<
|
509
572
|
"/* #{token}_initialize_stop */"
|
510
573
|
end
|
511
574
|
|
@@ -548,6 +611,9 @@ class Javascript
|
|
548
611
|
when Watir::Element
|
549
612
|
unwrap_element( obj )
|
550
613
|
|
614
|
+
when Selenium::WebDriver::Element
|
615
|
+
unwrap_element( obj )
|
616
|
+
|
551
617
|
when Array
|
552
618
|
obj.map { |e| unwrap_elements( e ) }
|
553
619
|
|
@@ -562,6 +628,8 @@ class Javascript
|
|
562
628
|
|
563
629
|
def unwrap_element( element )
|
564
630
|
element.html
|
631
|
+
rescue Selenium::WebDriver::Error::StaleElementReferenceError
|
632
|
+
''
|
565
633
|
end
|
566
634
|
|
567
635
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright 2010-
|
2
|
+
Copyright 2010-2016 Tasos Laskos <tasos.laskos@arachni-scanner.com>
|
3
3
|
|
4
4
|
This file is part of the Arachni Framework project and is subject to
|
5
5
|
redistribution and commercial restrictions. Please see the Arachni Framework
|
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright 2010-
|
2
|
+
Copyright 2010-2016 Tasos Laskos <tasos.laskos@arachni-scanner.com>
|
3
3
|
|
4
4
|
This file is part of the Arachni Framework project and is subject to
|
5
5
|
redistribution and commercial restrictions. Please see the Arachni Framework
|
@@ -34,7 +34,6 @@ class Proxy < BasicObject
|
|
34
34
|
@javascript = javascript
|
35
35
|
@object = object
|
36
36
|
@stub = Stub.new( self )
|
37
|
-
@isFunction = {}
|
38
37
|
end
|
39
38
|
|
40
39
|
# @param [#to_sym] name
|
@@ -44,20 +43,7 @@ class Proxy < BasicObject
|
|
44
43
|
# `true` if the `name` property of the current object points to a function,
|
45
44
|
# `false` otherwise.
|
46
45
|
def function?( name )
|
47
|
-
|
48
|
-
|
49
|
-
if name.to_s.end_with? '='
|
50
|
-
name = name.to_s
|
51
|
-
return @isFunction[name.to_sym] = @javascript.run(
|
52
|
-
"return ('#{name[0...-1]}' in #{js_object})"
|
53
|
-
)
|
54
|
-
end
|
55
|
-
|
56
|
-
@isFunction[name.to_sym] =
|
57
|
-
@javascript.run(
|
58
|
-
"return Object.prototype.toString.call( #{js_object}." <<
|
59
|
-
"#{name} ) == '[object Function]'"
|
60
|
-
)
|
46
|
+
self.class.function?( @javascript, js_object, name )
|
61
47
|
end
|
62
48
|
|
63
49
|
# @return [String]
|
@@ -86,6 +72,32 @@ class Proxy < BasicObject
|
|
86
72
|
def class
|
87
73
|
Proxy
|
88
74
|
end
|
75
|
+
|
76
|
+
def self.function?( env, object, name )
|
77
|
+
mutex.synchronize do
|
78
|
+
@isFunction ||= {}
|
79
|
+
key = "#{object}.#{name}".hash
|
80
|
+
|
81
|
+
return @isFunction[key] if @isFunction.include?( key )
|
82
|
+
|
83
|
+
if name.to_s.end_with? '='
|
84
|
+
name = name.to_s
|
85
|
+
return @isFunction[key] = env.run(
|
86
|
+
"return ('#{name[0...-1]}' in #{object})"
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
@isFunction[key] = env.run(
|
91
|
+
"return Object.prototype.toString.call( #{object}." <<
|
92
|
+
"#{name} ) == '[object Function]'"
|
93
|
+
)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
def self.mutex
|
97
|
+
@mutex ||= ::Mutex.new
|
98
|
+
end
|
99
|
+
mutex
|
100
|
+
|
89
101
|
end
|
90
102
|
|
91
103
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright 2010-
|
2
|
+
Copyright 2010-2016 Tasos Laskos <tasos.laskos@arachni-scanner.com>
|
3
3
|
|
4
4
|
This file is part of the Arachni Framework project and is subject to
|
5
5
|
redistribution and commercial restrictions. Please see the Arachni Framework
|
@@ -1,11 +1,18 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright 2010-
|
2
|
+
* Copyright 2010-2016 Tasos Laskos <tasos.laskos@arachni-scanner.com>
|
3
3
|
*
|
4
4
|
* This file is part of the Arachni Framework project and is subject to
|
5
5
|
* redistribution and commercial restrictions. Please see the Arachni Framework
|
6
6
|
* web site for more information on licensing and terms of use.
|
7
7
|
*/
|
8
8
|
|
9
|
+
//if( !window.onerror ) {
|
10
|
+
// window.errors = [];
|
11
|
+
// window.onerror = function() {
|
12
|
+
// window.errors.push( arguments )
|
13
|
+
// };
|
14
|
+
//}
|
15
|
+
|
9
16
|
/*
|
10
17
|
* Allows the system to optimize DOM/JS/AJAX analysis by overriding JS prototypes
|
11
18
|
* and tracking things like bound events and timers.
|
@@ -26,7 +33,46 @@ var _tokenDOMMonitor = _tokenDOMMonitor || {
|
|
26
33
|
|
27
34
|
exclude_attributes_from_digest: ['data-arachni-id'],
|
28
35
|
|
29
|
-
|
36
|
+
event_attributes: {
|
37
|
+
"click" : true,
|
38
|
+
"dblclick" : true,
|
39
|
+
"mousedown" : true,
|
40
|
+
"mousemove" : true,
|
41
|
+
"mouseout" : true,
|
42
|
+
"mouseover" : true,
|
43
|
+
"mouseup" : true,
|
44
|
+
"load" : true,
|
45
|
+
"submit" : true,
|
46
|
+
"reset" : true,
|
47
|
+
"select" : true,
|
48
|
+
"change" : true,
|
49
|
+
"focus" : true,
|
50
|
+
"blur" : true,
|
51
|
+
"keydown" : true,
|
52
|
+
"keypress" : true,
|
53
|
+
"keyup" : true,
|
54
|
+
"input" : true
|
55
|
+
},
|
56
|
+
|
57
|
+
allowed_elements_without_events: {
|
58
|
+
"a": true,
|
59
|
+
"input": true,
|
60
|
+
"textarea": true,
|
61
|
+
"select": true,
|
62
|
+
"form": true
|
63
|
+
},
|
64
|
+
|
65
|
+
allowed_elements_with_inherited_events: {
|
66
|
+
"a": true,
|
67
|
+
"input": true,
|
68
|
+
"textarea": true,
|
69
|
+
"select": true,
|
70
|
+
"form": true,
|
71
|
+
"li": true,
|
72
|
+
"span": true,
|
73
|
+
"button": true
|
74
|
+
},
|
75
|
+
|
30
76
|
initialize: function () {
|
31
77
|
if( _tokenDOMMonitor.initialized ) return;
|
32
78
|
|
@@ -38,36 +84,57 @@ var _tokenDOMMonitor = _tokenDOMMonitor || {
|
|
38
84
|
},
|
39
85
|
|
40
86
|
update_trackers: function () {
|
41
|
-
_tokenDOMMonitor.track_jQuery_delegated_events();
|
42
87
|
},
|
43
88
|
|
44
|
-
// Returns information about all DOM elements
|
45
|
-
//
|
89
|
+
// Returns information about all DOM elements that have events, along with
|
90
|
+
// some elements that
|
46
91
|
elements_with_events: function () {
|
47
92
|
var events_with_elements = [];
|
48
93
|
var elements = document.getElementsByTagName("*");
|
49
94
|
var length = elements.length;
|
50
95
|
|
96
|
+
var global_events = window._arachni_events || [];
|
97
|
+
global_events = global_events.concat( document._arachni_events || [] );
|
98
|
+
global_events = _tokenDOMMonitor.arrayUnique( global_events );
|
99
|
+
|
51
100
|
for( var i = 0; i < length; i++ ) {
|
101
|
+
var has_events = false;
|
52
102
|
var element = elements[i];
|
53
103
|
|
104
|
+
_tokenDOMMonitor.bequeath_events( element );
|
105
|
+
|
54
106
|
// Skip invisible elements.
|
55
107
|
if( element.offsetWidth <= 0 && element.offsetHeight <= 0 ) continue;
|
56
108
|
|
57
|
-
_tokenDOMMonitor.apply_jQuery_delegated_events( element );
|
58
|
-
|
59
109
|
var e = {
|
60
110
|
tag_name: element.tagName.toLowerCase(),
|
61
111
|
events: element._arachni_events || [],
|
62
112
|
attributes: {}
|
63
113
|
};
|
64
114
|
|
115
|
+
if( _tokenDOMMonitor.is_allowed_element_with_inherited_events( e.tag_name ) ) {
|
116
|
+
e.events = e.events.concat( element._arachni_inherited_events || [] );
|
117
|
+
e.events = _tokenDOMMonitor.arrayUnique( e.events.concat( global_events ) );
|
118
|
+
}
|
119
|
+
|
65
120
|
var attributes = element.attributes;
|
66
121
|
var attr_length = attributes.length;
|
67
122
|
|
68
123
|
for( var j = 0; j < attr_length; j++ ){
|
69
|
-
|
124
|
+
var attr_name = attributes[j].nodeName;
|
125
|
+
|
126
|
+
if( _tokenDOMMonitor.is_valid_event( attr_name ) ) {
|
127
|
+
has_events = true;
|
128
|
+
}
|
129
|
+
|
130
|
+
e.attributes[attr_name] = attributes[j].nodeValue;
|
131
|
+
}
|
132
|
+
|
133
|
+
if( !_tokenDOMMonitor.is_allowed_element_without_event( e.tag_name ) &&
|
134
|
+
!has_events && e.events.length == 0 ) {
|
135
|
+
continue
|
70
136
|
}
|
137
|
+
has_events = false;
|
71
138
|
|
72
139
|
events_with_elements.push( e );
|
73
140
|
}
|
@@ -75,6 +142,27 @@ var _tokenDOMMonitor = _tokenDOMMonitor || {
|
|
75
142
|
return events_with_elements;
|
76
143
|
},
|
77
144
|
|
145
|
+
is_valid_event: function ( event ) {
|
146
|
+
return Object.prototype.hasOwnProperty.call(
|
147
|
+
_tokenDOMMonitor.event_attributes,
|
148
|
+
event.replace( 'on', '' )
|
149
|
+
);
|
150
|
+
},
|
151
|
+
|
152
|
+
is_allowed_element_without_event: function ( tag_name ) {
|
153
|
+
return Object.prototype.hasOwnProperty.call(
|
154
|
+
_tokenDOMMonitor.allowed_elements_without_events,
|
155
|
+
tag_name
|
156
|
+
);
|
157
|
+
},
|
158
|
+
|
159
|
+
is_allowed_element_with_inherited_events: function ( tag_name ) {
|
160
|
+
return Object.prototype.hasOwnProperty.call(
|
161
|
+
_tokenDOMMonitor.allowed_elements_with_inherited_events,
|
162
|
+
tag_name
|
163
|
+
);
|
164
|
+
},
|
165
|
+
|
78
166
|
// Returns a string digest of the current DOM tree (i.e. node names and their
|
79
167
|
// attributes without text-nodes).
|
80
168
|
digest: function () {
|
@@ -128,54 +216,6 @@ var _tokenDOMMonitor = _tokenDOMMonitor || {
|
|
128
216
|
};
|
129
217
|
},
|
130
218
|
|
131
|
-
track_jQuery_delegated_events: function () {
|
132
|
-
if( _tokenDOMMonitor.tracked_jQuery_delegated_events || !window.jQuery ) return;
|
133
|
-
_tokenDOMMonitor.tracked_jQuery_delegated_events = true;
|
134
|
-
|
135
|
-
var original = window.jQuery.fn.on;
|
136
|
-
|
137
|
-
// We only care for calls with selectors, as any other will attach the
|
138
|
-
// events to the DOM element immediately and thus be captured by the
|
139
|
-
// addEventListener tracker.
|
140
|
-
window.jQuery.fn.on = function ( types, selector, data, fn, one ) {
|
141
|
-
|
142
|
-
// Types can be a map of types/handlers, in that case just run
|
143
|
-
// the original as it'll act recursively and pass itself (which is
|
144
|
-
// this override, really) each type.
|
145
|
-
if ( typeof types === "object" ) {
|
146
|
-
return original.apply( this, [].slice.call( arguments ) );
|
147
|
-
}
|
148
|
-
|
149
|
-
if ( data == null && fn == null ) {
|
150
|
-
// ( types, fn ) -- no selector, bail out.
|
151
|
-
return original.apply( this, [].slice.call( arguments ) );
|
152
|
-
} else if ( fn == null ) {
|
153
|
-
if ( typeof selector === "string" ) {
|
154
|
-
// ( types, selector, fn ) -- with selector, proceed.
|
155
|
-
fn = data;
|
156
|
-
} else {
|
157
|
-
// ( types, data, fn ) -- no selector, bail out.
|
158
|
-
return original.apply( this, [].slice.call( arguments ) );
|
159
|
-
}
|
160
|
-
}
|
161
|
-
|
162
|
-
if( selector ) {
|
163
|
-
this.each( function( i, e ){
|
164
|
-
e['_arachni_jquery_delegated_event'] =
|
165
|
-
e['_arachni_jquery_delegated_event'] || [];
|
166
|
-
|
167
|
-
e['_arachni_jquery_delegated_event'].push({
|
168
|
-
selector: selector,
|
169
|
-
event: types,
|
170
|
-
handler: fn
|
171
|
-
});
|
172
|
-
});
|
173
|
-
}
|
174
|
-
|
175
|
-
return original.apply( this, [].slice.call( arguments ) );
|
176
|
-
};
|
177
|
-
},
|
178
|
-
|
179
219
|
// Overrides window.addEventListener and Node.prototype.addEventListener
|
180
220
|
// to intercept event binds so that we can keep track of them in order to
|
181
221
|
// optimize DOM analysis.
|
@@ -188,6 +228,14 @@ var _tokenDOMMonitor = _tokenDOMMonitor || {
|
|
188
228
|
original_Window_addEventListener.apply( window, [].slice.call( arguments ) );
|
189
229
|
};
|
190
230
|
|
231
|
+
// Override document.addEventListener
|
232
|
+
var original_Document_addEventListener = document.addEventListener;
|
233
|
+
|
234
|
+
document.addEventListener = function ( event, listener, useCapture ) {
|
235
|
+
_tokenDOMMonitor.registerEvent( document, event, listener );
|
236
|
+
original_Document_addEventListener.apply( document, [].slice.call( arguments ) );
|
237
|
+
};
|
238
|
+
|
191
239
|
// Override Node.prototype.addEventListener
|
192
240
|
var original_Node_addEventListener = Node.prototype.addEventListener;
|
193
241
|
|
@@ -197,21 +245,40 @@ var _tokenDOMMonitor = _tokenDOMMonitor || {
|
|
197
245
|
};
|
198
246
|
},
|
199
247
|
|
200
|
-
|
201
|
-
|
248
|
+
bequeath_events: function( element ) {
|
249
|
+
var children = element.childNodes;
|
250
|
+
|
251
|
+
for( var i = 0; i < children.length; i++ ) {
|
252
|
+
var child = children[i];
|
253
|
+
|
254
|
+
if( !('_arachni_inherited_events' in child) ) child['_arachni_inherited_events'] = [];
|
255
|
+
|
256
|
+
if( element['_arachni_events'] ) {
|
257
|
+
child['_arachni_inherited_events'] =
|
258
|
+
element['_arachni_events'].concat( child['_arachni_inherited_events'] );
|
259
|
+
}
|
260
|
+
|
261
|
+
if( element['_arachni_inherited_events'] ) {
|
262
|
+
child['_arachni_inherited_events'] =
|
263
|
+
element['_arachni_inherited_events'].concat( child['_arachni_inherited_events'] );
|
264
|
+
}
|
202
265
|
|
203
|
-
|
204
|
-
|
266
|
+
child['_arachni_inherited_events'] =
|
267
|
+
_tokenDOMMonitor.arrayUnique( child['_arachni_inherited_events'] )
|
268
|
+
}
|
269
|
+
},
|
205
270
|
|
206
|
-
|
207
|
-
|
271
|
+
arrayUnique: function( array ) {
|
272
|
+
var a = array.concat();
|
208
273
|
|
209
|
-
|
210
|
-
|
211
|
-
|
274
|
+
for( var i = 0; i < a.length; ++i ) {
|
275
|
+
for( var j = i + 1; j < a.length; ++j ) {
|
276
|
+
if( a[i] === a[j] )
|
277
|
+
a.splice( j--, 1 );
|
278
|
+
}
|
212
279
|
}
|
213
280
|
|
214
|
-
|
281
|
+
return a;
|
215
282
|
},
|
216
283
|
|
217
284
|
// Registers an event and its handler for the given element.
|
@@ -219,7 +286,11 @@ var _tokenDOMMonitor = _tokenDOMMonitor || {
|
|
219
286
|
if( !('_arachni_events' in element) ) element['_arachni_events'] = [];
|
220
287
|
|
221
288
|
// Custom events are usually in the form of "click.delegateEventsview13".
|
222
|
-
|
289
|
+
event = event.split( '.' )[0];
|
290
|
+
|
291
|
+
if( _tokenDOMMonitor.is_valid_event( event ) ) {
|
292
|
+
element['_arachni_events'].push( [event, handler] );
|
293
|
+
}
|
223
294
|
},
|
224
295
|
|
225
296
|
// Sets a unique enough custom ID attribute to elements that lack proper IDs.
|