arachni 1.2.1 → 1.3
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 +66 -0
- data/Gemfile +1 -1
- data/README.md +16 -5
- data/components/checks/active/ldap_injection/errors.txt +1 -0
- data/components/checks/active/source_code_disclosure.rb +1 -1
- data/components/checks/active/unvalidated_redirect.rb +6 -6
- data/components/checks/active/unvalidated_redirect_dom.rb +10 -7
- data/components/checks/passive/grep/captcha.rb +14 -5
- data/components/checks/passive/grep/form_upload.rb +7 -3
- data/components/checks/passive/grep/hsts.rb +3 -3
- data/components/checks/passive/grep/html_objects.rb +2 -3
- data/components/checks/passive/grep/http_only_cookies.rb +2 -3
- data/components/checks/passive/grep/insecure_cookies.rb +1 -1
- data/components/checks/passive/grep/password_autocomplete.rb +2 -2
- data/components/checks/passive/grep/unencrypted_password_forms.rb +7 -7
- data/components/checks/passive/grep/x_frame_options.rb +2 -2
- data/components/checks/passive/http_put.rb +2 -3
- data/components/path_extractors/comments.rb +3 -3
- data/components/path_extractors/scripts.rb +10 -1
- data/components/plugins/defaults/autothrottle.rb +27 -18
- data/components/plugins/defaults/meta/remedies/discovery.rb +30 -33
- data/components/plugins/defaults/meta/remedies/timing_attacks.rb +7 -11
- data/components/plugins/login_script.rb +9 -3
- data/components/plugins/proxy.rb +4 -3
- data/components/reporters/html.rb +11 -14
- data/components/reporters/html/default/issue.erb +13 -38
- data/components/reporters/html/default/issue/info.erb +1 -1
- data/components/reporters/html/default/summary/issues/by_name.erb +3 -3
- data/components/reporters/stdout.rb +62 -71
- data/components/reporters/xml.rb +26 -40
- data/components/reporters/xml/schema.xsd +43 -89
- data/lib/arachni/browser.rb +52 -3
- data/lib/arachni/browser/javascript.rb +3 -3
- data/lib/arachni/browser/javascript/scripts/taint_tracer.js +46 -25
- data/lib/arachni/browser_cluster.rb +61 -0
- data/lib/arachni/browser_cluster/job.rb +21 -1
- data/lib/arachni/browser_cluster/jobs/browser_provider.rb +3 -1
- data/lib/arachni/browser_cluster/jobs/resource_exploration.rb +2 -1
- data/lib/arachni/browser_cluster/jobs/resource_exploration/event_trigger.rb +2 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace.rb +3 -2
- data/lib/arachni/browser_cluster/jobs/taint_trace/event_trigger.rb +1 -1
- data/lib/arachni/browser_cluster/worker.rb +5 -0
- data/lib/arachni/check/auditor.rb +22 -12
- data/lib/arachni/data/framework.rb +13 -1
- data/lib/arachni/data/issues.rb +9 -25
- data/lib/arachni/element/base.rb +9 -3
- data/lib/arachni/element/capabilities/analyzable.rb +2 -6
- data/lib/arachni/element/capabilities/analyzable/differential.rb +24 -7
- data/lib/arachni/element/capabilities/analyzable/{taint.rb → signature.rb} +23 -23
- data/lib/arachni/element/capabilities/auditable.rb +0 -6
- data/lib/arachni/element/capabilities/dom_only.rb +61 -0
- data/lib/arachni/element/capabilities/with_dom.rb +3 -1
- data/lib/arachni/element/cookie.rb +35 -5
- data/lib/arachni/element/cookie/dom.rb +13 -4
- data/lib/arachni/element/{capabilities/auditable/dom.rb → dom.rb} +20 -68
- data/lib/arachni/element/dom/capabilities/auditable.rb +29 -0
- data/lib/arachni/element/dom/capabilities/inputtable.rb +27 -0
- data/lib/arachni/element/dom/capabilities/mutable.rb +21 -0
- data/lib/arachni/element/dom/capabilities/submittable.rb +52 -0
- data/lib/arachni/element/form.rb +12 -1
- data/lib/arachni/element/form/capabilities/mutable.rb +2 -1
- data/lib/arachni/element/form/capabilities/with_dom.rb +0 -1
- data/lib/arachni/element/form/dom.rb +9 -3
- data/lib/arachni/element/header.rb +14 -33
- data/lib/arachni/element/header/capabilities/inputtable.rb +29 -0
- data/lib/arachni/element/header/capabilities/mutable.rb +51 -0
- data/lib/arachni/element/input/dom.rb +71 -0
- data/lib/arachni/element/json.rb +2 -0
- data/lib/arachni/element/link.rb +3 -0
- data/lib/arachni/element/link/capabilities/with_dom.rb +0 -1
- data/lib/arachni/element/link/dom.rb +16 -3
- data/lib/arachni/element/link/dom/capabilities/submittable.rb +29 -0
- data/lib/arachni/element/link_template.rb +3 -5
- data/lib/arachni/element/link_template/capabilities/inputtable.rb +5 -0
- data/lib/arachni/element/link_template/capabilities/with_dom.rb +0 -1
- data/lib/arachni/element/link_template/dom.rb +16 -3
- data/lib/arachni/element/link_template/dom/capabilities/submittable.rb +29 -0
- data/lib/arachni/element/server.rb +3 -5
- data/lib/arachni/element/ui_form.rb +106 -0
- data/lib/arachni/element/ui_form/dom.rb +107 -0
- data/lib/arachni/element/ui_input.rb +62 -0
- data/lib/arachni/element/xml.rb +2 -1
- data/lib/arachni/framework.rb +7 -5
- data/lib/arachni/framework/parts/audit.rb +0 -1
- data/lib/arachni/framework/parts/check.rb +1 -0
- data/lib/arachni/framework/parts/data.rb +4 -0
- data/lib/arachni/framework/parts/state.rb +0 -2
- data/lib/arachni/http/client.rb +17 -6
- data/lib/arachni/http/proxy_server.rb +52 -5
- data/lib/arachni/http/request.rb +1 -1
- data/lib/arachni/issue.rb +34 -179
- data/lib/arachni/issue/severity.rb +2 -0
- data/lib/arachni/option_groups/audit.rb +22 -2
- data/lib/arachni/option_groups/browser_cluster.rb +15 -0
- data/lib/arachni/page.rb +3 -2
- data/lib/arachni/parser.rb +24 -5
- data/lib/arachni/platform/manager.rb +1 -2
- data/lib/arachni/rpc/server/framework.rb +3 -4
- data/lib/arachni/rpc/server/framework/multi_instance.rb +2 -1
- data/lib/arachni/session.rb +1 -1
- data/lib/arachni/trainer.rb +4 -7
- data/lib/arachni/watir/element.rb +12 -1
- data/lib/version +1 -1
- data/spec/arachni/browser/element_locator_spec.rb +43 -43
- data/spec/arachni/browser/javascript/dom_monitor_spec.rb +44 -44
- data/spec/arachni/browser/javascript/proxy/stub_spec.rb +17 -14
- data/spec/arachni/browser/javascript/proxy_spec.rb +24 -24
- data/spec/arachni/browser/javascript/taint_tracer/frame/called_function_spec.rb +11 -11
- data/spec/arachni/browser/javascript/taint_tracer/frame_spec.rb +7 -7
- data/spec/arachni/browser/javascript/taint_tracer/sink/data_flow_spec.rb +13 -13
- data/spec/arachni/browser/javascript/taint_tracer/sink/execution_flow_spec.rb +7 -7
- data/spec/arachni/browser/javascript/taint_tracer_spec.rb +568 -558
- data/spec/arachni/browser/javascript_spec.rb +73 -63
- data/spec/arachni/browser_cluster/job/result_spec.rb +3 -3
- data/spec/arachni/browser_cluster/job_spec.rb +68 -48
- data/spec/arachni/browser_cluster/jobs/resource_exploration/event_trigger/result_spec.rb +2 -2
- data/spec/arachni/browser_cluster/jobs/resource_exploration/event_trigger_spec.rb +5 -4
- data/spec/arachni/browser_cluster/jobs/resource_exploration/result_spec.rb +2 -2
- data/spec/arachni/browser_cluster/jobs/resource_exploration_spec.rb +5 -5
- data/spec/arachni/browser_cluster/worker_spec.rb +87 -70
- data/spec/arachni/browser_cluster_spec.rb +64 -39
- data/spec/arachni/browser_spec.rb +692 -527
- data/spec/arachni/check/auditor_spec.rb +177 -147
- data/spec/arachni/check/base_spec.rb +33 -33
- data/spec/arachni/check/manager_spec.rb +15 -15
- data/spec/arachni/component/base_spec.rb +8 -8
- data/spec/arachni/component/manager_spec.rb +100 -99
- data/spec/arachni/component/options/address_spec.rb +3 -3
- data/spec/arachni/component/options/base_spec.rb +7 -7
- data/spec/arachni/component/options/bool_spec.rb +9 -9
- data/spec/arachni/component/options/float_spec.rb +6 -6
- data/spec/arachni/component/options/int_spec.rb +5 -5
- data/spec/arachni/component/options/multiple_choice_spec.rb +12 -12
- data/spec/arachni/component/options/object_spec.rb +2 -2
- data/spec/arachni/component/options/path_spec.rb +3 -3
- data/spec/arachni/component/options/port_spec.rb +5 -5
- data/spec/arachni/component/options/string_spec.rb +3 -3
- data/spec/arachni/component/options/url_spec.rb +4 -4
- data/spec/arachni/component/utilities_spec.rb +2 -2
- data/spec/arachni/data/framework/rpc_spec.rb +10 -9
- data/spec/arachni/data/framework_spec.rb +65 -46
- data/spec/arachni/data/issues_spec.rb +39 -77
- data/spec/arachni/data/plugins_spec.rb +11 -11
- data/spec/arachni/data/session_spec.rb +6 -6
- data/spec/arachni/data_spec.rb +8 -8
- data/spec/arachni/element/body_spec.rb +10 -10
- data/spec/arachni/element/capabilities/analyzable/differential_spec.rb +39 -21
- data/spec/arachni/element/capabilities/analyzable/{taint_spec.rb → signature_spec.rb} +63 -63
- data/spec/arachni/element/capabilities/analyzable/timeout_spec.rb +51 -51
- data/spec/arachni/element/capabilities/with_scope/scope_spec.rb +5 -5
- data/spec/arachni/element/cookie/dom_spec.rb +37 -18
- data/spec/arachni/element/cookie_spec.rb +206 -139
- data/spec/arachni/element/form/dom_spec.rb +36 -19
- data/spec/arachni/element/form_spec.rb +210 -187
- data/spec/arachni/element/generic_dom_spec.rb +14 -14
- data/spec/arachni/element/header_spec.rb +35 -17
- data/spec/arachni/element/json_spec.rb +53 -31
- data/spec/arachni/element/link/dom_spec.rb +46 -28
- data/spec/arachni/element/link_spec.rb +58 -40
- data/spec/arachni/element/link_template/dom_spec.rb +47 -29
- data/spec/arachni/element/link_template_spec.rb +79 -61
- data/spec/arachni/element/path_spec.rb +1 -1
- data/spec/arachni/element/server_spec.rb +33 -32
- data/spec/arachni/element/ui_form/ui_form_dom_spec.rb +164 -0
- data/spec/arachni/element/ui_form_spec.rb +242 -0
- data/spec/arachni/element/ui_input/dom_spec.rb +157 -0
- data/spec/arachni/element/ui_input_spec.rb +136 -0
- data/spec/arachni/element/xml_spec.rb +42 -24
- data/spec/arachni/element_filter_spec.rb +49 -48
- data/spec/arachni/error_spec.rb +3 -3
- data/spec/arachni/framework/parts/audit_spec.rb +64 -63
- data/spec/arachni/framework/parts/browser_spec.rb +16 -16
- data/spec/arachni/framework/parts/check_spec.rb +3 -3
- data/spec/arachni/framework/parts/data_spec.rb +48 -48
- data/spec/arachni/framework/parts/platform_spec.rb +3 -3
- data/spec/arachni/framework/parts/plugin_spec.rb +7 -6
- data/spec/arachni/framework/parts/report_spec.rb +7 -7
- data/spec/arachni/framework/parts/scope_spec.rb +16 -16
- data/spec/arachni/framework/parts/state_spec.rb +68 -69
- data/spec/arachni/framework_spec.rb +39 -31
- data/spec/arachni/http/client/dynamic_404_handlers_spec.rb +32 -32
- data/spec/arachni/http/client_spec.rb +219 -208
- data/spec/arachni/http/cookie_jar_spec.rb +72 -72
- data/spec/arachni/http/headers_spec.rb +14 -14
- data/spec/arachni/http/proxy_server_spec.rb +43 -42
- data/spec/arachni/http/request_spec.rb +105 -103
- data/spec/arachni/http/response/scope_spec.rb +24 -24
- data/spec/arachni/http/response_spec.rb +50 -49
- data/spec/arachni/issue/severity_spec.rb +10 -9
- data/spec/arachni/issue_spec.rb +71 -369
- data/spec/arachni/option_groups/audit_spec.rb +114 -114
- data/spec/arachni/option_groups/browser_cluster_spec.rb +20 -3
- data/spec/arachni/option_groups/datastore_spec.rb +6 -6
- data/spec/arachni/option_groups/dispatcher_spec.rb +19 -19
- data/spec/arachni/option_groups/http_spec.rb +11 -11
- data/spec/arachni/option_groups/input_spec.rb +31 -27
- data/spec/arachni/option_groups/output_spec.rb +2 -2
- data/spec/arachni/option_groups/paths_spec.rb +17 -17
- data/spec/arachni/option_groups/rpc_spec.rb +2 -2
- data/spec/arachni/option_groups/scope_spec.rb +40 -40
- data/spec/arachni/option_groups/session_spec.rb +6 -5
- data/spec/arachni/option_groups/snapshot_spec.rb +4 -4
- data/spec/arachni/options_spec.rb +46 -45
- data/spec/arachni/page/dom/transition_spec.rb +74 -72
- data/spec/arachni/page/dom_spec.rb +35 -35
- data/spec/arachni/page/scope_spec.rb +15 -15
- data/spec/arachni/page_spec.rb +217 -217
- data/spec/arachni/parser_spec.rb +106 -104
- data/spec/arachni/platform/fingerprinter_spec.rb +17 -14
- data/spec/arachni/platform/list_spec.rb +33 -33
- data/spec/arachni/platform/manager_spec.rb +67 -64
- data/spec/arachni/plugin/base_spec.rb +10 -10
- data/spec/arachni/plugin/manager_spec.rb +38 -37
- data/spec/arachni/report_spec.rb +43 -40
- data/spec/arachni/reporter/base_spec.rb +15 -15
- data/spec/arachni/reporter/manager_spec.rb +4 -4
- data/spec/arachni/reporter/options_spec.rb +6 -6
- data/spec/arachni/rpc/client/base_spec.rb +6 -6
- data/spec/arachni/rpc/client/dispatcher_spec.rb +2 -2
- data/spec/arachni/rpc/client/instance_spec.rb +6 -6
- data/spec/arachni/rpc/server/active_options_spec.rb +11 -8
- data/spec/arachni/rpc/server/base_spec.rb +5 -5
- data/spec/arachni/rpc/server/checks/manager_spec.rb +8 -8
- data/spec/arachni/rpc/server/dispatcher/node_spec.rb +37 -37
- data/spec/arachni/rpc/server/dispatcher/service_spec.rb +15 -14
- data/spec/arachni/rpc/server/dispatcher_spec.rb +36 -35
- data/spec/arachni/rpc/server/framework/distributor_spec.rb +36 -36
- data/spec/arachni/rpc/server/framework_multi_spec.rb +340 -336
- data/spec/arachni/rpc/server/framework_spec.rb +90 -85
- data/spec/arachni/rpc/server/instance_spec.rb +126 -107
- data/spec/arachni/rpc/server/output_spec.rb +1 -1
- data/spec/arachni/rpc/server/plugin/manager_spec.rb +6 -6
- data/spec/arachni/ruby/array_spec.rb +42 -42
- data/spec/arachni/ruby/hash_spec.rb +20 -18
- data/spec/arachni/ruby/io_spec.rb +2 -2
- data/spec/arachni/ruby/object_spec.rb +1 -1
- data/spec/arachni/ruby/set_spec.rb +3 -3
- data/spec/arachni/ruby/string_spec.rb +30 -30
- data/spec/arachni/ruby/webrick_spec.rb +2 -2
- data/spec/arachni/scope_spec.rb +1 -1
- data/spec/arachni/session_spec.rb +67 -64
- data/spec/arachni/snapshot_spec.rb +15 -15
- data/spec/arachni/state/audit_spec.rb +11 -11
- data/spec/arachni/state/element_filter_spec.rb +6 -6
- data/spec/arachni/state/framework/rpc_spec.rb +12 -12
- data/spec/arachni/state/framework_spec.rb +125 -121
- data/spec/arachni/state/http_spec.rb +7 -7
- data/spec/arachni/state/options_spec.rb +7 -7
- data/spec/arachni/state/plugins_spec.rb +8 -8
- data/spec/arachni/state_spec.rb +10 -10
- data/spec/arachni/support/buffer/autoflush_spec.rb +16 -16
- data/spec/arachni/support/buffer/base_spec.rb +39 -39
- data/spec/arachni/support/cache/least_cost_replacement_spec.rb +18 -18
- data/spec/arachni/support/cache/least_recently_pushed_spec.rb +24 -24
- data/spec/arachni/support/cache/least_recently_used_spec.rb +20 -20
- data/spec/arachni/support/cache/preference_spec.rb +4 -4
- data/spec/arachni/support/cache/random_replacement_spec.rb +8 -8
- data/spec/arachni/support/crypto/rsa_aes_cbc_spec.rb +1 -1
- data/spec/arachni/support/database/hash_spec.rb +44 -43
- data/spec/arachni/support/database/queue_spec.rb +27 -27
- data/spec/arachni/support/lookup/hash_set_spec.rb +8 -8
- data/spec/arachni/support/lookup/moolb_spec.rb +3 -3
- data/spec/arachni/support/mixins/observable_spec.rb +6 -6
- data/spec/arachni/support/signature_spec.rb +19 -19
- data/spec/arachni/trainer_spec.rb +39 -39
- data/spec/arachni/typhoeus/hydra_spec.rb +2 -2
- data/spec/arachni/uri/scope_spec.rb +66 -66
- data/spec/arachni/uri_spec.rb +107 -105
- data/spec/arachni/utilities_spec.rb +40 -40
- data/spec/components/checks/active/csrf_spec.rb +8 -8
- data/spec/components/checks/active/no_sql_injection_spec.rb +1 -1
- data/spec/components/checks/active/sql_injection_spec.rb +16 -16
- data/spec/components/checks/active/trainer_spec.rb +4 -4
- data/spec/components/checks/active/unvalidated_redirect_dom_spec.rb +4 -2
- data/spec/components/checks/active/xpath_injection_spec.rb +1 -1
- data/spec/components/checks/active/xss_dom_script_context_spec.rb +51 -21
- data/spec/components/checks/active/xss_dom_spec.rb +46 -24
- data/spec/components/checks/passive/allowed_methods_spec.rb +1 -1
- data/spec/components/checks/passive/grep/cookie_set_for_parent_domain_spec.rb +1 -1
- data/spec/components/checks/passive/grep/hsts_spec.rb +2 -2
- data/spec/components/checks/passive/grep/http_only_cookies_spec.rb +1 -1
- data/spec/components/checks/passive/grep/insecure_cookies_spec.rb +1 -1
- data/spec/components/checks/passive/grep/insecure_cors_policy_spec.rb +2 -2
- data/spec/components/checks/passive/grep/password_autocomplete_spec.rb +1 -1
- data/spec/components/checks/passive/grep/private_ip_spec.rb +3 -3
- data/spec/components/checks/passive/grep/unencrypted_password_forms_spec.rb +1 -1
- data/spec/components/checks/passive/grep/x_frame_options_spec.rb +2 -2
- data/spec/components/checks/passive/interesting_responses_spec.rb +2 -2
- data/spec/components/checks/passive/webdav_spec.rb +1 -1
- data/spec/components/checks/passive/xst_spec.rb +1 -1
- data/spec/components/fingerprinters/servers/apache_spec.rb +2 -2
- data/spec/components/path_extractors/comments_spec.rb +5 -1
- data/spec/components/path_extractors/scripts_spec.rb +5 -2
- data/spec/components/plugins/autologin_spec.rb +22 -22
- data/spec/components/plugins/autothrottle_spec.rb +6 -5
- data/spec/components/plugins/content_types_spec.rb +4 -4
- data/spec/components/plugins/cookie_collector_spec.rb +5 -5
- data/spec/components/plugins/exec_spec.rb +12 -12
- data/spec/components/plugins/form_dicattack_spec.rb +3 -3
- data/spec/components/plugins/headers_collector_spec.rb +8 -8
- data/spec/components/plugins/healthmap_spec.rb +3 -3
- data/spec/components/plugins/http_dicattack_spec.rb +3 -3
- data/spec/components/plugins/login_script_spec.rb +79 -22
- data/spec/components/plugins/meta/remedies/discovery_spec.rb +3 -2
- data/spec/components/plugins/meta/remedies/timing_attacks_spec.rb +3 -3
- data/spec/components/plugins/meta/uniformity_spec.rb +2 -2
- data/spec/components/plugins/restrict_to_dom_state_spec.rb +1 -1
- data/spec/components/plugins/script_spec.rb +1 -1
- data/spec/components/plugins/uncommon_headers_spec.rb +2 -2
- data/spec/components/plugins/vector_collector_spec.rb +2 -2
- data/spec/components/plugins/vector_feed_spec.rb +40 -40
- data/spec/components/plugins/waf_detector_spec.rb +6 -6
- data/spec/components/reporters/json_spec.rb +4 -4
- data/spec/components/reporters/marshal_spec.rb +2 -2
- data/spec/components/reporters/yaml_spec.rb +3 -2
- data/spec/external/wavsep/active/sqli_spec.rb +1 -3
- data/spec/spec_helper.rb +4 -0
- data/spec/support/factories/element/ui_form.rb +14 -0
- data/spec/support/factories/element/ui_input.rb +13 -0
- data/spec/support/factories/issue.rb +0 -13
- data/spec/support/fixtures/report.afr +0 -0
- data/spec/support/fixtures/{taint_check/taint.rb → signature_check/signature.rb} +2 -2
- data/spec/support/helpers/browser_cluster/jobs/taint_tracer.rb +11 -11
- data/spec/support/helpers/framework.rb +1 -1
- data/spec/support/helpers/pages.rb +2 -2
- data/spec/support/servers/arachni/browser.rb +139 -0
- data/spec/support/servers/arachni/browser/javascript/taint_tracer.rb +40 -0
- data/spec/support/servers/arachni/element/capabilities/analyzable/{taint.rb → signature.rb} +0 -0
- data/spec/support/servers/arachni/element/input/input_dom.rb +102 -0
- data/spec/support/servers/arachni/element/ui_form/ui_form_dom.rb +238 -0
- data/spec/support/servers/checks/active/trainer_check.rb +7 -7
- data/spec/support/servers/checks/active/unvalidated_redirect_dom.rb +22 -6
- data/spec/support/servers/checks/active/xss_dom.rb +50 -0
- data/spec/support/servers/checks/active/xss_dom_script_context.rb +53 -0
- data/spec/support/shared/browser/javascript/taint_tracer/sink/base.rb +6 -6
- data/spec/support/shared/check.rb +10 -12
- data/spec/support/shared/component/options/base.rb +24 -24
- data/spec/support/shared/element/base.rb +25 -25
- data/spec/support/shared/element/capabilities/auditable.rb +116 -140
- data/spec/support/shared/element/capabilities/dom_only.rb +65 -0
- data/spec/support/shared/element/capabilities/inputtable.rb +71 -86
- data/spec/support/shared/element/capabilities/mutable.rb +122 -111
- data/spec/support/shared/element/capabilities/refreshable.rb +10 -10
- data/spec/support/shared/element/capabilities/{submitable.rb → submittable.rb} +26 -26
- data/spec/support/shared/element/capabilities/with_auditor.rb +10 -10
- data/spec/support/shared/element/capabilities/with_dom.rb +8 -8
- data/spec/support/shared/element/capabilities/with_node.rb +4 -6
- data/spec/support/shared/element/capabilities/with_scope.rb +2 -2
- data/spec/support/shared/element/capabilities/with_source.rb +6 -8
- data/spec/support/shared/element/dom.rb +144 -0
- data/spec/support/shared/element/dom/auditable.rb +42 -0
- data/spec/support/shared/element/dom/inputtable.rb +5 -0
- data/spec/support/shared/element/dom/mutable.rb +3 -0
- data/spec/support/shared/element/dom/submittable.rb +119 -0
- data/spec/support/shared/external/wavsep.rb +3 -3
- data/spec/support/shared/fingerprinter.rb +2 -2
- data/spec/support/shared/framework.rb +1 -1
- data/spec/support/shared/http/message.rb +9 -9
- data/spec/support/shared/option_group.rb +17 -17
- data/spec/support/shared/path_extractor.rb +1 -1
- data/spec/support/shared/plugin.rb +2 -2
- data/spec/support/shared/support/cache.rb +57 -57
- data/spec/support/shared/support/lookup.rb +25 -25
- data/ui/cli/framework.rb +22 -11
- data/ui/cli/framework/option_parser.rb +15 -0
- data/ui/cli/option_parser.rb +8 -1
- data/ui/cli/output.rb +2 -1
- metadata +54 -20
- data/components/checks/active/xss_dom_inputs.rb +0 -236
- data/spec/components/checks/active/xss_dom_inputs_spec.rb +0 -30
- data/spec/support/servers/checks/active/xss_dom_inputs.rb +0 -59
- data/spec/support/shared/element/capabilities/auditable/dom.rb +0 -322
@@ -11,8 +11,8 @@ describe Arachni::HTTP::CookieJar do
|
|
11
11
|
it 'loads cookies from a Netscape cookie-jar file' do
|
12
12
|
j = subject.class.from_file( cookiejar_file )
|
13
13
|
cookies = j.cookies
|
14
|
-
cookies.size.
|
15
|
-
cookies.
|
14
|
+
expect(cookies.size).to eq(4)
|
15
|
+
expect(cookies).to eq(cookies)
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'when the provided file does not exist' do
|
@@ -29,15 +29,15 @@ describe Arachni::HTTP::CookieJar do
|
|
29
29
|
|
30
30
|
describe '#initialize' do
|
31
31
|
it 'returns a new instance' do
|
32
|
-
Arachni::HTTP::CookieJar.new.is_a?( Arachni::HTTP::CookieJar ).
|
32
|
+
expect(Arachni::HTTP::CookieJar.new.is_a?( Arachni::HTTP::CookieJar )).to be_truthy
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'when a cookiejer option has been provided' do
|
36
36
|
it 'loads cookies from a Netscape cookie-jar file' do
|
37
37
|
j = subject.class.from_file( cookiejar_file )
|
38
38
|
cookies = j.cookies
|
39
|
-
cookies.size.
|
40
|
-
cookies.
|
39
|
+
expect(cookies.size).to eq(4)
|
40
|
+
expect(cookies).to eq(Arachni::Utilities.cookies_from_file( '', cookiejar_file ))
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -51,28 +51,28 @@ describe Arachni::HTTP::CookieJar do
|
|
51
51
|
describe '#<<' do
|
52
52
|
context 'when a cookie with that name does not already exist' do
|
53
53
|
it 'adds the cookie to the jar' do
|
54
|
-
subject.empty
|
54
|
+
expect(subject.empty?).to be_truthy
|
55
55
|
|
56
|
-
(subject << cookie).
|
57
|
-
subject.cookies.first.
|
56
|
+
expect(subject << cookie).to eq(subject)
|
57
|
+
expect(subject.cookies.first).to eq(cookie)
|
58
58
|
|
59
|
-
subject.empty
|
59
|
+
expect(subject.empty?).to be_falsey
|
60
60
|
end
|
61
61
|
end
|
62
62
|
context 'when a cookie with that name already exists' do
|
63
63
|
it 'updates the jar (i.e. replace the cookie)' do
|
64
|
-
subject.empty
|
64
|
+
expect(subject.empty?).to be_truthy
|
65
65
|
|
66
|
-
(subject << cookie).
|
67
|
-
subject.cookies.first.
|
66
|
+
expect(subject << cookie).to eq(subject)
|
67
|
+
expect(subject.cookies.first).to eq(cookie)
|
68
68
|
|
69
69
|
c = cookie.dup
|
70
70
|
c.inputs = { c.name => 'my val' }
|
71
71
|
|
72
|
-
(subject << c).
|
73
|
-
subject.cookies.first.
|
72
|
+
expect(subject << c).to eq(subject)
|
73
|
+
expect(subject.cookies.first).to eq(c)
|
74
74
|
|
75
|
-
subject.empty
|
75
|
+
expect(subject.empty?).to be_falsey
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -80,26 +80,26 @@ describe Arachni::HTTP::CookieJar do
|
|
80
80
|
describe '#update' do
|
81
81
|
context 'when cookies with the same name do not already exist' do
|
82
82
|
it 'adds the cookies to the jar' do
|
83
|
-
subject.empty
|
83
|
+
expect(subject.empty?).to be_truthy
|
84
84
|
|
85
|
-
subject.update( cookies ).
|
86
|
-
subject.cookies.
|
85
|
+
expect(subject.update( cookies )).to eq(subject)
|
86
|
+
expect(subject.cookies).to eq(cookies)
|
87
87
|
|
88
|
-
subject.empty
|
88
|
+
expect(subject.empty?).to be_falsey
|
89
89
|
end
|
90
90
|
end
|
91
91
|
context 'when cookies with the same name already exist' do
|
92
92
|
it 'updates the jar (i.e. replace the cookies)' do
|
93
|
-
subject.empty
|
93
|
+
expect(subject.empty?).to be_truthy
|
94
94
|
|
95
|
-
subject.update( cookies ).
|
96
|
-
subject.cookies.
|
95
|
+
expect(subject.update( cookies )).to eq(subject)
|
96
|
+
expect(subject.cookies).to eq(cookies)
|
97
97
|
|
98
98
|
c = cookies.dup.map { |dc| dc.inputs = { dc.name => dc.name + '-updated' }; dc }
|
99
|
-
subject.update( c ).
|
100
|
-
subject.cookies.
|
99
|
+
expect(subject.update( c )).to eq(subject)
|
100
|
+
expect(subject.cookies).to eq(c)
|
101
101
|
|
102
|
-
subject.empty
|
102
|
+
expect(subject.empty?).to be_falsey
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -108,61 +108,61 @@ describe Arachni::HTTP::CookieJar do
|
|
108
108
|
it 'updates the cookie jar with it' do
|
109
109
|
c = Arachni::Cookie.new( url: 'http://test.com', inputs: { name: 'value' } )
|
110
110
|
|
111
|
-
subject.
|
111
|
+
expect(subject).to be_empty
|
112
112
|
|
113
113
|
subject.update( c )
|
114
|
-
subject.cookies.first.name.
|
115
|
-
subject.cookies.first.value.
|
114
|
+
expect(subject.cookies.first.name).to eq('name')
|
115
|
+
expect(subject.cookies.first.value).to eq('value')
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
119
|
context Hash do
|
120
120
|
it 'converts it to Cookie and update the cookie jar with it' do
|
121
|
-
subject.
|
121
|
+
expect(subject).to be_empty
|
122
122
|
|
123
123
|
Arachni::Options.url = 'http://test.com'
|
124
124
|
subject.update( name: 'value' )
|
125
|
-
subject.cookies.first.name.
|
126
|
-
subject.cookies.first.value.
|
125
|
+
expect(subject.cookies.first.name).to eq('name')
|
126
|
+
expect(subject.cookies.first.value).to eq('value')
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
130
|
context String do
|
131
131
|
it 'parses it into a Cookie and update the cookie jar with it' do
|
132
|
-
subject.
|
132
|
+
expect(subject).to be_empty
|
133
133
|
|
134
134
|
Arachni::Options.url = 'http://test.com'
|
135
135
|
subject.update( 'name=value' )
|
136
|
-
subject.cookies.first.name.
|
137
|
-
subject.cookies.first.value.
|
136
|
+
expect(subject.cookies.first.name).to eq('name')
|
137
|
+
expect(subject.cookies.first.value).to eq('value')
|
138
138
|
end
|
139
139
|
|
140
140
|
context 'when in the form of a Set-Cookie header' do
|
141
141
|
it 'parses it into a Cookie and update the cookie jar with it' do
|
142
|
-
subject.
|
142
|
+
expect(subject).to be_empty
|
143
143
|
|
144
144
|
Arachni::Options.url = 'http://test.com'
|
145
145
|
subject.update( 'some_param=9e4ca2cc0f18a49f7c1881f78bebf7df; path=/; expires=Wed, 02-Oct-2020 23:53:46 GMT; HttpOnly' )
|
146
|
-
subject.cookies.first.name.
|
147
|
-
subject.cookies.first.value.
|
146
|
+
expect(subject.cookies.first.name).to eq('some_param')
|
147
|
+
expect(subject.cookies.first.value).to eq('9e4ca2cc0f18a49f7c1881f78bebf7df')
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
151
|
context 'when in the form of a Set-Cookie header' do
|
152
152
|
it 'parses it into a Cookie and update the cookie jar with it' do
|
153
|
-
subject.
|
153
|
+
expect(subject).to be_empty
|
154
154
|
|
155
155
|
Arachni::Options.url = 'http://test.com'
|
156
156
|
subject.update( 'some_param=9e4ca2cc0f18a49f7c1881f78bebf7df; path=/; expires=Wed, 02-Oct-2020 23:53:46 GMT; HttpOnly' )
|
157
|
-
subject.cookies.first.name.
|
158
|
-
subject.cookies.first.value.
|
157
|
+
expect(subject.cookies.first.name).to eq('some_param')
|
158
|
+
expect(subject.cookies.first.value).to eq('9e4ca2cc0f18a49f7c1881f78bebf7df')
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
163
|
context Array do
|
164
164
|
it 'iterates and if necessary parses the entries and update the cookie jar with them' do
|
165
|
-
subject.
|
165
|
+
expect(subject).to be_empty
|
166
166
|
|
167
167
|
Arachni::Options.url = 'http://test.com'
|
168
168
|
subject.update([
|
@@ -174,19 +174,19 @@ describe Arachni::HTTP::CookieJar do
|
|
174
174
|
|
175
175
|
cookies = subject.cookies
|
176
176
|
|
177
|
-
cookies.size.
|
177
|
+
expect(cookies.size).to eq(3)
|
178
178
|
|
179
179
|
c = cookies.shift
|
180
|
-
c.name.
|
181
|
-
c.value.
|
180
|
+
expect(c.name).to eq('cookie_name')
|
181
|
+
expect(c.value).to eq('cookie_value')
|
182
182
|
|
183
183
|
c = cookies.shift
|
184
|
-
c.name.
|
185
|
-
c.value.
|
184
|
+
expect(c.name).to eq('hash_name')
|
185
|
+
expect(c.value).to eq('hash_value')
|
186
186
|
|
187
187
|
c = cookies.shift
|
188
|
-
c.name.
|
189
|
-
c.value.
|
188
|
+
expect(c.name).to eq('string_name')
|
189
|
+
expect(c.value).to eq('string_value')
|
190
190
|
end
|
191
191
|
end
|
192
192
|
|
@@ -255,19 +255,19 @@ describe Arachni::HTTP::CookieJar do
|
|
255
255
|
|
256
256
|
subject.update( cookies.values )
|
257
257
|
|
258
|
-
subject.for_url( 'http://domain.com/my/path' ).
|
259
|
-
subject.for_url( 'http://domain.com/my/path/' ).
|
260
|
-
subject.for_url( 'http://domain.com' ).
|
261
|
-
subject.for_url( 'http://domain.com/' ).
|
258
|
+
expect(subject.for_url( 'http://domain.com/my/path' )).to eq([cookies[:with_path], cookies[:without_path]])
|
259
|
+
expect(subject.for_url( 'http://domain.com/my/path/' )).to eq([cookies[:with_path], cookies[:without_path]])
|
260
|
+
expect(subject.for_url( 'http://domain.com' )).to eq([cookies[:without_path]])
|
261
|
+
expect(subject.for_url( 'http://domain.com/' )).to eq([cookies[:without_path]])
|
262
262
|
|
263
|
-
subject.for_url( 'http://mydomain.com' ).
|
264
|
-
subject.for_url( 'http://sub.mydomain.com' ).
|
265
|
-
subject.for_url( 'http://deep.sub.mydomain.com' ).
|
263
|
+
expect(subject.for_url( 'http://mydomain.com' )).to eq([cookies[:another_domain], cookies[:tailmatching]])
|
264
|
+
expect(subject.for_url( 'http://sub.mydomain.com' )).to eq([cookies[:tailmatching]])
|
265
|
+
expect(subject.for_url( 'http://deep.sub.mydomain.com' )).to eq([cookies[:tailmatching]])
|
266
266
|
|
267
|
-
subject.for_url( 'http://sub.domain.com' ).
|
268
|
-
subject.for_url( 'http://deeeep.deep.sub.domain.com' ).
|
267
|
+
expect(subject.for_url( 'http://sub.domain.com' )).to eq([cookies[:subdomain], cookies[:subdomain_tailmatching]])
|
268
|
+
expect(subject.for_url( 'http://deeeep.deep.sub.domain.com' )).to eq([cookies[:subdomain_tailmatching]])
|
269
269
|
|
270
|
-
subject.for_url( 'http://expired.com' ).
|
270
|
+
expect(subject.for_url( 'http://expired.com' )).to be_empty
|
271
271
|
end
|
272
272
|
end
|
273
273
|
|
@@ -292,21 +292,21 @@ describe Arachni::HTTP::CookieJar do
|
|
292
292
|
describe 'include_expired' do
|
293
293
|
context true do
|
294
294
|
it 'returns all cookies' do
|
295
|
-
subject.cookies( true ).size.
|
295
|
+
expect(subject.cookies( true ).size).to eq(2)
|
296
296
|
end
|
297
297
|
end
|
298
298
|
context false do
|
299
299
|
it 'returns non expired cookies only' do
|
300
300
|
c = subject.cookies( false )
|
301
|
-
c.size.
|
302
|
-
c.first.name.
|
301
|
+
expect(c.size).to eq(1)
|
302
|
+
expect(c.first.name).to eq('my_name')
|
303
303
|
end
|
304
304
|
end
|
305
305
|
context 'nil' do
|
306
306
|
it 'returns non expired cookies only' do
|
307
307
|
c = subject.cookies( false )
|
308
|
-
c.size.
|
309
|
-
c.first.name.
|
308
|
+
expect(c.size).to eq(1)
|
309
|
+
expect(c.first.name).to eq('my_name')
|
310
310
|
end
|
311
311
|
end
|
312
312
|
end
|
@@ -315,23 +315,23 @@ describe Arachni::HTTP::CookieJar do
|
|
315
315
|
describe '#clear' do
|
316
316
|
it 'empties the jar' do
|
317
317
|
subject.load( cookiejar_file )
|
318
|
-
subject.empty
|
318
|
+
expect(subject.empty?).to be_falsey
|
319
319
|
subject.clear
|
320
|
-
subject.empty
|
320
|
+
expect(subject.empty?).to be_truthy
|
321
321
|
end
|
322
322
|
end
|
323
323
|
|
324
324
|
describe '#empty?' do
|
325
325
|
context 'when the cookie jar is empty' do
|
326
326
|
it 'returns true' do
|
327
|
-
subject.empty
|
327
|
+
expect(subject.empty?).to be_truthy
|
328
328
|
end
|
329
329
|
end
|
330
330
|
context 'when the cookie jar is not empty' do
|
331
331
|
it 'returns false' do
|
332
|
-
subject.empty
|
332
|
+
expect(subject.empty?).to be_truthy
|
333
333
|
subject.load( cookiejar_file )
|
334
|
-
subject.empty
|
334
|
+
expect(subject.empty?).to be_falsey
|
335
335
|
end
|
336
336
|
end
|
337
337
|
end
|
@@ -339,14 +339,14 @@ describe Arachni::HTTP::CookieJar do
|
|
339
339
|
describe '#any?' do
|
340
340
|
context 'when the cookie jar is empty' do
|
341
341
|
it 'returns false' do
|
342
|
-
subject.any
|
342
|
+
expect(subject.any?).to be_falsey
|
343
343
|
end
|
344
344
|
end
|
345
345
|
context 'when the cookie jar is not empty' do
|
346
346
|
it 'returns true' do
|
347
|
-
subject.any
|
347
|
+
expect(subject.any?).to be_falsey
|
348
348
|
subject.load( cookiejar_file )
|
349
|
-
subject.any
|
349
|
+
expect(subject.any?).to be_truthy
|
350
350
|
end
|
351
351
|
end
|
352
352
|
end
|
@@ -365,7 +365,7 @@ describe Arachni::HTTP::CookieJar do
|
|
365
365
|
subject << c
|
366
366
|
subject.merge! other
|
367
367
|
|
368
|
-
subject.cookies.
|
368
|
+
expect(subject.cookies).to eq([c, other.cookies].flatten)
|
369
369
|
end
|
370
370
|
end
|
371
371
|
end
|
@@ -15,14 +15,14 @@ describe Arachni::HTTP::Headers do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'merges them into an array' do
|
18
|
-
subject['set-cookie'].
|
18
|
+
expect(subject['set-cookie']).to eq(cookies.values)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#delete' do
|
23
23
|
it 'deleted a header field' do
|
24
24
|
h = described_class.new( 'x-my-field' => 'stuff' )
|
25
|
-
h.delete( 'X-My-Field' ).
|
25
|
+
expect(h.delete( 'X-My-Field' )).to eq('stuff')
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -30,12 +30,12 @@ describe Arachni::HTTP::Headers do
|
|
30
30
|
context 'when the field is included' do
|
31
31
|
it 'returns true' do
|
32
32
|
h = described_class.new( 'X-My-Field' => 'stuff' )
|
33
|
-
h.include?( 'x-my-field' ).
|
33
|
+
expect(h.include?( 'x-my-field' )).to be_truthy
|
34
34
|
end
|
35
35
|
end
|
36
36
|
context 'when the field is not included' do
|
37
37
|
it 'returns false' do
|
38
|
-
described_class.new.include?( 'x-my-field' ).
|
38
|
+
expect(described_class.new.include?( 'x-my-field' )).to be_falsey
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -43,7 +43,7 @@ describe Arachni::HTTP::Headers do
|
|
43
43
|
describe 'set_cookie' do
|
44
44
|
context 'when there are no set-cookie fields' do
|
45
45
|
it 'returns an empty array' do
|
46
|
-
described_class.new.cookies.
|
46
|
+
expect(described_class.new.cookies).to eq([])
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -53,24 +53,24 @@ describe Arachni::HTTP::Headers do
|
|
53
53
|
'name2=value2; Expires=Wed, 09 Jun 2021 10:18:14 GMT'
|
54
54
|
]
|
55
55
|
|
56
|
-
described_class.new( 'Set-Cookie' => set_coookies ).set_cookie.
|
56
|
+
expect(described_class.new( 'Set-Cookie' => set_coookies ).set_cookie).to eq(set_coookies)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
describe 'cookies' do
|
61
61
|
context 'when there are no cookies' do
|
62
62
|
it 'returns an empty array' do
|
63
|
-
described_class.new.cookies.
|
63
|
+
expect(described_class.new.cookies).to eq([])
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'returns an array of cookies as hashes' do
|
68
|
-
described_class.new(
|
68
|
+
expect(described_class.new(
|
69
69
|
'Set-Cookie' => [
|
70
70
|
'name=value; Expires=Wed, 09 Jun 2020 10:18:14 GMT',
|
71
71
|
'name2=value2; Expires=Wed, 09 Jun 2021 10:18:14 GMT'
|
72
72
|
]
|
73
|
-
).cookies.
|
73
|
+
).cookies).to eq([
|
74
74
|
{
|
75
75
|
name: 'name',
|
76
76
|
value: 'value',
|
@@ -101,7 +101,7 @@ describe Arachni::HTTP::Headers do
|
|
101
101
|
domain: nil,
|
102
102
|
httponly: false
|
103
103
|
}
|
104
|
-
]
|
104
|
+
])
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -109,10 +109,10 @@ describe Arachni::HTTP::Headers do
|
|
109
109
|
it 'returns the content-type' do
|
110
110
|
ct = 'http://test.com'
|
111
111
|
h = { 'location' => ct }
|
112
|
-
described_class.new( h ).location.
|
112
|
+
expect(described_class.new( h ).location).to eq(ct)
|
113
113
|
|
114
114
|
h = { 'Location' => ct }
|
115
|
-
described_class.new( h ).location.
|
115
|
+
expect(described_class.new( h ).location).to eq(ct)
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -120,10 +120,10 @@ describe Arachni::HTTP::Headers do
|
|
120
120
|
it 'returns the content-type' do
|
121
121
|
ct = 'text/html'
|
122
122
|
h = { 'content-type' => ct }
|
123
|
-
described_class.new( h ).content_type.
|
123
|
+
expect(described_class.new( h ).content_type).to eq(ct)
|
124
124
|
|
125
125
|
h = { 'Content-Type' => ct }
|
126
|
-
described_class.new( h ).content_type.
|
126
|
+
expect(described_class.new( h ).content_type).to eq(ct)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
@@ -29,7 +29,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_proxy( proxy )
|
32
|
-
via_proxy( proxy, @url ).body.
|
32
|
+
expect(via_proxy( proxy, @url ).body).to eq('GET')
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'supports SSL interception' do
|
@@ -38,7 +38,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
38
38
|
proxy = described_class.new
|
39
39
|
proxy.start_async
|
40
40
|
|
41
|
-
via_proxy( proxy, url ).body.
|
41
|
+
expect(via_proxy( proxy, url ).body).to eq('HTTPS GET')
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'removes any size limits on the HTTP responses' do
|
@@ -57,7 +57,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
57
57
|
proxy = described_class.new( address: address )
|
58
58
|
proxy.start_async
|
59
59
|
|
60
|
-
proxy.address.split( ':' ).first.
|
60
|
+
expect(proxy.address.split( ':' ).first).to eq(address)
|
61
61
|
test_proxy proxy
|
62
62
|
end
|
63
63
|
end
|
@@ -69,7 +69,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
69
69
|
proxy = described_class.new( port: port )
|
70
70
|
proxy.start_async
|
71
71
|
|
72
|
-
proxy.address.split( ':' ).last.
|
72
|
+
expect(proxy.address.split( ':' ).last).to eq(port.to_s)
|
73
73
|
test_proxy proxy
|
74
74
|
end
|
75
75
|
end
|
@@ -81,8 +81,8 @@ describe Arachni::HTTP::ProxyServer do
|
|
81
81
|
|
82
82
|
sleep_url = @url + 'sleep'
|
83
83
|
|
84
|
-
Typhoeus::Request.get( sleep_url ).code.
|
85
|
-
via_proxy( proxy, sleep_url ).code.
|
84
|
+
expect(Typhoeus::Request.get( sleep_url ).code).not_to eq(0)
|
85
|
+
expect(via_proxy( proxy, sleep_url ).code).to eq(0)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -98,7 +98,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
98
98
|
threads << Thread.new { via_proxy( proxy, sleep_url ) }
|
99
99
|
end
|
100
100
|
threads.each(&:join)
|
101
|
-
(Time.now - time).to_i.
|
101
|
+
expect((Time.now - time).to_i).to eq(5)
|
102
102
|
|
103
103
|
proxy = described_class.new( concurrency: 1 )
|
104
104
|
proxy.start_async
|
@@ -108,7 +108,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
108
108
|
threads << Thread.new { via_proxy( proxy, sleep_url ) }
|
109
109
|
end
|
110
110
|
threads.each(&:join)
|
111
|
-
(Time.now - time).to_i.
|
111
|
+
expect((Time.now - time).to_i).to eq(10)
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
@@ -117,42 +117,42 @@ describe Arachni::HTTP::ProxyServer do
|
|
117
117
|
called = false
|
118
118
|
proxy = described_class.new(
|
119
119
|
request_handler: proc do |request, _|
|
120
|
-
request.
|
120
|
+
expect(request).to be_kind_of Arachni::HTTP::Request
|
121
121
|
called = true
|
122
122
|
end
|
123
123
|
)
|
124
124
|
proxy.start_async
|
125
125
|
test_proxy proxy
|
126
126
|
|
127
|
-
called.
|
127
|
+
expect(called).to be_truthy
|
128
128
|
end
|
129
129
|
|
130
130
|
it 'sets a block to handle each HTTP response before the request is forwarded to the origin server' do
|
131
131
|
called = false
|
132
132
|
proxy = described_class.new(
|
133
133
|
request_handler: proc do |_, response|
|
134
|
-
response.
|
134
|
+
expect(response).to be_kind_of Arachni::HTTP::Response
|
135
135
|
called = true
|
136
136
|
end
|
137
137
|
)
|
138
138
|
proxy.start_async
|
139
139
|
test_proxy proxy
|
140
140
|
|
141
|
-
called.
|
141
|
+
expect(called).to be_truthy
|
142
142
|
end
|
143
143
|
|
144
144
|
it 'assigns the request to the response' do
|
145
145
|
called = false
|
146
146
|
proxy = described_class.new(
|
147
147
|
request_handler: proc do |_, response|
|
148
|
-
response.request.
|
148
|
+
expect(response.request).to be_kind_of Arachni::HTTP::Request
|
149
149
|
called = true
|
150
150
|
end
|
151
151
|
)
|
152
152
|
proxy.start_async
|
153
153
|
test_proxy proxy
|
154
154
|
|
155
|
-
called.
|
155
|
+
expect(called).to be_truthy
|
156
156
|
end
|
157
157
|
|
158
158
|
it 'fills in raw request data' do
|
@@ -166,7 +166,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
166
166
|
proxy.start_async
|
167
167
|
post_via_proxy( proxy, @url )
|
168
168
|
|
169
|
-
request.headers_string.
|
169
|
+
expect(request.headers_string).to eq(
|
170
170
|
"POST / HTTP/1.1\r\n" <<
|
171
171
|
"Accept-Encoding: gzip, deflate\r\n" <<
|
172
172
|
"User-Agent: Typhoeus - https://github.com/typhoeus/typhoeus\r\n" <<
|
@@ -175,8 +175,9 @@ describe Arachni::HTTP::ProxyServer do
|
|
175
175
|
"Proxy-Connection: Keep-Alive\r\n" <<
|
176
176
|
"Content-Type: application/x-www-form-urlencoded\r\n" <<
|
177
177
|
"Content-Length: 7\r\n\r\n"
|
178
|
+
)
|
178
179
|
|
179
|
-
request.effective_body.
|
180
|
+
expect(request.effective_body).to eq('1=2&3=4')
|
180
181
|
end
|
181
182
|
|
182
183
|
context 'if the block returns false' do
|
@@ -184,8 +185,8 @@ describe Arachni::HTTP::ProxyServer do
|
|
184
185
|
called = false
|
185
186
|
proxy = described_class.new(
|
186
187
|
request_handler: proc do |request, response|
|
187
|
-
request.
|
188
|
-
response.
|
188
|
+
expect(request).to be_kind_of Arachni::HTTP::Request
|
189
|
+
expect(response).to be_kind_of Arachni::HTTP::Response
|
189
190
|
called = true
|
190
191
|
|
191
192
|
response.code = 200
|
@@ -196,9 +197,9 @@ describe Arachni::HTTP::ProxyServer do
|
|
196
197
|
)
|
197
198
|
proxy.start_async
|
198
199
|
|
199
|
-
via_proxy( proxy, @url ).body.
|
200
|
+
expect(via_proxy( proxy, @url ).body).to eq('stuff')
|
200
201
|
|
201
|
-
called.
|
202
|
+
expect(called).to be_truthy
|
202
203
|
end
|
203
204
|
end
|
204
205
|
end
|
@@ -208,7 +209,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
208
209
|
called = false
|
209
210
|
proxy = described_class.new(
|
210
211
|
response_handler: proc do |request, _|
|
211
|
-
request.
|
212
|
+
expect(request).to be_kind_of Arachni::HTTP::Request
|
212
213
|
called = true
|
213
214
|
end
|
214
215
|
)
|
@@ -216,14 +217,14 @@ describe Arachni::HTTP::ProxyServer do
|
|
216
217
|
|
217
218
|
test_proxy proxy
|
218
219
|
|
219
|
-
called.
|
220
|
+
expect(called).to be_truthy
|
220
221
|
end
|
221
222
|
|
222
223
|
it 'sets a block to handle each HTTP response once the origin server has responded' do
|
223
224
|
called = false
|
224
225
|
proxy = described_class.new(
|
225
226
|
response_handler: proc do |_, response|
|
226
|
-
response.
|
227
|
+
expect(response).to be_kind_of Arachni::HTTP::Response
|
227
228
|
called = true
|
228
229
|
end
|
229
230
|
)
|
@@ -231,29 +232,29 @@ describe Arachni::HTTP::ProxyServer do
|
|
231
232
|
|
232
233
|
test_proxy proxy
|
233
234
|
|
234
|
-
called.
|
235
|
+
expect(called).to be_truthy
|
235
236
|
end
|
236
237
|
|
237
238
|
it 'assigns the request to the response' do
|
238
239
|
called = false
|
239
240
|
proxy = described_class.new(
|
240
241
|
response_handler: proc do |_, response|
|
241
|
-
response.request.
|
242
|
+
expect(response.request).to be_kind_of Arachni::HTTP::Request
|
242
243
|
called = true
|
243
244
|
end
|
244
245
|
)
|
245
246
|
proxy.start_async
|
246
247
|
test_proxy proxy
|
247
248
|
|
248
|
-
called.
|
249
|
+
expect(called).to be_truthy
|
249
250
|
end
|
250
251
|
|
251
252
|
it 'can manipulate the response' do
|
252
253
|
called = false
|
253
254
|
proxy = described_class.new(
|
254
255
|
response_handler: proc do |request, response|
|
255
|
-
request.
|
256
|
-
response.
|
256
|
+
expect(request).to be_kind_of Arachni::HTTP::Request
|
257
|
+
expect(response).to be_kind_of Arachni::HTTP::Response
|
257
258
|
called = true
|
258
259
|
|
259
260
|
response.body = 'stuff'
|
@@ -263,10 +264,10 @@ describe Arachni::HTTP::ProxyServer do
|
|
263
264
|
|
264
265
|
response = via_proxy( proxy, @url )
|
265
266
|
|
266
|
-
response.code.
|
267
|
-
response.body.
|
267
|
+
expect(response.code).to eq(200)
|
268
|
+
expect(response.body).to eq('stuff')
|
268
269
|
|
269
|
-
called.
|
270
|
+
expect(called).to be_truthy
|
270
271
|
end
|
271
272
|
end
|
272
273
|
end
|
@@ -283,7 +284,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
283
284
|
context 'when the server is not running' do
|
284
285
|
it 'returns false' do
|
285
286
|
proxy = described_class.new
|
286
|
-
proxy.running
|
287
|
+
expect(proxy.running?).to be_falsey
|
287
288
|
end
|
288
289
|
end
|
289
290
|
|
@@ -291,7 +292,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
291
292
|
it 'returns true' do
|
292
293
|
proxy = described_class.new
|
293
294
|
proxy.start_async
|
294
|
-
proxy.running
|
295
|
+
expect(proxy.running?).to be_truthy
|
295
296
|
end
|
296
297
|
end
|
297
298
|
end
|
@@ -302,7 +303,7 @@ describe Arachni::HTTP::ProxyServer do
|
|
302
303
|
port = Arachni::Utilities.available_port
|
303
304
|
|
304
305
|
proxy = described_class.new( address: address, port: port )
|
305
|
-
proxy.address.
|
306
|
+
expect(proxy.address).to eq("#{address}:#{port}")
|
306
307
|
proxy.start_async
|
307
308
|
test_proxy proxy
|
308
309
|
end
|
@@ -314,10 +315,10 @@ describe Arachni::HTTP::ProxyServer do
|
|
314
315
|
proxy = described_class.new
|
315
316
|
proxy.start_async
|
316
317
|
|
317
|
-
proxy.has_connections
|
318
|
+
expect(proxy.has_connections?).to be_falsey
|
318
319
|
Thread.new { via_proxy( proxy, @url + 'sleep' ) }
|
319
320
|
sleep 1
|
320
|
-
proxy.has_connections
|
321
|
+
expect(proxy.has_connections?).to be_truthy
|
321
322
|
end
|
322
323
|
end
|
323
324
|
|
@@ -326,9 +327,9 @@ describe Arachni::HTTP::ProxyServer do
|
|
326
327
|
proxy = described_class.new
|
327
328
|
proxy.start_async
|
328
329
|
|
329
|
-
proxy.has_connections
|
330
|
+
expect(proxy.has_connections?).to be_falsey
|
330
331
|
via_proxy( proxy, @url + 'sleep' )
|
331
|
-
proxy.has_connections
|
332
|
+
expect(proxy.has_connections?).to be_falsey
|
332
333
|
end
|
333
334
|
end
|
334
335
|
end
|
@@ -339,12 +340,12 @@ describe Arachni::HTTP::ProxyServer do
|
|
339
340
|
proxy = described_class.new
|
340
341
|
proxy.start_async
|
341
342
|
|
342
|
-
proxy.active_connections.
|
343
|
+
expect(proxy.active_connections).to eq(0)
|
343
344
|
3.times do
|
344
345
|
Thread.new { via_proxy( proxy, @url + 'sleep' ) }
|
345
346
|
end
|
346
347
|
sleep 1
|
347
|
-
proxy.active_connections.
|
348
|
+
expect(proxy.active_connections).to eq(3)
|
348
349
|
end
|
349
350
|
end
|
350
351
|
|
@@ -353,9 +354,9 @@ describe Arachni::HTTP::ProxyServer do
|
|
353
354
|
proxy = described_class.new
|
354
355
|
proxy.start_async
|
355
356
|
|
356
|
-
proxy.active_connections.
|
357
|
+
expect(proxy.active_connections).to eq(0)
|
357
358
|
via_proxy( proxy, @url + 'sleep' )
|
358
|
-
proxy.active_connections.
|
359
|
+
expect(proxy.active_connections).to eq(0)
|
359
360
|
end
|
360
361
|
end
|
361
362
|
end
|