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
@@ -7,7 +7,7 @@ describe Arachni::OptionGroups::RPC do
|
|
7
7
|
%w(server_socket server_address server_port ssl_ca server_ssl_private_key
|
8
8
|
server_ssl_certificate client_ssl_private_key client_ssl_certificate
|
9
9
|
client_max_retries).each do |method|
|
10
|
-
it {
|
11
|
-
it {
|
10
|
+
it { is_expected.to respond_to method }
|
11
|
+
it { is_expected.to respond_to "#{method}=" }
|
12
12
|
end
|
13
13
|
end
|
@@ -9,8 +9,8 @@ describe Arachni::OptionGroups::Scope do
|
|
9
9
|
exclude_path_patterns exclude_content_patterns include_subdomains https_only
|
10
10
|
url_rewrites exclude_binaries
|
11
11
|
).each do |method|
|
12
|
-
it {
|
13
|
-
it {
|
12
|
+
it { is_expected.to respond_to method }
|
13
|
+
it { is_expected.to respond_to "#{method}=" }
|
14
14
|
end
|
15
15
|
|
16
16
|
describe '#url_rewrites' do
|
@@ -19,9 +19,9 @@ describe Arachni::OptionGroups::Scope do
|
|
19
19
|
'/article/(\d+)' => 'articles?id=\1'
|
20
20
|
}
|
21
21
|
|
22
|
-
subject.url_rewrites.to_s.
|
22
|
+
expect(subject.url_rewrites.to_s).to eq({
|
23
23
|
/\/article\/(\d+)/ => 'articles?id=\1'
|
24
|
-
}.to_s
|
24
|
+
}.to_s)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -29,18 +29,18 @@ describe Arachni::OptionGroups::Scope do
|
|
29
29
|
describe 'when #https_only has been enabled' do
|
30
30
|
it 'returns true' do
|
31
31
|
subject.https_only = true
|
32
|
-
subject.https_only
|
32
|
+
expect(subject.https_only?).to be_truthy
|
33
33
|
end
|
34
34
|
end
|
35
35
|
describe 'when #https_only has been disabled' do
|
36
36
|
it 'returns false' do
|
37
37
|
subject.https_only = false
|
38
|
-
subject.https_only
|
38
|
+
expect(subject.https_only?).to be_falsey
|
39
39
|
end
|
40
40
|
end
|
41
41
|
describe 'by default' do
|
42
42
|
it 'returns false' do
|
43
|
-
subject.https_only
|
43
|
+
expect(subject.https_only?).to be_falsey
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -49,18 +49,18 @@ describe Arachni::OptionGroups::Scope do
|
|
49
49
|
describe 'when #auto_redundant_paths has been enabled' do
|
50
50
|
it 'returns true' do
|
51
51
|
subject.auto_redundant_paths = 10
|
52
|
-
subject.auto_redundant
|
52
|
+
expect(subject.auto_redundant?).to be_truthy
|
53
53
|
end
|
54
54
|
end
|
55
55
|
describe 'when #auto_redundant_paths has been disabled' do
|
56
56
|
it 'returns false' do
|
57
57
|
subject.auto_redundant_paths = nil
|
58
|
-
subject.auto_redundant
|
58
|
+
expect(subject.auto_redundant?).to be_falsey
|
59
59
|
end
|
60
60
|
end
|
61
61
|
describe 'by default' do
|
62
62
|
it 'returns false' do
|
63
|
-
subject.auto_redundant
|
63
|
+
expect(subject.auto_redundant?).to be_falsey
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -68,47 +68,47 @@ describe Arachni::OptionGroups::Scope do
|
|
68
68
|
describe '#redundant_path_patterns=' do
|
69
69
|
it 'converts its param to properly typed filters' do
|
70
70
|
subject.redundant_path_patterns = { /pattern/ => '45', 'regexp' => 39 }
|
71
|
-
subject.redundant_path_patterns.
|
71
|
+
expect(subject.redundant_path_patterns).to eq({
|
72
72
|
/pattern/ => 45,
|
73
73
|
/regexp/ => 39
|
74
|
-
}
|
74
|
+
})
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
78
|
describe '#do_not_crawl' do
|
79
79
|
it 'sets the page_limit to 0' do
|
80
80
|
subject.do_not_crawl
|
81
|
-
subject.page_limit.
|
81
|
+
expect(subject.page_limit).to eq(0)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
describe '#crawl' do
|
86
86
|
it 'sets the page_limit to < 0' do
|
87
87
|
subject.crawl
|
88
|
-
subject.crawl
|
89
|
-
!subject.page_limit.
|
88
|
+
expect(subject.crawl?).to be_truthy
|
89
|
+
!expect(subject.page_limit).to be_nil
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
describe '#crawl?' do
|
94
94
|
context 'by default' do
|
95
95
|
it 'returns true' do
|
96
|
-
subject.crawl
|
96
|
+
expect(subject.crawl?).to be_truthy
|
97
97
|
end
|
98
98
|
end
|
99
99
|
context 'when crawling is enabled' do
|
100
100
|
it 'returns true' do
|
101
101
|
subject.do_not_crawl
|
102
|
-
subject.crawl
|
102
|
+
expect(subject.crawl?).to be_falsey
|
103
103
|
subject.crawl
|
104
|
-
subject.crawl
|
104
|
+
expect(subject.crawl?).to be_truthy
|
105
105
|
end
|
106
106
|
end
|
107
107
|
context 'when crawling is disabled' do
|
108
108
|
it 'returns false' do
|
109
|
-
subject.crawl
|
109
|
+
expect(subject.crawl?).to be_truthy
|
110
110
|
subject.do_not_crawl
|
111
|
-
subject.crawl
|
111
|
+
expect(subject.crawl?).to be_falsey
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -117,22 +117,22 @@ describe Arachni::OptionGroups::Scope do
|
|
117
117
|
context 'when #page_limit has' do
|
118
118
|
context 'not been set' do
|
119
119
|
it 'returns false' do
|
120
|
-
subject.page_limit_reached?( 44 ).
|
120
|
+
expect(subject.page_limit_reached?( 44 )).to be_falsey
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
124
|
context 'not been reached' do
|
125
125
|
it 'returns false' do
|
126
126
|
subject.page_limit = 5
|
127
|
-
subject.page_limit_reached?( 2 ).
|
127
|
+
expect(subject.page_limit_reached?( 2 )).to be_falsey
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
131
|
context 'been reached' do
|
132
132
|
it 'returns true' do
|
133
133
|
subject.page_limit = 5
|
134
|
-
subject.page_limit_reached?( 5 ).
|
135
|
-
subject.page_limit_reached?( 6 ).
|
134
|
+
expect(subject.page_limit_reached?( 5 )).to be_truthy
|
135
|
+
expect(subject.page_limit_reached?( 6 )).to be_truthy
|
136
136
|
end
|
137
137
|
end
|
138
138
|
end
|
@@ -143,10 +143,10 @@ describe Arachni::OptionGroups::Scope do
|
|
143
143
|
restrict_paths = %w(my_restrict_paths my_other_restrict_paths)
|
144
144
|
|
145
145
|
subject.restrict_paths = restrict_paths.first
|
146
|
-
subject.restrict_paths.
|
146
|
+
expect(subject.restrict_paths).to eq([restrict_paths.first])
|
147
147
|
|
148
148
|
subject.restrict_paths = restrict_paths
|
149
|
-
subject.restrict_paths.
|
149
|
+
expect(subject.restrict_paths).to eq(restrict_paths)
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
@@ -155,10 +155,10 @@ describe Arachni::OptionGroups::Scope do
|
|
155
155
|
extend_paths = %w(my_extend_paths my_other_extend_paths)
|
156
156
|
|
157
157
|
subject.extend_paths = extend_paths.first
|
158
|
-
subject.extend_paths.
|
158
|
+
expect(subject.extend_paths).to eq([extend_paths.first])
|
159
159
|
|
160
160
|
subject.extend_paths = extend_paths
|
161
|
-
subject.extend_paths.
|
161
|
+
expect(subject.extend_paths).to eq(extend_paths)
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
@@ -167,13 +167,13 @@ describe Arachni::OptionGroups::Scope do
|
|
167
167
|
include = %w(my_include my_other_include)
|
168
168
|
|
169
169
|
subject.include_path_patterns = /test/
|
170
|
-
subject.include_path_patterns.
|
170
|
+
expect(subject.include_path_patterns).to eq([/test/])
|
171
171
|
|
172
172
|
subject.include_path_patterns = include.first
|
173
|
-
subject.include_path_patterns.
|
173
|
+
expect(subject.include_path_patterns).to eq([Regexp.new( include.first )])
|
174
174
|
|
175
175
|
subject.include_path_patterns = include
|
176
|
-
subject.include_path_patterns.
|
176
|
+
expect(subject.include_path_patterns).to eq(include.map { |p| Regexp.new( p ) })
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
@@ -182,13 +182,13 @@ describe Arachni::OptionGroups::Scope do
|
|
182
182
|
exclude = %w(my_exclude my_other_exclude)
|
183
183
|
|
184
184
|
subject.exclude_path_patterns= /test/
|
185
|
-
subject.exclude_path_patterns.
|
185
|
+
expect(subject.exclude_path_patterns).to eq([/test/])
|
186
186
|
|
187
187
|
subject.exclude_path_patterns= exclude.first
|
188
|
-
subject.exclude_path_patterns.
|
188
|
+
expect(subject.exclude_path_patterns).to eq([Regexp.new( exclude.first )])
|
189
189
|
|
190
190
|
subject.exclude_path_patterns= exclude
|
191
|
-
subject.exclude_path_patterns.
|
191
|
+
expect(subject.exclude_path_patterns).to eq(exclude.map { |p| Regexp.new( p ) })
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
@@ -197,13 +197,13 @@ describe Arachni::OptionGroups::Scope do
|
|
197
197
|
exclude_pages = %w(my_ignore my_other_ignore)
|
198
198
|
|
199
199
|
subject.exclude_content_patterns = /test/
|
200
|
-
subject.exclude_content_patterns.
|
200
|
+
expect(subject.exclude_content_patterns).to eq([/test/])
|
201
201
|
|
202
202
|
subject.exclude_content_patterns = exclude_pages.first
|
203
|
-
subject.exclude_content_patterns.
|
203
|
+
expect(subject.exclude_content_patterns).to eq([Regexp.new( exclude_pages.first )])
|
204
204
|
|
205
205
|
subject.exclude_content_patterns = exclude_pages
|
206
|
-
subject.exclude_content_patterns.
|
206
|
+
expect(subject.exclude_content_patterns).to eq(exclude_pages.map { |p| Regexp.new( p ) })
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
@@ -214,14 +214,14 @@ describe Arachni::OptionGroups::Scope do
|
|
214
214
|
values = { /redundant_path_patterns/ => 1 }
|
215
215
|
subject.redundant_path_patterns = values
|
216
216
|
|
217
|
-
data['redundant_path_patterns'].
|
217
|
+
expect(data['redundant_path_patterns']).to eq(values.my_stringify)
|
218
218
|
end
|
219
219
|
|
220
220
|
it "converts 'url_rewrites' to strings" do
|
221
221
|
values = { /url_rewrites/ => 'test' }
|
222
222
|
subject.url_rewrites = values
|
223
223
|
|
224
|
-
data['url_rewrites'].
|
224
|
+
expect(data['url_rewrites']).to eq(values.my_stringify)
|
225
225
|
end
|
226
226
|
|
227
227
|
%w(exclude_path_patterns exclude_content_patterns include_path_patterns).each do |k|
|
@@ -229,7 +229,7 @@ describe Arachni::OptionGroups::Scope do
|
|
229
229
|
values = [/#{k}/]
|
230
230
|
subject.send( "#{k}=", values )
|
231
231
|
|
232
|
-
data[k].
|
232
|
+
expect(data[k]).to eq([/#{k}/.to_s])
|
233
233
|
end
|
234
234
|
end
|
235
235
|
end
|
@@ -12,14 +12,14 @@ describe Arachni::OptionGroups::Session do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
%w(check_url check_pattern).each do |method|
|
15
|
-
it {
|
16
|
-
it {
|
15
|
+
it { is_expected.to respond_to method }
|
16
|
+
it { is_expected.to respond_to "#{method}=" }
|
17
17
|
end
|
18
18
|
|
19
19
|
describe '#validate' do
|
20
20
|
context 'when valid' do
|
21
21
|
it 'returns nil' do
|
22
|
-
valid.validate.
|
22
|
+
expect(valid.validate).to be_empty
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -30,8 +30,9 @@ describe Arachni::OptionGroups::Session do
|
|
30
30
|
context attribute do
|
31
31
|
it 'returns errors' do
|
32
32
|
valid.send( "#{attribute}=", nil )
|
33
|
-
valid.validate.
|
33
|
+
expect(valid.validate).to eq(
|
34
34
|
{ attribute.to_sym => 'Option is missing.'}
|
35
|
+
)
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
@@ -45,7 +46,7 @@ describe Arachni::OptionGroups::Session do
|
|
45
46
|
|
46
47
|
it "converts 'check_pattern' to strings" do
|
47
48
|
subject.check_pattern = /test/
|
48
|
-
data['check_pattern'].
|
49
|
+
expect(data['check_pattern']).to eq(subject.check_pattern.to_s)
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
@@ -5,14 +5,14 @@ describe Arachni::OptionGroups::Snapshot do
|
|
5
5
|
subject { described_class.new }
|
6
6
|
|
7
7
|
%w(save_path).each do |method|
|
8
|
-
it {
|
9
|
-
it {
|
8
|
+
it { is_expected.to respond_to method }
|
9
|
+
it { is_expected.to respond_to "#{method}=" }
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '.save_path' do
|
13
13
|
context "when #{Arachni::OptionGroups::Paths}.config['framework']['snapshots']" do
|
14
14
|
it 'returns it' do
|
15
|
-
Arachni::OptionGroups::Paths.
|
15
|
+
allow(Arachni::OptionGroups::Paths).to receive(:config) do
|
16
16
|
{
|
17
17
|
'framework' => {
|
18
18
|
'snapshots' => 'stuff/'
|
@@ -20,7 +20,7 @@ describe Arachni::OptionGroups::Snapshot do
|
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
23
|
-
subject.save_path.
|
23
|
+
expect(subject.save_path).to eq('stuff/')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -11,52 +11,53 @@ describe Arachni::Options do
|
|
11
11
|
|
12
12
|
it 'proxies missing class methods to instance methods' do
|
13
13
|
url = 'http://test.com/'
|
14
|
-
subject.url.
|
14
|
+
expect(subject.url).not_to eq(url)
|
15
15
|
subject.url = url
|
16
|
-
subject.url.
|
16
|
+
expect(subject.url).to eq(url)
|
17
17
|
end
|
18
18
|
|
19
19
|
%w(checks platforms plugins authorized_by no_fingerprinting spawns).each do |method|
|
20
|
-
it {
|
21
|
-
it {
|
20
|
+
it { is_expected.to respond_to method }
|
21
|
+
it { is_expected.to respond_to "#{method}=" }
|
22
22
|
end
|
23
23
|
|
24
24
|
groups.each do |group|
|
25
25
|
describe "##{group}" do
|
26
26
|
it 'is an OptionGroup' do
|
27
|
-
subject.send( group ).
|
28
|
-
subject.send( group ).class.to_s.downcase.
|
27
|
+
expect(subject.send( group )).to be_kind_of Arachni::OptionGroup
|
28
|
+
expect(subject.send( group ).class.to_s.downcase).to eq(
|
29
29
|
"arachni::optiongroups::#{group}"
|
30
|
+
)
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
34
35
|
describe '#spawns' do
|
35
36
|
it 'defaults to 0' do
|
36
|
-
subject.spawns.
|
37
|
+
expect(subject.spawns).to eq(0)
|
37
38
|
end
|
38
39
|
|
39
40
|
it 'converts its argument to Integer' do
|
40
41
|
subject.spawns = '5'
|
41
|
-
subject.spawns.
|
42
|
+
expect(subject.spawns).to eq(5)
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
46
|
describe '#do_not_fingerprint' do
|
46
47
|
it 'disables fingerprinting' do
|
47
|
-
subject.no_fingerprinting.
|
48
|
+
expect(subject.no_fingerprinting).to be_falsey
|
48
49
|
subject.do_not_fingerprint
|
49
|
-
subject.no_fingerprinting.
|
50
|
+
expect(subject.no_fingerprinting).to be_truthy
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
53
54
|
describe '#fingerprint' do
|
54
55
|
it 'enables fingerprinting' do
|
55
56
|
subject.do_not_fingerprint
|
56
|
-
subject.no_fingerprinting.
|
57
|
+
expect(subject.no_fingerprinting).to be_truthy
|
57
58
|
|
58
59
|
subject.fingerprint
|
59
|
-
subject.no_fingerprinting.
|
60
|
+
expect(subject.no_fingerprinting).to be_falsey
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
@@ -64,14 +65,14 @@ describe Arachni::Options do
|
|
64
65
|
context 'when fingerprinting is enabled' do
|
65
66
|
it 'returns true' do
|
66
67
|
subject.no_fingerprinting = false
|
67
|
-
subject.fingerprint
|
68
|
+
expect(subject.fingerprint?).to be_truthy
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
71
72
|
context 'when fingerprinting is disabled' do
|
72
73
|
it 'returns false' do
|
73
74
|
subject.no_fingerprinting = true
|
74
|
-
subject.fingerprint
|
75
|
+
expect(subject.fingerprint?).to be_falsey
|
75
76
|
end
|
76
77
|
end
|
77
78
|
end
|
@@ -79,18 +80,18 @@ describe Arachni::Options do
|
|
79
80
|
describe '#validate' do
|
80
81
|
context 'when valid' do
|
81
82
|
it 'returns nil' do
|
82
|
-
subject.validate.
|
83
|
+
expect(subject.validate).to be_empty
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
86
87
|
context 'when invalid' do
|
87
88
|
it 'returns errors by group' do
|
88
89
|
subject.session.check_pattern = /test/
|
89
|
-
subject.validate.
|
90
|
+
expect(subject.validate).to eq({
|
90
91
|
session: {
|
91
92
|
check_url: "Option is missing."
|
92
93
|
}
|
93
|
-
}
|
94
|
+
})
|
94
95
|
end
|
95
96
|
end
|
96
97
|
end
|
@@ -98,17 +99,17 @@ describe Arachni::Options do
|
|
98
99
|
describe '#url=' do
|
99
100
|
it 'normalizes its argument' do
|
100
101
|
subject.url = 'http://test.com/my path'
|
101
|
-
subject.url.
|
102
|
+
expect(subject.url).to eq(@utils.normalize_url( subject.url ))
|
102
103
|
end
|
103
104
|
|
104
105
|
it 'accepts the HTTP scheme' do
|
105
106
|
subject.url = 'http://test.com'
|
106
|
-
subject.url.
|
107
|
+
expect(subject.url).to eq('http://test.com/')
|
107
108
|
end
|
108
109
|
|
109
110
|
it 'accepts the HTTPS scheme' do
|
110
111
|
subject.url = 'https://test.com'
|
111
|
-
subject.url.
|
112
|
+
expect(subject.url).to eq('https://test.com/')
|
112
113
|
end
|
113
114
|
|
114
115
|
context 'when passed reserved host' do
|
@@ -158,7 +159,7 @@ describe Arachni::Options do
|
|
158
159
|
context 'and an HTTPS url is provided' do
|
159
160
|
it 'accepts the HTTPS scheme' do
|
160
161
|
subject.url = 'https://test.com'
|
161
|
-
subject.url.
|
162
|
+
expect(subject.url).to eq('https://test.com/')
|
162
163
|
end
|
163
164
|
end
|
164
165
|
|
@@ -177,7 +178,7 @@ describe Arachni::Options do
|
|
177
178
|
opts = { url: 'http://blah2.com' }
|
178
179
|
|
179
180
|
subject.update( opts )
|
180
|
-
subject.url.to_s.
|
181
|
+
expect(subject.url.to_s).to eq(@utils.normalize_url( opts[:url] ))
|
181
182
|
end
|
182
183
|
|
183
184
|
context 'when key refers to an OptionGroup' do
|
@@ -195,10 +196,10 @@ describe Arachni::Options do
|
|
195
196
|
|
196
197
|
subject.update( opts )
|
197
198
|
|
198
|
-
subject.scope.exclude_path_patterns.
|
199
|
-
subject.scope.include_path_patterns.
|
200
|
-
subject.scope.redundant_path_patterns.
|
201
|
-
subject.datastore.to_h.
|
199
|
+
expect(subject.scope.exclude_path_patterns).to eq([/exclude me2/])
|
200
|
+
expect(subject.scope.include_path_patterns).to eq([/include me2/])
|
201
|
+
expect(subject.scope.redundant_path_patterns).to eq({ /redundant/ => 4 })
|
202
|
+
expect(subject.datastore.to_h).to eq(opts[:datastore])
|
202
203
|
end
|
203
204
|
end
|
204
205
|
end
|
@@ -215,7 +216,7 @@ describe Arachni::Options do
|
|
215
216
|
rescue
|
216
217
|
raised = true
|
217
218
|
end
|
218
|
-
raised.
|
219
|
+
expect(raised).to be_falsey
|
219
220
|
end
|
220
221
|
|
221
222
|
it 'returns the file location'do
|
@@ -229,7 +230,7 @@ describe Arachni::Options do
|
|
229
230
|
rescue
|
230
231
|
raised = true
|
231
232
|
end
|
232
|
-
raised.
|
233
|
+
expect(raised).to be_falsey
|
233
234
|
end
|
234
235
|
end
|
235
236
|
|
@@ -241,8 +242,8 @@ describe Arachni::Options do
|
|
241
242
|
subject.save( f )
|
242
243
|
|
243
244
|
options = subject.load( f )
|
244
|
-
options.
|
245
|
-
options.scope.restrict_paths.
|
245
|
+
expect(options).to eq(subject)
|
246
|
+
expect(options.scope.restrict_paths).to eq(['test'])
|
246
247
|
|
247
248
|
raised = false
|
248
249
|
begin
|
@@ -250,7 +251,7 @@ describe Arachni::Options do
|
|
250
251
|
rescue
|
251
252
|
raised = true
|
252
253
|
end
|
253
|
-
raised.
|
254
|
+
expect(raised).to be_falsey
|
254
255
|
end
|
255
256
|
end
|
256
257
|
|
@@ -259,18 +260,18 @@ describe Arachni::Options do
|
|
259
260
|
ignore = [:instance, :rpc, :dispatcher, :paths, :spawns, :snapshot, :output]
|
260
261
|
|
261
262
|
it 'converts self to a serializable hash' do
|
262
|
-
data.
|
263
|
+
expect(data).to be_kind_of Hash
|
263
264
|
|
264
|
-
Arachni::RPC::Serializer.load(
|
265
|
+
expect(Arachni::RPC::Serializer.load(
|
265
266
|
Arachni::RPC::Serializer.dump( data )
|
266
|
-
).
|
267
|
+
)).to eq(data)
|
267
268
|
end
|
268
269
|
|
269
270
|
(groups - ignore).each do |k|
|
270
271
|
k = k.to_s
|
271
272
|
|
272
273
|
it "includes the '#{k}' group" do
|
273
|
-
data[k].
|
274
|
+
expect(data[k]).to eq(subject.send(k).to_rpc_data)
|
274
275
|
end
|
275
276
|
end
|
276
277
|
|
@@ -278,7 +279,7 @@ describe Arachni::Options do
|
|
278
279
|
k = k.to_s
|
279
280
|
|
280
281
|
it "does not include the '#{k}' group" do
|
281
|
-
subject.to_rpc_data.
|
282
|
+
expect(subject.to_rpc_data).not_to include k
|
282
283
|
end
|
283
284
|
end
|
284
285
|
end
|
@@ -290,7 +291,7 @@ describe Arachni::Options do
|
|
290
291
|
subject.datastore.stuff = 'test2'
|
291
292
|
|
292
293
|
h = subject.to_hash
|
293
|
-
h.
|
294
|
+
expect(h).to be_kind_of Hash
|
294
295
|
|
295
296
|
h.each do |k, v|
|
296
297
|
next if k == :instance
|
@@ -298,13 +299,13 @@ describe Arachni::Options do
|
|
298
299
|
|
299
300
|
case v
|
300
301
|
when nil
|
301
|
-
v.
|
302
|
+
expect(v).to be_nil
|
302
303
|
|
303
304
|
when Array
|
304
|
-
subject_value.
|
305
|
+
expect(subject_value).to eq(v)
|
305
306
|
|
306
307
|
else
|
307
|
-
(subject_value.respond_to?( :to_h ) ? subject_value.to_h : v).
|
308
|
+
expect(subject_value.respond_to?( :to_h ) ? subject_value.to_h : v).to eq(v)
|
308
309
|
end
|
309
310
|
end
|
310
311
|
end
|
@@ -312,7 +313,7 @@ describe Arachni::Options do
|
|
312
313
|
|
313
314
|
describe '#to_h' do
|
314
315
|
it 'aliased to to_hash' do
|
315
|
-
subject.to_hash.
|
316
|
+
expect(subject.to_hash).to eq(subject.to_h)
|
316
317
|
end
|
317
318
|
end
|
318
319
|
|
@@ -324,8 +325,8 @@ describe Arachni::Options do
|
|
324
325
|
}
|
325
326
|
)
|
326
327
|
|
327
|
-
normalized[:http][:request_timeout].
|
328
|
-
subject.http.request_timeout.
|
328
|
+
expect(normalized[:http][:request_timeout]).to eq(90_000)
|
329
|
+
expect(subject.http.request_timeout).not_to eq(90_000)
|
329
330
|
end
|
330
331
|
end
|
331
332
|
|
@@ -335,8 +336,8 @@ describe Arachni::Options do
|
|
335
336
|
http: { request_timeout: 90_000 }
|
336
337
|
)
|
337
338
|
|
338
|
-
normalized['http']['request_timeout'].
|
339
|
-
subject.http.request_timeout.
|
339
|
+
expect(normalized['http']['request_timeout']).to eq(90_000)
|
340
|
+
expect(subject.http.request_timeout).not_to eq(90_000)
|
340
341
|
end
|
341
342
|
end
|
342
343
|
|