arachni 1.4 → 1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +136 -0
- data/Gemfile +3 -1
- data/LICENSE.md +1 -1
- data/README.md +5 -2
- data/Rakefile +1 -1
- data/arachni.gemspec +35 -30
- data/bin/arachni +1 -1
- data/bin/arachni_console +1 -1
- data/bin/arachni_multi +6 -1
- data/bin/arachni_reporter +1 -1
- data/bin/arachni_reproduce +12 -0
- data/bin/arachni_rest_server +1 -1
- data/bin/arachni_restore +1 -1
- data/bin/arachni_rpc +6 -1
- data/bin/arachni_rpcd +1 -1
- data/bin/arachni_rpcd_monitor +6 -1
- data/bin/arachni_script +1 -1
- data/components/checks/active/code_injection.rb +1 -1
- data/components/checks/active/code_injection_php_input_wrapper.rb +1 -1
- data/components/checks/active/code_injection_timing.rb +1 -1
- data/components/checks/active/csrf.rb +15 -75
- data/components/checks/active/file_inclusion.rb +1 -1
- data/components/checks/active/ldap_injection.rb +1 -1
- data/components/checks/active/no_sql_injection.rb +1 -1
- data/components/checks/active/no_sql_injection_differential.rb +1 -1
- data/components/checks/active/os_cmd_injection.rb +1 -1
- data/components/checks/active/os_cmd_injection_timing.rb +1 -1
- data/components/checks/active/path_traversal.rb +3 -3
- data/components/checks/active/response_splitting.rb +1 -1
- data/components/checks/active/rfi.rb +1 -1
- data/components/checks/active/session_fixation.rb +1 -1
- data/components/checks/active/source_code_disclosure.rb +1 -1
- data/components/checks/active/sql_injection.rb +1 -1
- data/components/checks/active/sql_injection/regexps/hsqldb.yaml +1 -0
- data/components/checks/active/sql_injection/substrings/hsqldb +1 -0
- data/components/checks/active/sql_injection/substrings/java +4 -0
- data/components/checks/active/sql_injection/substrings/oracle +0 -1
- data/components/checks/active/sql_injection/substrings/sqlite +1 -0
- data/components/checks/active/sql_injection_differential.rb +1 -1
- data/components/checks/active/sql_injection_timing.rb +1 -1
- data/components/checks/active/trainer.rb +1 -1
- data/components/checks/active/unvalidated_redirect.rb +34 -11
- data/components/checks/active/unvalidated_redirect_dom.rb +4 -4
- data/components/checks/active/xpath_injection.rb +1 -1
- data/components/checks/active/xss.rb +52 -27
- data/components/checks/active/xss_dom.rb +15 -11
- data/components/checks/active/xss_dom_script_context.rb +4 -6
- data/components/checks/active/xss_event.rb +45 -33
- data/components/checks/active/xss_path.rb +9 -6
- data/components/checks/active/xss_script_context.rb +99 -46
- data/components/checks/active/xss_tag.rb +39 -14
- data/components/checks/active/xxe.rb +1 -1
- data/components/checks/passive/allowed_methods.rb +1 -1
- data/components/checks/passive/backdoors.rb +1 -1
- data/components/checks/passive/backup_directories.rb +15 -3
- data/components/checks/passive/backup_files.rb +39 -6
- data/components/checks/passive/common_admin_interfaces.rb +1 -1
- data/components/checks/passive/common_admin_interfaces/admin-panels.txt +1 -0
- data/components/checks/passive/common_directories.rb +1 -1
- data/components/checks/passive/common_files.rb +1 -1
- data/components/checks/passive/directory_listing.rb +1 -1
- data/components/checks/passive/grep/captcha.rb +8 -9
- data/components/checks/passive/grep/cookie_set_for_parent_domain.rb +1 -1
- data/components/checks/passive/grep/credit_card.rb +1 -1
- data/components/checks/passive/grep/cvs_svn_users.rb +1 -1
- data/components/checks/passive/grep/emails.rb +1 -1
- data/components/checks/passive/grep/form_upload.rb +3 -5
- data/components/checks/passive/grep/hsts.rb +1 -1
- data/components/checks/passive/grep/html_objects.rb +1 -1
- data/components/checks/passive/grep/http_only_cookies.rb +1 -1
- data/components/checks/passive/grep/insecure_cookies.rb +5 -5
- data/components/checks/passive/grep/insecure_cors_policy.rb +1 -1
- data/components/checks/passive/grep/mixed_resource.rb +4 -4
- 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 +1 -1
- data/components/checks/passive/grep/unencrypted_password_forms.rb +3 -3
- data/components/checks/passive/grep/x_frame_options.rb +1 -1
- 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 +10 -12
- 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 +3 -5
- data/components/path_extractors/areas.rb +3 -4
- data/components/path_extractors/comments.rb +4 -5
- data/components/path_extractors/data_url.rb +4 -5
- data/components/path_extractors/forms.rb +3 -4
- data/components/path_extractors/frames.rb +3 -5
- data/components/path_extractors/generic.rb +3 -1
- data/components/path_extractors/links.rb +3 -4
- data/components/path_extractors/meta_refresh.rb +11 -17
- data/components/path_extractors/scripts.rb +18 -15
- data/components/plugins/autologin.rb +3 -2
- 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/debug/browser_cluster_job_monitor.rb +60 -0
- data/components/plugins/defaults/autothrottle.rb +1 -1
- data/components/plugins/defaults/healthmap.rb +3 -1
- data/components/plugins/defaults/meta/remedies/discovery.rb +1 -1
- 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 +26 -9
- data/components/plugins/exec.rb +1 -1
- data/components/plugins/form_dicattack.rb +3 -4
- data/components/plugins/headers_collector.rb +1 -1
- data/components/plugins/http_dicattack.rb +4 -5
- data/components/plugins/login_script.rb +2 -2
- data/components/plugins/metrics.rb +41 -15
- data/components/plugins/page_dump.rb +60 -0
- data/components/plugins/proxy.rb +42 -30
- data/components/plugins/proxy/template_scope.rb +6 -1
- data/components/plugins/rate_limiter.rb +80 -0
- data/components/plugins/restrict_to_dom_state.rb +1 -1
- 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 +1 -1
- data/components/plugins/waf_detector.rb +3 -3
- data/components/plugins/webhook_notify.rb +99 -0
- data/components/reporters/ap.rb +1 -1
- data/components/reporters/html.rb +2 -3
- data/components/reporters/html/default.erb +1 -2
- data/components/reporters/html/default/configuration.erb +2 -0
- 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 +46 -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 +11 -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 +10 -7
- data/components/reporters/plugin_formatters/xml/cookie_collector.rb +6 -3
- 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 +5 -2
- data/components/reporters/plugin_formatters/xml/uniformity.rb +1 -1
- data/components/reporters/plugin_formatters/xml/vector_collector.rb +8 -5
- data/components/reporters/plugin_formatters/xml/waf_detector.rb +1 -1
- data/components/reporters/stdout.rb +3 -2
- data/components/reporters/txt.rb +1 -1
- data/components/reporters/xml.rb +39 -22
- data/components/reporters/xml/schema.xsd +28 -13
- data/components/reporters/yaml.rb +1 -1
- data/lib/arachni.rb +1 -1
- data/lib/arachni/banner.rb +1 -1
- data/lib/arachni/browser.rb +242 -231
- data/lib/arachni/browser/element_locator.rb +9 -5
- data/lib/arachni/browser/javascript.rb +103 -168
- data/lib/arachni/browser/javascript/dom_monitor.rb +1 -1
- data/lib/arachni/browser/javascript/proxy.rb +1 -1
- data/lib/arachni/browser/javascript/proxy/stub.rb +1 -1
- data/lib/arachni/browser/javascript/scripts/dom_monitor.js +295 -51
- data/lib/arachni/browser/javascript/scripts/polyfills.js +0 -28
- data/lib/arachni/browser/javascript/scripts/taint_tracer.js +46 -8
- 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 +78 -60
- data/lib/arachni/browser_cluster/job.rb +9 -2
- data/lib/arachni/browser_cluster/job/result.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/browser_provider.rb +8 -2
- data/lib/arachni/browser_cluster/jobs/dom_exploration.rb +13 -1
- data/lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger/result.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/dom_exploration/result.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace/event_trigger.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace/event_trigger/result.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace/result.rb +1 -1
- data/lib/arachni/browser_cluster/worker.rb +109 -84
- data/lib/arachni/check.rb +1 -1
- data/lib/arachni/check/auditor.rb +137 -93
- 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 +3 -1
- data/lib/arachni/component/manager.rb +1 -1
- 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 +8 -2
- data/lib/arachni/component/utilities.rb +1 -1
- data/lib/arachni/data.rb +1 -1
- data/lib/arachni/data/framework.rb +2 -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 +1 -1
- 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 +142 -175
- data/lib/arachni/element/capabilities/analyzable/signature.rb +39 -17
- data/lib/arachni/element/capabilities/analyzable/timeout.rb +1 -1
- data/lib/arachni/element/capabilities/auditable.rb +2 -8
- data/lib/arachni/element/capabilities/auditable/buffered.rb +92 -0
- data/lib/arachni/element/capabilities/auditable/line_buffered.rb +103 -0
- data/lib/arachni/element/capabilities/dom_only.rb +1 -1
- data/lib/arachni/element/capabilities/inputtable.rb +6 -2
- data/lib/arachni/element/capabilities/mutable.rb +1 -1
- data/lib/arachni/element/capabilities/refreshable.rb +1 -1
- data/lib/arachni/element/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/capabilities/with_auditor.rb +1 -1
- data/lib/arachni/element/capabilities/with_auditor/output.rb +4 -3
- data/lib/arachni/element/capabilities/with_dom.rb +1 -1
- data/lib/arachni/element/capabilities/with_node.rb +3 -3
- 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 +2 -2
- data/lib/arachni/element/cookie.rb +49 -24
- data/lib/arachni/element/cookie/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/cookie/capabilities/mutable.rb +1 -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 -1
- data/lib/arachni/element/dom/capabilities/auditable.rb +44 -3
- data/lib/arachni/element/dom/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/dom/capabilities/locatable.rb +1 -1
- data/lib/arachni/element/dom/capabilities/mutable.rb +7 -3
- data/lib/arachni/element/dom/capabilities/submittable.rb +51 -22
- data/lib/arachni/element/form.rb +21 -32
- data/lib/arachni/element/form/capabilities/auditable.rb +1 -1
- data/lib/arachni/element/form/capabilities/mutable.rb +16 -11
- data/lib/arachni/element/form/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/form/capabilities/with_dom.rb +1 -1
- data/lib/arachni/element/form/dom.rb +1 -1
- data/lib/arachni/element/generic_dom.rb +1 -1
- data/lib/arachni/element/header.rb +3 -1
- data/lib/arachni/element/header/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/header/capabilities/mutable.rb +1 -1
- data/lib/arachni/element/json.rb +4 -8
- data/lib/arachni/element/json/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/json/capabilities/mutable.rb +1 -1
- data/lib/arachni/element/link.rb +11 -30
- 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 +1 -1
- data/lib/arachni/element/link/dom.rb +1 -1
- data/lib/arachni/element/link/dom/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/link_template.rb +10 -19
- 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 -2
- 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 +11 -11
- data/lib/arachni/element/ui_form.rb +5 -6
- data/lib/arachni/element/ui_form/dom.rb +1 -1
- data/lib/arachni/element/ui_input.rb +4 -6
- data/lib/arachni/element/ui_input/dom.rb +1 -1
- data/lib/arachni/element/xml.rb +3 -7
- data/lib/arachni/element/xml/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/xml/capabilities/mutable.rb +1 -1
- 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 +1 -1
- data/lib/arachni/framework/parts/audit.rb +6 -1
- data/lib/arachni/framework/parts/browser.rb +14 -14
- data/lib/arachni/framework/parts/check.rb +1 -1
- data/lib/arachni/framework/parts/data.rb +1 -1
- data/lib/arachni/framework/parts/platform.rb +1 -1
- data/lib/arachni/framework/parts/plugin.rb +1 -1
- data/lib/arachni/framework/parts/report.rb +2 -2
- data/lib/arachni/framework/parts/scope.rb +1 -1
- data/lib/arachni/framework/parts/state.rb +1 -1
- data/lib/arachni/http.rb +1 -1
- data/lib/arachni/http/client.rb +32 -7
- data/lib/arachni/http/client/dynamic_404_handler.rb +74 -16
- data/lib/arachni/http/cookie_jar.rb +13 -8
- data/lib/arachni/http/headers.rb +11 -5
- data/lib/arachni/http/message.rb +9 -8
- data/lib/arachni/http/message/scope.rb +1 -1
- data/lib/arachni/http/proxy_server.rb +44 -11
- data/lib/arachni/http/proxy_server/connection.rb +113 -80
- data/lib/arachni/http/proxy_server/ssl_interceptor.rb +2 -1
- data/lib/arachni/http/proxy_server/tunnel.rb +4 -4
- data/lib/arachni/http/request.rb +236 -44
- data/lib/arachni/http/request/scope.rb +1 -1
- data/lib/arachni/http/response.rb +71 -8
- data/lib/arachni/http/response/scope.rb +1 -1
- data/lib/arachni/issue.rb +42 -14
- 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 +1 -1
- data/lib/arachni/option_groups/browser_cluster.rb +6 -2
- 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 +35 -6
- data/lib/arachni/option_groups/input.rb +1 -1
- data/lib/arachni/option_groups/output.rb +1 -1
- data/lib/arachni/option_groups/paths.rb +1 -1
- data/lib/arachni/option_groups/rpc.rb +1 -1
- data/lib/arachni/option_groups/scope.rb +13 -1
- data/lib/arachni/option_groups/session.rb +1 -1
- data/lib/arachni/option_groups/snapshot.rb +1 -1
- data/lib/arachni/options.rb +23 -4
- data/lib/arachni/page.rb +8 -6
- data/lib/arachni/page/dom.rb +46 -54
- data/lib/arachni/page/dom/transition.rb +5 -2
- data/lib/arachni/page/scope.rb +1 -1
- data/lib/arachni/parser.rb +157 -77
- data/lib/arachni/parser/document.rb +34 -0
- data/lib/arachni/parser/extractors/base.rb +48 -0
- data/lib/arachni/parser/nodes/base.rb +22 -0
- data/lib/arachni/parser/nodes/comment.rb +32 -0
- data/lib/arachni/parser/nodes/element.rb +48 -0
- data/lib/arachni/parser/nodes/element/with_attributes.rb +35 -0
- data/lib/arachni/parser/nodes/element/with_attributes/attributes.rb +31 -0
- data/lib/arachni/parser/nodes/text.rb +32 -0
- data/lib/arachni/parser/nodes/with_value.rb +29 -0
- data/lib/arachni/parser/sax.rb +75 -0
- data/lib/arachni/parser/with_children.rb +35 -0
- data/lib/arachni/parser/with_children/search.rb +92 -0
- 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 +2 -2
- data/lib/arachni/plugin/formatter.rb +1 -1
- data/lib/arachni/plugin/manager.rb +8 -5
- data/lib/arachni/processes.rb +1 -1
- data/lib/arachni/processes/dispatchers.rb +1 -1
- data/lib/arachni/processes/executables/browser.rb +0 -2
- 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 +1 -1
- data/lib/arachni/processes/manager.rb +10 -5
- data/lib/arachni/report.rb +8 -1
- data/lib/arachni/reporter.rb +1 -1
- data/lib/arachni/reporter/base.rb +1 -1
- data/lib/arachni/reporter/formatter_manager.rb +1 -1
- data/lib/arachni/reporter/manager.rb +1 -1
- data/lib/arachni/reporter/options.rb +1 -1
- data/lib/arachni/rest/server.rb +7 -1
- data/lib/arachni/rest/server/instance_helpers.rb +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -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 -1
- 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 -1
- data/lib/arachni/ruby/array.rb +1 -1
- data/lib/arachni/ruby/hash.rb +1 -1
- data/lib/arachni/ruby/object.rb +1 -1
- data/lib/arachni/ruby/set.rb +1 -1
- data/lib/arachni/ruby/string.rb +9 -5
- 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/selenium/webdriver/element.rb +4 -4
- data/lib/arachni/selenium/webdriver/remote/typhoeus.rb +69 -0
- data/lib/arachni/session.rb +32 -13
- data/lib/arachni/snapshot.rb +1 -1
- 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 +2 -2
- data/lib/arachni/state/options.rb +1 -1
- data/lib/arachni/state/plugins.rb +1 -1
- data/lib/arachni/support.rb +1 -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 +1 -1
- 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 +1 -1
- data/lib/arachni/support/cache/preference.rb +1 -1
- 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 +1 -1
- data/lib/arachni/support/database/hash.rb +1 -1
- data/lib/arachni/support/database/queue.rb +1 -1
- data/lib/arachni/support/glob.rb +1 -1
- 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 +52 -13
- data/lib/arachni/support/signature.rb +18 -6
- data/lib/arachni/trainer.rb +55 -39
- data/lib/arachni/ui/foo/output.rb +1 -1
- data/lib/arachni/uri.rb +132 -103
- data/lib/arachni/uri/scope.rb +15 -13
- data/lib/arachni/utilities.rb +10 -10
- data/lib/arachni/version.rb +1 -1
- data/lib/version +1 -1
- data/logs/error-11897.log +2006 -0
- data/logs/error-3855.log +382 -0
- data/spec/arachni/browser/element_locator_spec.rb +42 -18
- data/spec/arachni/browser/javascript/dom_monitor_spec.rb +214 -63
- data/spec/arachni/browser/javascript/polyfills_spec.rb +0 -15
- data/spec/arachni/browser/javascript/taint_tracer_spec.rb +68 -121
- data/spec/arachni/browser/javascript_spec.rb +92 -51
- data/spec/arachni/browser_cluster/job_spec.rb +23 -8
- data/spec/arachni/browser_cluster/jobs/dom_exploration_spec.rb +6 -1
- data/spec/arachni/browser_cluster/worker_spec.rb +31 -57
- data/spec/arachni/browser_cluster_spec.rb +124 -43
- data/spec/arachni/browser_spec.rb +352 -312
- data/spec/arachni/check/auditor_spec.rb +118 -33
- data/spec/arachni/element/capabilities/analyzable/signature_spec.rb +46 -3
- data/spec/arachni/element/cookie/dom_spec.rb +1 -1
- data/spec/arachni/element/cookie_spec.rb +158 -63
- data/spec/arachni/element/form/dom_spec.rb +1 -1
- data/spec/arachni/element/form_spec.rb +101 -54
- data/spec/arachni/element/header_spec.rb +3 -1
- data/spec/arachni/element/json_spec.rb +2 -0
- data/spec/arachni/element/link/dom_spec.rb +2 -2
- data/spec/arachni/element/link_spec.rb +46 -15
- data/spec/arachni/element/link_template/dom_spec.rb +1 -1
- data/spec/arachni/element/link_template_spec.rb +36 -12
- data/spec/arachni/element/server_spec.rb +22 -5
- data/spec/arachni/element/ui_form/dom_spec.rb +1 -1
- data/spec/arachni/element/ui_input/dom_spec.rb +1 -1
- data/spec/arachni/element/xml_spec.rb +5 -3
- data/spec/arachni/framework/parts/audit_spec.rb +2 -14
- data/spec/arachni/framework/parts/data_spec.rb +0 -6
- data/spec/arachni/http/client/dynamic_404_handlers_spec.rb +126 -0
- data/spec/arachni/http/client_spec.rb +82 -10
- data/spec/arachni/http/headers_spec.rb +59 -12
- data/spec/arachni/http/proxy_server_spec.rb +56 -25
- data/spec/arachni/http/request_spec.rb +379 -33
- data/spec/arachni/http/response_spec.rb +135 -7
- data/spec/arachni/issue_spec.rb +20 -1
- data/spec/arachni/option_groups/http_spec.rb +15 -0
- data/spec/arachni/option_groups/scope_spec.rb +26 -1
- data/spec/arachni/options_spec.rb +8 -1
- data/spec/arachni/page/dom_spec.rb +20 -6
- data/spec/arachni/page_spec.rb +5 -5
- data/spec/arachni/parser/document_spec.rb +49 -0
- data/spec/arachni/parser/nodes/comment_spec.rb +24 -0
- data/spec/arachni/parser/nodes/element/with_attributes/attributes_spec.rb +40 -0
- data/spec/arachni/parser/nodes/element/with_attributes_spec.rb +50 -0
- data/spec/arachni/parser/nodes/element_spec.rb +18 -0
- data/spec/arachni/parser/nodes/text_spec.rb +24 -0
- data/spec/arachni/parser/sax_spec.rb +88 -0
- data/spec/arachni/parser/with_children/search_spec.rb +146 -0
- data/spec/arachni/parser/with_children_spec.rb +37 -0
- data/spec/arachni/parser_spec.rb +166 -26
- data/spec/arachni/report_spec.rb +9 -2
- data/spec/arachni/rest/server_spec.rb +52 -6
- data/spec/arachni/rpc/server/active_options_spec.rb +1 -1
- data/spec/arachni/rpc/server/framework/distributor_spec.rb +6 -6
- data/spec/arachni/ruby/string_spec.rb +6 -0
- data/spec/arachni/session_spec.rb +69 -8
- data/spec/arachni/support/signature_spec.rb +58 -0
- data/spec/arachni/trainer_spec.rb +102 -21
- data/spec/arachni/uri_spec.rb +11 -8
- data/spec/arachni/utilities_spec.rb +3 -3
- data/spec/components/checks/active/csrf_spec.rb +1 -21
- data/spec/components/checks/active/path_traversal_spec.rb +12 -12
- data/spec/components/checks/active/sql_injection_spec.rb +10 -1
- data/spec/components/checks/active/unvalidated_redirect_spec.rb +6 -6
- data/spec/components/checks/active/xss_dom_script_context_spec.rb +1 -5
- data/spec/components/checks/active/xss_dom_spec.rb +2 -2
- data/spec/components/checks/active/xss_event_spec.rb +8 -2
- data/spec/components/checks/active/xss_script_context_spec.rb +5 -5
- data/spec/components/checks/active/xss_spec.rb +3 -3
- data/spec/components/checks/passive/backup_directories_spec.rb +3 -1
- data/spec/components/checks/passive/backup_files_spec.rb +8 -1
- data/spec/components/checks/passive/grep/insecure_cookies_spec.rb +2 -2
- data/spec/components/path_extractors/comments_spec.rb +3 -1
- data/spec/components/path_extractors/data_url_spec.rb +6 -2
- data/spec/components/path_extractors/links_spec.rb +1 -1
- data/spec/components/plugins/autologin_spec.rb +2 -2
- data/spec/components/plugins/webhook_notify_spec.rb +69 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/support/factories/page/dom.rb +6 -0
- data/spec/support/factories/scan_report.rb +1 -0
- data/spec/support/factories/vector.rb +7 -3
- 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/cookies.txt +2 -2
- 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/browser_cluster/jobs/taint_tracer.rb +0 -3
- 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/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 +4 -2
- data/spec/support/logs/Dispatcher - 1024-31864.log +10 -0
- data/spec/support/logs/Dispatcher - 1047-41465.log +10 -0
- data/spec/support/logs/Dispatcher - 1274-60799.log +64 -0
- data/spec/support/logs/Dispatcher - 1295-1058.log +44 -0
- data/spec/support/logs/Dispatcher - 1313-27076.log +40 -0
- data/spec/support/logs/Dispatcher - 1332-17127.log +35 -0
- data/spec/support/logs/Dispatcher - 1350-7351.log +29 -0
- data/spec/support/logs/Dispatcher - 1368-38528.log +22 -0
- data/spec/support/logs/Dispatcher - 1386-17419.log +14 -0
- data/spec/support/logs/Dispatcher - 31030-26156.log +10 -0
- data/spec/support/logs/Dispatcher - 321-27189.log +12 -0
- data/spec/support/logs/Dispatcher - 32353-50061.log +20 -0
- data/spec/support/logs/Dispatcher - 32450-61574.log +10 -0
- data/spec/support/logs/Dispatcher - 32470-53874.log +20 -0
- data/spec/support/logs/Dispatcher - 32491-10523.log +18 -0
- data/spec/support/logs/Dispatcher - 32509-8583.log +14 -0
- data/spec/support/logs/Dispatcher - 32536-21209.log +10 -0
- data/spec/support/logs/Dispatcher - 32556-53881.log +10 -0
- data/spec/support/logs/Dispatcher - 32579-49083.log +50 -0
- data/spec/support/logs/Dispatcher - 32761-20025.log +12 -0
- data/spec/support/logs/Dispatcher - 347-17512.log +12 -0
- data/spec/support/logs/Dispatcher - 3489-43230.log +24 -0
- data/spec/support/logs/Dispatcher - 3524-57459.log +26 -0
- data/spec/support/logs/Dispatcher - 3559-21544.log +20 -0
- data/spec/support/logs/Dispatcher - 3764-33844.log +25 -0
- data/spec/support/logs/Dispatcher - 3798-45350.log +26 -0
- data/spec/support/logs/Dispatcher - 382-15725.log +12 -0
- data/spec/support/logs/Dispatcher - 3836-6205.log +21 -0
- data/spec/support/logs/Dispatcher - 4112-45433.log +22 -0
- data/spec/support/logs/Dispatcher - 4148-53510.log +26 -0
- data/spec/support/logs/Dispatcher - 415-29873.log +14 -0
- data/spec/support/logs/Dispatcher - 4185-29736.log +18 -0
- data/spec/support/logs/Dispatcher - 4268-60912.log +25 -0
- data/spec/support/logs/Dispatcher - 4303-39372.log +26 -0
- data/spec/support/logs/Dispatcher - 4342-42190.log +21 -0
- data/spec/support/logs/Dispatcher - 463-55220.log +26 -0
- data/spec/support/logs/Dispatcher - 4649-12104.log +22 -0
- data/spec/support/logs/Dispatcher - 4683-32355.log +26 -0
- data/spec/support/logs/Dispatcher - 4724-41636.log +18 -0
- data/spec/support/logs/Dispatcher - 4881-57692.log +22 -0
- data/spec/support/logs/Dispatcher - 4961-64665.log +26 -0
- data/spec/support/logs/Dispatcher - 502-8742.log +25 -0
- data/spec/support/logs/Dispatcher - 5052-61726.log +18 -0
- data/spec/support/logs/Dispatcher - 536-15972.log +22 -0
- data/spec/support/logs/Dispatcher - 620-2220.log +20 -0
- data/spec/support/logs/Dispatcher - 638-17826.log +18 -0
- data/spec/support/logs/Dispatcher - 656-23967.log +16 -0
- data/spec/support/logs/Dispatcher - 700-15701.log +12 -0
- data/spec/support/logs/Dispatcher - 726-6080.log +10 -0
- data/spec/support/logs/Dispatcher - 749-56590.log +18 -0
- data/spec/support/logs/Dispatcher - 807-19073.log +18 -0
- data/spec/support/logs/Dispatcher - 871-8764.log +10 -0
- data/spec/support/logs/Dispatcher - 898-21496.log +12 -0
- data/spec/support/logs/Dispatcher - 933-64070.log +12 -0
- data/spec/support/logs/Instance - 1577-32284.error.log +151 -0
- data/spec/support/logs/Instance - 1625-58174.error.log +154 -0
- data/spec/support/logs/Instance - 2727-57968.error.log +151 -0
- data/spec/support/logs/Instance - 2898-20648.error.log +303 -0
- data/spec/support/logs/Instance - 2901-30845.error.log +429 -0
- data/spec/support/logs/Instance - 31185-37600.error.log +174 -0
- data/spec/support/logs/Instance - 3319-20111.error.log +175 -0
- data/spec/support/logs/error-3855.log +5132 -0
- data/spec/support/servers/arachni/browser.rb +275 -4
- data/spec/support/servers/arachni/browser/javascript/dom_monitor.rb +48 -0
- data/spec/support/servers/arachni/browser/javascript/taint_tracer.rb +15 -3
- data/spec/support/servers/arachni/check/auditor.rb +8 -0
- data/spec/support/servers/arachni/element/cookie.rb +34 -0
- data/spec/support/servers/arachni/element/form.rb +34 -0
- data/spec/support/servers/arachni/element/header.rb +36 -1
- data/spec/support/servers/arachni/element/json.rb +33 -0
- data/spec/support/servers/arachni/element/link.rb +33 -1
- data/spec/support/servers/arachni/element/link_template.rb +37 -5
- data/spec/support/servers/arachni/element/xml.rb +33 -0
- data/spec/support/servers/arachni/http/client.rb +43 -4
- data/spec/support/servers/arachni/http/client/dynamic_404_handler.rb +36 -0
- data/spec/support/servers/arachni/http/client/dynamic_404_handler_redirect_1.rb +18 -0
- data/spec/support/servers/arachni/http/client/dynamic_404_handler_redirect_2.rb +11 -0
- data/spec/support/servers/arachni/http/proxy_server.rb +12 -0
- data/spec/support/servers/arachni/session.rb +24 -1
- data/spec/support/servers/checks/active/csrf.rb +0 -76
- data/spec/support/servers/checks/active/sql_injection/java +2 -0
- data/spec/support/servers/checks/active/unvalidated_redirect.rb +81 -0
- data/spec/support/servers/checks/active/xss_event.rb +1 -1
- data/spec/support/servers/checks/passive/backup_files.rb +20 -1
- data/spec/support/servers/checks/passive/grep/cookie_set_for_parent_domain.rb +3 -5
- data/spec/support/servers/checks/passive/grep/insecure_cookies_https.rb +9 -0
- data/spec/support/servers/plugins/autologin.rb +17 -1
- data/spec/support/servers/plugins/webhook_notify.rb +9 -0
- data/spec/support/shared/element/capabilities/auditable.rb +26 -32
- data/spec/support/shared/element/capabilities/auditable/buffered.rb +791 -0
- data/spec/support/shared/element/capabilities/auditable/line_buffered.rb +797 -0
- data/spec/support/shared/element/capabilities/inputtable.rb +26 -0
- data/spec/support/shared/element/capabilities/with_node.rb +2 -2
- data/spec/support/shared/element/dom/submittable.rb +10 -10
- data/spec/support/shared/path_extractor.rb +17 -5
- data/ui/cli/framework.rb +24 -4
- data/ui/cli/framework/option_parser.rb +35 -6
- data/ui/cli/option_parser.rb +1 -1
- data/ui/cli/output.rb +10 -3
- data/ui/cli/reporter.rb +1 -1
- data/ui/cli/reporter/option_parser.rb +1 -1
- data/ui/cli/reproduce.rb +228 -0
- data/ui/cli/reproduce/option_parser.rb +90 -0
- data/ui/cli/rest/server.rb +1 -1
- data/ui/cli/rest/server/option_parser.rb +1 -1
- 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 +9 -11
- 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 +253 -49
- data/ACKNOWLEDGMENTS.md +0 -21
- data/AUTHORS.md +0 -3
- data/CONTRIBUTORS.md +0 -22
@@ -398,13 +398,14 @@ describe Arachni::HTTP::Client do
|
|
398
398
|
|
399
399
|
context "when #{Arachni::OptionGroups::HTTP}#cookie_string is set" do
|
400
400
|
it 'parses the string and add those cookies to the CookieJar' do
|
401
|
-
@opts.http.cookie_string = 'my_cookie_name=val1;blah_name=val2
|
401
|
+
@opts.http.cookie_string = 'my_cookie_name=val1;path=/my/path,blah_name=val2, stuff=%25blah, another_name=another_val'
|
402
402
|
expect(subject.cookie_jar.cookies).to be_empty
|
403
403
|
subject.reset
|
404
404
|
cookies = subject.cookie_jar.cookies
|
405
405
|
expect(cookies.size).to eq(4)
|
406
406
|
expect(cookies.first.name).to eq('my_cookie_name')
|
407
407
|
expect(cookies.first.value).to eq('val1')
|
408
|
+
expect(cookies.first.path).to eq('/my/path')
|
408
409
|
expect(cookies[1].name).to eq('blah_name')
|
409
410
|
expect(cookies[1].value).to eq('val2')
|
410
411
|
expect(cookies[2].name).to eq('stuff')
|
@@ -417,7 +418,7 @@ describe Arachni::HTTP::Client do
|
|
417
418
|
|
418
419
|
describe '#cookies' do
|
419
420
|
it 'returns the current cookies' do
|
420
|
-
@opts.http.cookie_string = 'my_cookie_name=val1
|
421
|
+
@opts.http.cookie_string = 'my_cookie_name=val1,blah_name=val2, another_name=another_val'
|
421
422
|
expect(subject.cookie_jar.cookies).to be_empty
|
422
423
|
subject.reset
|
423
424
|
expect(subject.cookies.size).to eq(3)
|
@@ -614,7 +615,8 @@ describe Arachni::HTTP::Client do
|
|
614
615
|
"GET / HTTP/1.1\r\nHost: #{host}\r\nAccept-Encoding: gzip, " +
|
615
616
|
"deflate\r\nUser-Agent: Arachni/v#{Arachni::VERSION}\r\nAccept: text/html," +
|
616
617
|
"application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" +
|
617
|
-
"Accept-Language: en-US,en;q=0.8,he;q=0.6\r\n
|
618
|
+
"Accept-Language: en-US,en;q=0.8,he;q=0.6\r\n" +
|
619
|
+
"X-Arachni-Scan-Seed: #{Arachni::Utilities.random_seed}\r\n\r\n"
|
618
620
|
)
|
619
621
|
end
|
620
622
|
|
@@ -629,6 +631,73 @@ describe Arachni::HTTP::Client do
|
|
629
631
|
).request.effective_body).to eq("1=%202&%203=4")
|
630
632
|
end
|
631
633
|
|
634
|
+
describe ':on_headers' do
|
635
|
+
it 'gets called when headers are available' do
|
636
|
+
h = nil
|
637
|
+
|
638
|
+
subject.request(
|
639
|
+
"#{@url}/fast_stream",
|
640
|
+
mode: :sync,
|
641
|
+
on_headers: proc do |response|
|
642
|
+
h = response.to_h
|
643
|
+
end
|
644
|
+
)
|
645
|
+
|
646
|
+
expect(h[:code]).to eq 200
|
647
|
+
expect(h[:body]).to eq ''
|
648
|
+
expect(h[:headers]).to be_any
|
649
|
+
end
|
650
|
+
end
|
651
|
+
|
652
|
+
describe ':on_body' do
|
653
|
+
it 'gets called with body chunks' do
|
654
|
+
chunks = []
|
655
|
+
|
656
|
+
subject.request(
|
657
|
+
"#{@url}/fast_stream",
|
658
|
+
mode: :sync,
|
659
|
+
on_body: proc do |chunk|
|
660
|
+
chunks << chunk
|
661
|
+
end
|
662
|
+
)
|
663
|
+
|
664
|
+
expect(chunks.size).to be == 5
|
665
|
+
end
|
666
|
+
end
|
667
|
+
|
668
|
+
describe ':on_body_line' do
|
669
|
+
it 'gets called with body lines' do
|
670
|
+
lines = []
|
671
|
+
|
672
|
+
subject.request(
|
673
|
+
"#{@url}/fast_stream",
|
674
|
+
mode: :sync,
|
675
|
+
on_body_line: proc do |line|
|
676
|
+
lines << line
|
677
|
+
end
|
678
|
+
)
|
679
|
+
|
680
|
+
expect(lines.size).to be == 5
|
681
|
+
end
|
682
|
+
end
|
683
|
+
|
684
|
+
describe ':on_body_lines' do
|
685
|
+
it 'gets called with chunks of body lines' do
|
686
|
+
lines = []
|
687
|
+
|
688
|
+
subject.request(
|
689
|
+
"#{@url}/lines/non-stream",
|
690
|
+
mode: :sync,
|
691
|
+
on_body_lines: proc do |line|
|
692
|
+
lines << line
|
693
|
+
end
|
694
|
+
)
|
695
|
+
|
696
|
+
expect(lines.size).to be > 1
|
697
|
+
expect(lines.size).to be < 500
|
698
|
+
end
|
699
|
+
end
|
700
|
+
|
632
701
|
describe ':fingerprint' do
|
633
702
|
before do
|
634
703
|
Arachni::Platform::Manager.clear
|
@@ -820,7 +889,7 @@ describe Arachni::HTTP::Client do
|
|
820
889
|
end
|
821
890
|
context 'false' do
|
822
891
|
it 'uses the raw data from the cookie jar' do
|
823
|
-
@opts.http.cookie_string = 'my_cookie_name="val1"
|
892
|
+
@opts.http.cookie_string = 'my_cookie_name="val1","blah_name"=val2,another_name=another_val'
|
824
893
|
expect(subject.cookie_jar.cookies).to be_empty
|
825
894
|
subject.reset
|
826
895
|
|
@@ -836,7 +905,7 @@ describe Arachni::HTTP::Client do
|
|
836
905
|
end
|
837
906
|
context 'when custom cookies are provided' do
|
838
907
|
it 'merges them with the cookie_jar and override it' do
|
839
|
-
@opts.http.cookie_string = 'my_cookie_name=val1
|
908
|
+
@opts.http.cookie_string = 'my_cookie_name=val1,blah_name=val2,another_name=another_val'
|
840
909
|
expect(subject.cookie_jar.cookies).to be_empty
|
841
910
|
subject.reset
|
842
911
|
|
@@ -857,7 +926,7 @@ describe Arachni::HTTP::Client do
|
|
857
926
|
end
|
858
927
|
context 'nil' do
|
859
928
|
it 'defaults to false' do
|
860
|
-
@opts.http.cookie_string = 'my_cookie_name="val1"
|
929
|
+
@opts.http.cookie_string = 'my_cookie_name="val1","blah_name"=val2,another_name=another_val'
|
861
930
|
expect(subject.cookie_jar.cookies).to be_empty
|
862
931
|
subject.reset
|
863
932
|
|
@@ -1039,7 +1108,7 @@ describe Arachni::HTTP::Client do
|
|
1039
1108
|
|
1040
1109
|
describe 'nil' do
|
1041
1110
|
it 'uses te cookies in the CookieJar' do
|
1042
|
-
@opts.http.cookie_string = 'my_cookie_name=val1
|
1111
|
+
@opts.http.cookie_string = 'my_cookie_name=val1,blah_name=val2,another_name=another_val'
|
1043
1112
|
expect(subject.cookie_jar.cookies).to be_empty
|
1044
1113
|
subject.reset
|
1045
1114
|
|
@@ -1082,7 +1151,7 @@ describe Arachni::HTTP::Client do
|
|
1082
1151
|
end
|
1083
1152
|
|
1084
1153
|
it 'merges them with the cookie-jar' do
|
1085
|
-
@opts.http.cookie_string = 'my_cookie_name=val1
|
1154
|
+
@opts.http.cookie_string = 'my_cookie_name=val1,blah_name=val2,another_name=another_val'
|
1086
1155
|
expect(subject.cookie_jar.cookies).to be_empty
|
1087
1156
|
subject.reset
|
1088
1157
|
|
@@ -1223,10 +1292,13 @@ describe Arachni::HTTP::Client do
|
|
1223
1292
|
value: 'val2',
|
1224
1293
|
domain: Arachni::URI( @url ).domain
|
1225
1294
|
)
|
1295
|
+
|
1226
1296
|
subject.update_cookies( cookies )
|
1227
1297
|
subject.request( @url + '/update_cookies', update_cookies: true )
|
1228
1298
|
subject.run
|
1229
|
-
|
1299
|
+
|
1300
|
+
cookie = subject.cookies.find { |c| c.value == 'val2 [UPDATED!]'}
|
1301
|
+
expect(cookie).to be_truthy
|
1230
1302
|
end
|
1231
1303
|
end
|
1232
1304
|
end
|
@@ -1263,7 +1335,7 @@ describe Arachni::HTTP::Client do
|
|
1263
1335
|
|
1264
1336
|
context 'when cookie-jar lookup fails' do
|
1265
1337
|
it 'only uses the given cookies' do
|
1266
|
-
@opts.http.cookie_string = 'my_cookie_name=val1
|
1338
|
+
@opts.http.cookie_string = 'my_cookie_name=val1,blah_name=val2,another_name=another_val'
|
1267
1339
|
expect(subject.cookie_jar.cookies).to be_empty
|
1268
1340
|
subject.reset
|
1269
1341
|
expect(subject.cookie_jar.cookies).to be_any
|
@@ -2,20 +2,60 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Arachni::HTTP::Headers do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
subject do
|
6
|
+
described_class.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#merge!' do
|
10
|
+
context 'by default' do
|
11
|
+
context 'when it includes multiple same names that differ in case' do
|
12
|
+
let(:cookies) do
|
13
|
+
{
|
14
|
+
'set-cookie' => 'mycookie1=myvalue1',
|
15
|
+
'Set-Cookie' => 'mycookie2=myvalue2',
|
16
|
+
'SET-COOKIE' => 'mycookie3=myvalue3'
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'merges them into an array' do
|
21
|
+
subject.merge!( cookies )
|
22
|
+
expect(subject['set-cookie']).to eq(cookies.values)
|
23
|
+
end
|
24
|
+
end
|
8
25
|
end
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
26
|
+
|
27
|
+
context 'when convert to array is false' do
|
28
|
+
context 'when it includes multiple same names that differ in case' do
|
29
|
+
let(:cookies) do
|
30
|
+
{
|
31
|
+
'set-cookie' => 'mycookie1=myvalue1',
|
32
|
+
'Set-Cookie' => 'mycookie2=myvalue2',
|
33
|
+
'SET-COOKIE' => 'mycookie3=myvalue3'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'does not merge them into an array' do
|
38
|
+
subject.merge!( cookies, false )
|
39
|
+
expect(subject['set-cookie']).to eq(cookies.values.last)
|
40
|
+
end
|
41
|
+
end
|
15
42
|
end
|
16
43
|
|
17
|
-
|
18
|
-
|
44
|
+
context 'when convert to array is true' do
|
45
|
+
context 'when it includes multiple same names that differ in case' do
|
46
|
+
let(:cookies) do
|
47
|
+
{
|
48
|
+
'set-cookie' => 'mycookie1=myvalue1',
|
49
|
+
'Set-Cookie' => 'mycookie2=myvalue2',
|
50
|
+
'SET-COOKIE' => 'mycookie3=myvalue3'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'does not merge them into an array' do
|
55
|
+
subject.merge!( cookies )
|
56
|
+
expect(subject['set-cookie']).to eq(cookies.values)
|
57
|
+
end
|
58
|
+
end
|
19
59
|
end
|
20
60
|
end
|
21
61
|
|
@@ -106,7 +146,7 @@ describe Arachni::HTTP::Headers do
|
|
106
146
|
end
|
107
147
|
|
108
148
|
describe '#location' do
|
109
|
-
it 'returns the
|
149
|
+
it 'returns the Location' do
|
110
150
|
ct = 'http://test.com'
|
111
151
|
h = { 'location' => ct }
|
112
152
|
expect(described_class.new( h ).location).to eq(ct)
|
@@ -125,5 +165,12 @@ describe Arachni::HTTP::Headers do
|
|
125
165
|
h = { 'Content-Type' => ct }
|
126
166
|
expect(described_class.new( h ).content_type).to eq(ct)
|
127
167
|
end
|
168
|
+
|
169
|
+
context 'when there are multiple content-types' do
|
170
|
+
it 'returns the first one' do
|
171
|
+
h = { 'Content-Type' => ["application/x-javascript", "text/javascript"] }
|
172
|
+
expect(described_class.new( h ).content_type).to eq("application/x-javascript")
|
173
|
+
end
|
174
|
+
end
|
128
175
|
end
|
129
176
|
end
|
@@ -46,6 +46,8 @@ describe Arachni::HTTP::ProxyServer do
|
|
46
46
|
expect(response.body).to eq 'HTTPS GET'
|
47
47
|
end
|
48
48
|
|
49
|
+
it 'supports WebSockets'
|
50
|
+
|
49
51
|
it 'removes any size limits on the HTTP responses' do
|
50
52
|
Arachni::Options.http.response_max_size = 1
|
51
53
|
|
@@ -54,6 +56,35 @@ describe Arachni::HTTP::ProxyServer do
|
|
54
56
|
test_proxy( proxy )
|
55
57
|
end
|
56
58
|
|
59
|
+
context 'when the response is text-based' do
|
60
|
+
let(:url) { "#{@url}/text" }
|
61
|
+
|
62
|
+
it 'sets charset encoding to UTF8' do
|
63
|
+
proxy = described_class.new
|
64
|
+
proxy.start_async
|
65
|
+
|
66
|
+
expect(via_proxy( proxy, url ).headers['Content-Type']).to eq 'text/html; charset=utf-8'
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'transcodes to UTF-8' do
|
70
|
+
proxy = described_class.new
|
71
|
+
proxy.start_async
|
72
|
+
|
73
|
+
expect(via_proxy( proxy, url ).body.encoding.name).to eq 'UTF-8'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when the response is binary' do
|
78
|
+
let(:url) { "#{@url}/binary" }
|
79
|
+
|
80
|
+
it 'does not add a charset' do
|
81
|
+
proxy = described_class.new
|
82
|
+
proxy.start_async
|
83
|
+
|
84
|
+
expect(via_proxy( proxy, url ).headers['Content-Type']).to eq 'application/binary'
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
57
88
|
describe '#initialize' do
|
58
89
|
describe ':address' do
|
59
90
|
it 'sets the bind address' do
|
@@ -89,31 +120,31 @@ describe Arachni::HTTP::ProxyServer do
|
|
89
120
|
end
|
90
121
|
end
|
91
122
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
123
|
+
describe ':concurrency' do
|
124
|
+
it 'sets the HTTP request concurrency' do
|
125
|
+
sleep_url = @url + 'sleep'
|
126
|
+
|
127
|
+
proxy = described_class.new( concurrency: 2 )
|
128
|
+
proxy.start_async
|
129
|
+
time = Time.now
|
130
|
+
threads = []
|
131
|
+
2.times do
|
132
|
+
threads << Thread.new { via_proxy( proxy, sleep_url ) }
|
133
|
+
end
|
134
|
+
threads.each(&:join)
|
135
|
+
expect((Time.now - time).to_i).to eq(5)
|
136
|
+
|
137
|
+
proxy = described_class.new( concurrency: 1 )
|
138
|
+
proxy.start_async
|
139
|
+
time = Time.now
|
140
|
+
threads = []
|
141
|
+
2.times do
|
142
|
+
threads << Thread.new { via_proxy( proxy, sleep_url ) }
|
143
|
+
end
|
144
|
+
threads.each(&:join)
|
145
|
+
expect((Time.now - time).to_i).to eq(10)
|
146
|
+
end
|
147
|
+
end
|
117
148
|
|
118
149
|
describe ':request_handler' do
|
119
150
|
it 'sets a block to handle each HTTP request before the request is forwarded to the origin server' do
|
@@ -282,6 +282,44 @@ describe Arachni::HTTP::Request do
|
|
282
282
|
expect(called.first.request).to eq(request)
|
283
283
|
end
|
284
284
|
|
285
|
+
it 'calls #on_body callbacks' do
|
286
|
+
request = described_class.new( url: @url )
|
287
|
+
|
288
|
+
s = ''
|
289
|
+
request.on_body do |chunk|
|
290
|
+
s << chunk
|
291
|
+
end
|
292
|
+
|
293
|
+
response = request.run
|
294
|
+
|
295
|
+
expect(s).to eq 'GET'
|
296
|
+
end
|
297
|
+
|
298
|
+
it 'calls #on_headers callbacks' do
|
299
|
+
request = described_class.new( url: @url )
|
300
|
+
|
301
|
+
called = nil
|
302
|
+
request.on_headers do |r|
|
303
|
+
called = r
|
304
|
+
end
|
305
|
+
|
306
|
+
response = request.run
|
307
|
+
expect(response).to be_kind_of Arachni::HTTP::Response
|
308
|
+
expect(response.request).to eq(request)
|
309
|
+
|
310
|
+
h = response.to_h
|
311
|
+
h[:body] = ''
|
312
|
+
h.delete :time
|
313
|
+
h.delete :total_time
|
314
|
+
|
315
|
+
c = called.to_h
|
316
|
+
c.delete :time
|
317
|
+
c.delete :total_time
|
318
|
+
|
319
|
+
expect(c).to eq(h)
|
320
|
+
expect(called.request).to eq(request)
|
321
|
+
end
|
322
|
+
|
285
323
|
it "fills in #{Arachni::HTTP::Request}#headers_string" do
|
286
324
|
host = "#{Arachni::URI(@url).host}:#{Arachni::URI(@url).port}"
|
287
325
|
expect(described_class.new( url: @url ).run.request.headers_string).to eq(
|
@@ -332,18 +370,52 @@ describe Arachni::HTTP::Request do
|
|
332
370
|
end
|
333
371
|
end
|
334
372
|
|
373
|
+
describe '#buffered?' do
|
374
|
+
context 'when there are no callbacks' do
|
375
|
+
subject do
|
376
|
+
described_class.new( url: url )
|
377
|
+
end
|
378
|
+
|
379
|
+
expect_it { to_not be_buffered }
|
380
|
+
end
|
381
|
+
|
382
|
+
context 'when there are #on_body callbacks' do
|
383
|
+
subject do
|
384
|
+
described_class.new( url: url ).on_body {}
|
385
|
+
end
|
386
|
+
|
387
|
+
expect_it { to be_buffered }
|
388
|
+
end
|
389
|
+
|
390
|
+
context 'when there are #on_body_line callbacks' do
|
391
|
+
subject do
|
392
|
+
described_class.new( url: url ).on_body_line {}
|
393
|
+
end
|
394
|
+
|
395
|
+
expect_it { to be_buffered }
|
396
|
+
end
|
397
|
+
|
398
|
+
context 'when there are #on_body_lines callbacks' do
|
399
|
+
subject do
|
400
|
+
described_class.new( url: url ).on_body_lines {}
|
401
|
+
end
|
402
|
+
|
403
|
+
expect_it { to be_buffered }
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
335
407
|
describe '#on_complete' do
|
336
408
|
context 'when passed a block' do
|
337
409
|
it 'adds it as a callback to be passed the response' do
|
338
|
-
|
339
|
-
|
340
|
-
passed_response = nil
|
341
|
-
request.on_complete { |res| passed_response = res }
|
410
|
+
response = nil
|
342
411
|
|
343
|
-
|
344
|
-
request.
|
412
|
+
request = described_class.new( url: url )
|
413
|
+
request.on_complete { |r| response = r }
|
414
|
+
request.run
|
345
415
|
|
346
|
-
expect(
|
416
|
+
expect(response.code).to eq 200
|
417
|
+
expect(response.body).to eq 'GET'
|
418
|
+
expect(response.headers).to be_any
|
347
419
|
end
|
348
420
|
|
349
421
|
it 'can add multiple callbacks' do
|
@@ -354,55 +426,307 @@ describe Arachni::HTTP::Request do
|
|
354
426
|
2.times do
|
355
427
|
request.on_complete { |res| passed_responses << res }
|
356
428
|
end
|
357
|
-
|
358
|
-
response = Arachni::HTTP::Response.new( url: url )
|
359
|
-
request.handle_response( response )
|
429
|
+
request.run
|
360
430
|
|
361
431
|
expect(passed_responses.size).to eq(2)
|
362
|
-
|
363
|
-
|
432
|
+
|
433
|
+
passed_responses.each do |response|
|
434
|
+
expect(response.code).to eq 200
|
435
|
+
expect(response.body).to eq 'GET'
|
436
|
+
expect(response.headers).to be_any
|
437
|
+
end
|
438
|
+
end
|
439
|
+
|
440
|
+
context 'when an exception is raised' do
|
441
|
+
it 'does not affect other callbacks' do
|
442
|
+
response = nil
|
443
|
+
|
444
|
+
request = described_class.new( url: url )
|
445
|
+
request.on_complete { |r| fail }
|
446
|
+
request.on_complete { |r| response = r }
|
447
|
+
request.on_complete { |r| fail }
|
448
|
+
request.run
|
449
|
+
|
450
|
+
expect(response.code).to eq 200
|
451
|
+
expect(response.body).to eq 'GET'
|
452
|
+
expect(response.headers).to be_any
|
453
|
+
end
|
364
454
|
end
|
365
455
|
end
|
366
456
|
end
|
367
457
|
|
368
|
-
describe '#
|
369
|
-
|
370
|
-
|
458
|
+
describe '#on_headers' do
|
459
|
+
context 'when passed a block' do
|
460
|
+
it 'adds it as a callback to be passed the response with headers' do
|
461
|
+
request = described_class.new( url: "#{url}/stream" )
|
371
462
|
|
372
|
-
|
373
|
-
|
463
|
+
response_h = {}
|
464
|
+
request.on_headers do |response|
|
465
|
+
response_h = response.to_h
|
466
|
+
end
|
467
|
+
request.run
|
374
468
|
|
375
|
-
|
376
|
-
|
377
|
-
|
469
|
+
expect(response_h[:code]).to eq 200
|
470
|
+
expect(response_h[:body]).to eq ''
|
471
|
+
expect(response_h[:headers]).to be_any
|
472
|
+
end
|
378
473
|
|
379
|
-
|
474
|
+
context 'when the block returns :abort' do
|
475
|
+
it 'aborts the request' do
|
476
|
+
request = described_class.new( url: "#{url}/stream" )
|
477
|
+
|
478
|
+
request.on_headers do |response|
|
479
|
+
:abort
|
480
|
+
end
|
481
|
+
response = request.run
|
482
|
+
|
483
|
+
expect(response.time).to be < 2
|
484
|
+
end
|
485
|
+
end
|
486
|
+
|
487
|
+
context 'when an exception is raised' do
|
488
|
+
it 'does not affect other callbacks' do
|
489
|
+
response_h = nil
|
490
|
+
|
491
|
+
request = described_class.new( url: url )
|
492
|
+
request.on_headers { fail }
|
493
|
+
request.on_headers { |r| response_h = r.to_h }
|
494
|
+
request.on_headers { fail }
|
495
|
+
request.run
|
496
|
+
|
497
|
+
expect(response_h[:code]).to eq 200
|
498
|
+
expect(response_h[:body]).to eq ''
|
499
|
+
expect(response_h[:headers]).to be_any
|
500
|
+
end
|
501
|
+
end
|
380
502
|
end
|
381
503
|
end
|
382
504
|
|
505
|
+
describe '#on_body' do
|
506
|
+
context 'when passed a block' do
|
507
|
+
it 'adds it as a callback to be passed the each body chunk' do
|
508
|
+
request = described_class.new( url: "#{url}/lines" )
|
383
509
|
|
384
|
-
|
385
|
-
|
386
|
-
|
510
|
+
s = ''
|
511
|
+
500.times do |i|
|
512
|
+
s << "#{i}: test\n"
|
513
|
+
end
|
387
514
|
|
388
|
-
|
389
|
-
|
515
|
+
lines = ''
|
516
|
+
request.on_body do |line|
|
517
|
+
lines << line
|
518
|
+
end
|
519
|
+
request.run
|
390
520
|
|
391
|
-
|
392
|
-
|
521
|
+
expect(lines).to eq s
|
522
|
+
end
|
523
|
+
|
524
|
+
context 'when the block returns :abort' do
|
525
|
+
it 'aborts the request' do
|
526
|
+
request = described_class.new( url: "#{url}/lines" )
|
527
|
+
|
528
|
+
i = 0
|
529
|
+
request.on_body do
|
530
|
+
if i == 100
|
531
|
+
next :abort
|
532
|
+
end
|
533
|
+
|
534
|
+
i += 1
|
535
|
+
end
|
536
|
+
request.run
|
537
|
+
|
538
|
+
expect(i).to eq 100
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
context 'when an exception is raised' do
|
543
|
+
it 'does not affect other callbacks' do
|
544
|
+
response_h = nil
|
545
|
+
|
546
|
+
request = described_class.new( url: url )
|
547
|
+
request.on_body { fail }
|
548
|
+
request.on_body { |_, r| response_h = r.to_h }
|
549
|
+
request.on_body { fail }
|
550
|
+
request.run
|
551
|
+
|
552
|
+
expect(response_h[:code]).to eq 200
|
553
|
+
expect(response_h[:body]).to eq ''
|
554
|
+
expect(response_h[:headers]).to be_any
|
555
|
+
end
|
556
|
+
end
|
557
|
+
end
|
558
|
+
end
|
559
|
+
|
560
|
+
describe '#on_body_line' do
|
561
|
+
context 'when passed a block' do
|
562
|
+
it 'adds it as a callback to be passed the each body line' do
|
563
|
+
request = described_class.new( url: "#{url}/lines" )
|
564
|
+
|
565
|
+
s = ''
|
566
|
+
500.times do |i|
|
567
|
+
s << "#{i}: test\n"
|
568
|
+
end
|
569
|
+
|
570
|
+
lines = ''
|
571
|
+
request.on_body_line do |line|
|
572
|
+
lines << line
|
573
|
+
end
|
574
|
+
request.run
|
575
|
+
|
576
|
+
expect(lines).to eq s
|
577
|
+
end
|
578
|
+
|
579
|
+
context 'when the body does not end in EOL' do
|
580
|
+
it 'provides the last line via #on_complete' do
|
581
|
+
request = described_class.new( url: "#{url}/lines/incomplete" )
|
582
|
+
|
583
|
+
lines = ''
|
584
|
+
request.on_body_line do |line|
|
585
|
+
lines << line
|
586
|
+
end
|
587
|
+
|
588
|
+
last_line = ''
|
589
|
+
request.on_complete do |response|
|
590
|
+
last_line = response.body
|
591
|
+
end
|
592
|
+
request.run
|
593
|
+
|
594
|
+
expect(lines).to eq "Blah\n"
|
595
|
+
expect(last_line).to eq 'Hello!'
|
596
|
+
end
|
597
|
+
end
|
598
|
+
|
599
|
+
context 'when the block returns :abort' do
|
600
|
+
it 'aborts the request' do
|
601
|
+
request = described_class.new( url: "#{url}/lines" )
|
602
|
+
|
603
|
+
i = 0
|
604
|
+
request.on_body_line do
|
605
|
+
if i == 100
|
606
|
+
next :abort
|
607
|
+
end
|
393
608
|
|
394
|
-
|
609
|
+
i += 1
|
610
|
+
end
|
611
|
+
request.run
|
612
|
+
|
613
|
+
expect(i).to eq 100
|
614
|
+
end
|
615
|
+
end
|
616
|
+
|
617
|
+
context 'when an exception is raised' do
|
618
|
+
it 'does not affect other callbacks' do
|
619
|
+
response_h = nil
|
620
|
+
|
621
|
+
request = described_class.new( url: "#{url}/fast_stream" )
|
622
|
+
request.on_body_line { fail }
|
623
|
+
request.on_body_line { |_, r| response_h = r.to_h }
|
624
|
+
request.on_body_line { fail }
|
625
|
+
request.run
|
626
|
+
|
627
|
+
expect(response_h[:code]).to eq 200
|
628
|
+
expect(response_h[:body]).to eq ''
|
629
|
+
expect(response_h[:headers]).to be_any
|
630
|
+
end
|
631
|
+
end
|
395
632
|
end
|
633
|
+
end
|
396
634
|
|
397
|
-
|
398
|
-
|
635
|
+
describe '#on_body_lines' do
|
636
|
+
context 'when passed a block' do
|
637
|
+
it 'adds it as a callback to be passed chunks of body lines' do
|
638
|
+
request = described_class.new( url: "#{url}/lines/non-stream" )
|
639
|
+
|
640
|
+
s = ''
|
641
|
+
# 1_575 is the magic number where packets are split but set it
|
642
|
+
# to 2_000 for good measure.
|
643
|
+
2_000.times do |i|
|
644
|
+
s << "#{i}: test\n"
|
645
|
+
end
|
646
|
+
|
647
|
+
lines = []
|
648
|
+
request.on_body_lines do |line|
|
649
|
+
lines << line
|
650
|
+
end
|
651
|
+
request.run
|
652
|
+
|
653
|
+
expect(lines.join).to eq s
|
654
|
+
expect(lines.size).to be > 1
|
655
|
+
expect(lines.size).to be < 500
|
656
|
+
|
657
|
+
lines.each do |line|
|
658
|
+
expect(line).to end_with"\n"
|
659
|
+
end
|
660
|
+
end
|
661
|
+
|
662
|
+
context 'when the body does not end in EOL' do
|
663
|
+
it 'provides the last line via #on_complete' do
|
664
|
+
request = described_class.new( url: "#{url}/lines/incomplete" )
|
665
|
+
|
666
|
+
lines = ''
|
667
|
+
request.on_body_lines do |line|
|
668
|
+
lines << line
|
669
|
+
end
|
670
|
+
|
671
|
+
last_line = ''
|
672
|
+
request.on_complete do |response|
|
673
|
+
last_line = response.body
|
674
|
+
end
|
675
|
+
request.run
|
676
|
+
|
677
|
+
expect(lines).to eq "Blah\n"
|
678
|
+
expect(last_line).to eq 'Hello!'
|
679
|
+
end
|
680
|
+
end
|
681
|
+
|
682
|
+
context 'when the block returns :abort' do
|
683
|
+
it 'aborts the request' do
|
684
|
+
request = described_class.new( url: "#{url}/lines" )
|
685
|
+
|
686
|
+
i = 0
|
687
|
+
request.on_body_lines do
|
688
|
+
if i == 100
|
689
|
+
next :abort
|
690
|
+
end
|
691
|
+
|
692
|
+
i += 1
|
693
|
+
end
|
694
|
+
request.run
|
695
|
+
|
696
|
+
expect(i).to eq 100
|
697
|
+
end
|
698
|
+
end
|
699
|
+
|
700
|
+
context 'when an exception is raised' do
|
701
|
+
it 'does not affect other callbacks' do
|
702
|
+
response_h = nil
|
703
|
+
|
704
|
+
request = described_class.new( url: "#{url}/fast_stream" )
|
705
|
+
request.on_body_lines { fail }
|
706
|
+
request.on_body_lines { |_, r| response_h = r.to_h }
|
707
|
+
request.on_body_lines { fail }
|
708
|
+
request.run
|
709
|
+
|
710
|
+
expect(response_h[:code]).to eq 200
|
711
|
+
expect(response_h[:body]).to eq ''
|
712
|
+
expect(response_h[:headers]).to be_any
|
713
|
+
end
|
714
|
+
end
|
715
|
+
end
|
716
|
+
end
|
717
|
+
|
718
|
+
describe '#clear_callbacks' do
|
719
|
+
it 'clears #on_complete callbacks' do
|
399
720
|
request = described_class.new( url: url )
|
400
721
|
|
401
722
|
passed_response = nil
|
402
723
|
request.on_complete { |res| passed_response = res }
|
403
|
-
request.handle_response( response )
|
404
724
|
|
405
|
-
|
725
|
+
response = Arachni::HTTP::Response.new( url: url )
|
726
|
+
request.clear_callbacks
|
727
|
+
request.run
|
728
|
+
|
729
|
+
expect(passed_response).to be_nil
|
406
730
|
end
|
407
731
|
end
|
408
732
|
|
@@ -676,6 +1000,28 @@ describe Arachni::HTTP::Request do
|
|
676
1000
|
end
|
677
1001
|
end
|
678
1002
|
|
1003
|
+
context "#{Arachni::OptionGroups::HTTP}#authentication_type" do
|
1004
|
+
before :each do
|
1005
|
+
Arachni::Options.http.authentication_username = 'name'
|
1006
|
+
Arachni::Options.http.authentication_password = 'secret'
|
1007
|
+
Arachni::Options.http.authentication_type = 'ntlm'
|
1008
|
+
end
|
1009
|
+
|
1010
|
+
let(:request) do
|
1011
|
+
described_class.new( url: url )
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
it 'forwards it' do
|
1015
|
+
expect(subject.options[:httpauth]).to eq(:ntlm)
|
1016
|
+
end
|
1017
|
+
|
1018
|
+
it 'defaults to :auto' do
|
1019
|
+
Arachni::Options.http.authentication_type = nil
|
1020
|
+
|
1021
|
+
expect(subject.options[:httpauth]).to eq(:auto)
|
1022
|
+
end
|
1023
|
+
end
|
1024
|
+
|
679
1025
|
context "#{Arachni::OptionGroups::HTTP}#response_max_size" do
|
680
1026
|
before :each do
|
681
1027
|
Arachni::Options.http.response_max_size = 10
|