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
@@ -16,14 +16,14 @@ describe Arachni::State::Audit do
|
|
16
16
|
|
17
17
|
it 'includes the total audit operations' do
|
18
18
|
subject << audit_id
|
19
|
-
statistics[:total].
|
19
|
+
expect(statistics[:total]).to eq(subject.size)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe '#<<' do
|
24
24
|
it 'pushes a state' do
|
25
25
|
subject << audit_id
|
26
|
-
subject.
|
26
|
+
expect(subject).to include audit_id
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -31,13 +31,13 @@ describe Arachni::State::Audit do
|
|
31
31
|
context 'when an operation is included' do
|
32
32
|
it 'returns true' do
|
33
33
|
subject << audit_id
|
34
|
-
subject.
|
34
|
+
expect(subject).to include audit_id
|
35
35
|
end
|
36
36
|
end
|
37
37
|
context 'when an operation is not included' do
|
38
38
|
it 'returns false' do
|
39
39
|
subject << audit_id
|
40
|
-
subject.
|
40
|
+
expect(subject).not_to include "#{audit_id}2"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -45,13 +45,13 @@ describe Arachni::State::Audit do
|
|
45
45
|
describe '#empty?' do
|
46
46
|
context 'when the list is empty' do
|
47
47
|
it 'returns true' do
|
48
|
-
subject.
|
48
|
+
expect(subject).to be_empty
|
49
49
|
end
|
50
50
|
end
|
51
51
|
context 'when the list is not empty' do
|
52
52
|
it 'returns false' do
|
53
53
|
subject << audit_id
|
54
|
-
subject.
|
54
|
+
expect(subject).not_to be_empty
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -59,13 +59,13 @@ describe Arachni::State::Audit do
|
|
59
59
|
describe '#any?' do
|
60
60
|
context 'when the list is empty' do
|
61
61
|
it 'returns false' do
|
62
|
-
subject.
|
62
|
+
expect(subject).not_to be_any
|
63
63
|
end
|
64
64
|
end
|
65
65
|
context 'when the list is not empty' do
|
66
66
|
it 'returns true' do
|
67
67
|
subject << audit_id
|
68
|
-
subject.
|
68
|
+
expect(subject).to be_any
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -74,7 +74,7 @@ describe Arachni::State::Audit do
|
|
74
74
|
it 'returns the size of the list' do
|
75
75
|
subject << audit_id
|
76
76
|
subject << "#{audit_id}2"
|
77
|
-
subject.size.
|
77
|
+
expect(subject.size).to eq(2)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -92,7 +92,7 @@ describe Arachni::State::Audit do
|
|
92
92
|
subject << "#{audit_id}2"
|
93
93
|
subject.dump( dump_directory )
|
94
94
|
|
95
|
-
subject.
|
95
|
+
expect(subject).to eq(described_class.load( dump_directory ))
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -100,7 +100,7 @@ describe Arachni::State::Audit do
|
|
100
100
|
it 'clears the list' do
|
101
101
|
subject << audit_id
|
102
102
|
subject.clear
|
103
|
-
subject.
|
103
|
+
expect(subject).to be_empty
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -13,7 +13,7 @@ describe Arachni::State::ElementFilter do
|
|
13
13
|
%w(forms links cookies).each do |type|
|
14
14
|
describe "##{type}" do
|
15
15
|
it "returns a #{Arachni::Support::LookUp::HashSet}" do
|
16
|
-
subject.send(type).
|
16
|
+
expect(subject.send(type)).to be_kind_of Arachni::Support::LookUp::HashSet
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -24,7 +24,7 @@ describe Arachni::State::ElementFilter do
|
|
24
24
|
%w(forms links cookies).each do |type|
|
25
25
|
it "includes the amount of seen :#{type}" do
|
26
26
|
subject.send(type) << type
|
27
|
-
statistics[type.to_sym].
|
27
|
+
expect(statistics[type.to_sym]).to eq(subject.send(type).size)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -37,7 +37,7 @@ describe Arachni::State::ElementFilter do
|
|
37
37
|
|
38
38
|
subject.dump( dump_directory )
|
39
39
|
|
40
|
-
File.exist?( "#{dump_directory}/sets" ).
|
40
|
+
expect(File.exist?( "#{dump_directory}/sets" )).to be_truthy
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -49,7 +49,7 @@ describe Arachni::State::ElementFilter do
|
|
49
49
|
|
50
50
|
subject.dump( dump_directory )
|
51
51
|
|
52
|
-
subject.
|
52
|
+
expect(subject).to eq(described_class.load( dump_directory ))
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -57,9 +57,9 @@ describe Arachni::State::ElementFilter do
|
|
57
57
|
%w(forms links cookies).each do |type|
|
58
58
|
it "clears ##{type}" do
|
59
59
|
subject.send(type) << 'stuff'
|
60
|
-
subject.send(type).
|
60
|
+
expect(subject.send(type)).not_to be_empty
|
61
61
|
subject.clear
|
62
|
-
subject.send(type).
|
62
|
+
expect(subject.send(type)).to be_empty
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -15,13 +15,13 @@ describe Arachni::State::Framework::RPC do
|
|
15
15
|
|
16
16
|
describe '#distributed_pages' do
|
17
17
|
it "returns an instance of #{Arachni::Support::LookUp::HashSet}" do
|
18
|
-
subject.distributed_pages.
|
18
|
+
expect(subject.distributed_pages).to be_kind_of Arachni::Support::LookUp::HashSet
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#distributed_elements' do
|
23
23
|
it "returns an instance of #{Set}" do
|
24
|
-
subject.distributed_elements.
|
24
|
+
expect(subject.distributed_elements).to be_kind_of Set
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -30,12 +30,12 @@ describe Arachni::State::Framework::RPC do
|
|
30
30
|
|
31
31
|
it 'includes the size of #distributed_pages' do
|
32
32
|
subject.distributed_pages << url
|
33
|
-
statistics[:distributed_pages].
|
33
|
+
expect(statistics[:distributed_pages]).to eq(subject.distributed_pages.size)
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'includes the size of #distributed_elements' do
|
37
37
|
subject.distributed_elements << url.persistent_hash
|
38
|
-
statistics[:distributed_elements].
|
38
|
+
expect(statistics[:distributed_elements]).to eq(subject.distributed_elements.size)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -44,15 +44,15 @@ describe Arachni::State::Framework::RPC do
|
|
44
44
|
subject.distributed_pages << url
|
45
45
|
subject.dump( dump_directory )
|
46
46
|
|
47
|
-
Marshal.load( IO.read( "#{dump_directory}/distributed_pages" ) ).
|
48
|
-
collection.
|
47
|
+
expect(Marshal.load( IO.read( "#{dump_directory}/distributed_pages" ) ).
|
48
|
+
collection).to eq(Set.new([url.persistent_hash]))
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'stores #distributed_elements to disk' do
|
52
52
|
subject.distributed_elements << url.persistent_hash
|
53
53
|
subject.dump( dump_directory )
|
54
54
|
|
55
|
-
Marshal.load( IO.read( "#{dump_directory}/distributed_elements" ) ).
|
55
|
+
expect(Marshal.load( IO.read( "#{dump_directory}/distributed_elements" ) )).to eq(Set.new([url.persistent_hash]))
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -61,23 +61,23 @@ describe Arachni::State::Framework::RPC do
|
|
61
61
|
subject.distributed_pages << url
|
62
62
|
subject.dump( dump_directory )
|
63
63
|
|
64
|
-
described_class.load( dump_directory ).distributed_pages.
|
65
|
-
collection.
|
64
|
+
expect(described_class.load( dump_directory ).distributed_pages.
|
65
|
+
collection).to eq(Set.new([url.persistent_hash]))
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'loads #distributed_elements from disk' do
|
69
69
|
subject.distributed_elements << url.persistent_hash
|
70
70
|
subject.dump( dump_directory )
|
71
71
|
|
72
|
-
described_class.load( dump_directory ).distributed_elements.
|
73
|
-
|
72
|
+
expect(described_class.load( dump_directory ).distributed_elements).
|
73
|
+
to eq(Set.new([url.persistent_hash]))
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
describe '#clear' do
|
78
78
|
%w(distributed_pages distributed_elements).each do |method|
|
79
79
|
it "clears ##{method}" do
|
80
|
-
subject.send(method).
|
80
|
+
expect(subject.send(method)).to receive(:clear)
|
81
81
|
subject.clear
|
82
82
|
end
|
83
83
|
end
|
@@ -19,12 +19,12 @@ describe Arachni::State::Framework do
|
|
19
19
|
it 'returns the assigned status messages' do
|
20
20
|
message = 'Hey!'
|
21
21
|
subject.set_status_message message
|
22
|
-
subject.status_messages.
|
22
|
+
expect(subject.status_messages).to eq([message])
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'by defaults' do
|
26
26
|
it 'returns an empty array' do
|
27
|
-
subject.status_messages.
|
27
|
+
expect(subject.status_messages).to eq([])
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -34,7 +34,7 @@ describe Arachni::State::Framework do
|
|
34
34
|
message = 'Hey!'
|
35
35
|
subject.set_status_message message
|
36
36
|
subject.set_status_message message
|
37
|
-
subject.status_messages.
|
37
|
+
expect(subject.status_messages).to eq([message])
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -45,7 +45,7 @@ describe Arachni::State::Framework do
|
|
45
45
|
message = 'Hey!'
|
46
46
|
subject.add_status_message message
|
47
47
|
subject.add_status_message message
|
48
|
-
subject.status_messages.
|
48
|
+
expect(subject.status_messages).to eq([message, message])
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -53,7 +53,7 @@ describe Arachni::State::Framework do
|
|
53
53
|
context 'and it exists in #available_status_messages' do
|
54
54
|
it 'pushes the associated message to #status_messages' do
|
55
55
|
subject.add_status_message :suspending
|
56
|
-
subject.status_messages.
|
56
|
+
expect(subject.status_messages).to eq([subject.available_status_messages[:suspending]])
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -69,7 +69,7 @@ describe Arachni::State::Framework do
|
|
69
69
|
it 'uses them to fill in the placeholders' do
|
70
70
|
location = '/blah/stuff.afs'
|
71
71
|
subject.add_status_message :snapshot_location, location
|
72
|
-
subject.status_messages.
|
72
|
+
expect(subject.status_messages).to eq([subject.available_status_messages[:snapshot_location] % location])
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
@@ -80,12 +80,12 @@ describe Arachni::State::Framework do
|
|
80
80
|
let(:statistics) { subject.statistics }
|
81
81
|
|
82
82
|
it 'includes #rpc statistics' do
|
83
|
-
statistics[:rpc].
|
83
|
+
expect(statistics[:rpc]).to eq(subject.rpc.statistics)
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'includes #audited_page_count' do
|
87
87
|
subject.audited_page_count += 1
|
88
|
-
statistics[:audited_page_count].
|
88
|
+
expect(statistics[:audited_page_count]).to eq(subject.audited_page_count)
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'includes amount of #browser_skip_states' do
|
@@ -93,25 +93,25 @@ describe Arachni::State::Framework do
|
|
93
93
|
set << 1 << 2 << 3
|
94
94
|
subject.update_browser_skip_states( set )
|
95
95
|
|
96
|
-
statistics[:browser_states].
|
96
|
+
expect(statistics[:browser_states]).to eq(subject.browser_skip_states.size)
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
100
|
describe '#page_queue_filter' do
|
101
101
|
it "returns an instance of #{Arachni::Support::LookUp::HashSet}" do
|
102
|
-
subject.page_queue_filter.
|
102
|
+
expect(subject.page_queue_filter).to be_kind_of Arachni::Support::LookUp::HashSet
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
106
|
describe '#url_queue_filter' do
|
107
107
|
it "returns an instance of #{Arachni::Support::LookUp::HashSet}" do
|
108
|
-
subject.url_queue_filter.
|
108
|
+
expect(subject.url_queue_filter).to be_kind_of Arachni::Support::LookUp::HashSet
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
112
|
describe '#rpc' do
|
113
113
|
it "returns an instance of #{described_class::RPC}" do
|
114
|
-
subject.rpc.
|
114
|
+
expect(subject.rpc).to be_kind_of described_class::RPC
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
@@ -119,13 +119,13 @@ describe Arachni::State::Framework do
|
|
119
119
|
context 'when an element has already been checked' do
|
120
120
|
it 'returns true' do
|
121
121
|
subject.element_pre_check_filter << element
|
122
|
-
subject.element_checked?( element ).
|
122
|
+
expect(subject.element_checked?( element )).to be_truthy
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
126
|
context 'when an element has not been checked' do
|
127
127
|
it 'returns false' do
|
128
|
-
subject.element_checked?( element ).
|
128
|
+
expect(subject.element_checked?( element )).to be_falsey
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
@@ -133,7 +133,7 @@ describe Arachni::State::Framework do
|
|
133
133
|
describe '#element_checked' do
|
134
134
|
it 'marks an element as checked' do
|
135
135
|
subject.element_checked element
|
136
|
-
subject.element_checked?( element ).
|
136
|
+
expect(subject.element_checked?( element )).to be_truthy
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
@@ -141,13 +141,13 @@ describe Arachni::State::Framework do
|
|
141
141
|
context 'when a page has already been seen' do
|
142
142
|
it 'returns true' do
|
143
143
|
subject.page_queue_filter << page
|
144
|
-
subject.page_seen?( page ).
|
144
|
+
expect(subject.page_seen?( page )).to be_truthy
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
148
|
context 'when a page has not been seen' do
|
149
149
|
it 'returns false' do
|
150
|
-
subject.page_seen?( page ).
|
150
|
+
expect(subject.page_seen?( page )).to be_falsey
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|
@@ -156,13 +156,13 @@ describe Arachni::State::Framework do
|
|
156
156
|
context 'when the given page has been marked as seen' do
|
157
157
|
it 'returns true' do
|
158
158
|
subject.page_seen page
|
159
|
-
subject.page_seen?( page ).
|
159
|
+
expect(subject.page_seen?( page )).to be_truthy
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
163
|
context 'when the given page has not been marked as seen' do
|
164
164
|
it 'returns false' do
|
165
|
-
subject.page_seen?( page ).
|
165
|
+
expect(subject.page_seen?( page )).to be_falsey
|
166
166
|
end
|
167
167
|
end
|
168
168
|
end
|
@@ -171,13 +171,13 @@ describe Arachni::State::Framework do
|
|
171
171
|
context 'when a URL has already been seen' do
|
172
172
|
it 'returns true' do
|
173
173
|
subject.url_queue_filter << url
|
174
|
-
subject.url_seen?( url ).
|
174
|
+
expect(subject.url_seen?( url )).to be_truthy
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
178
|
context 'when a page has not been seen' do
|
179
179
|
it 'returns false' do
|
180
|
-
subject.url_seen?( url ).
|
180
|
+
expect(subject.url_seen?( url )).to be_falsey
|
181
181
|
end
|
182
182
|
end
|
183
183
|
end
|
@@ -186,23 +186,23 @@ describe Arachni::State::Framework do
|
|
186
186
|
context 'when the given URL has been marked as seen' do
|
187
187
|
it 'returns true' do
|
188
188
|
subject.url_seen url
|
189
|
-
subject.url_seen?( url ).
|
189
|
+
expect(subject.url_seen?( url )).to be_truthy
|
190
190
|
end
|
191
191
|
end
|
192
192
|
|
193
193
|
context 'when the given URL has not been marked as seen' do
|
194
194
|
it 'returns false' do
|
195
|
-
subject.url_seen?( url ).
|
195
|
+
expect(subject.url_seen?( url )).to be_falsey
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
200
|
describe '#running=' do
|
201
201
|
it 'sets #running' do
|
202
|
-
subject.running.
|
202
|
+
expect(subject.running).to be_falsey
|
203
203
|
|
204
204
|
subject.running = true
|
205
|
-
subject.running.
|
205
|
+
expect(subject.running).to be_truthy
|
206
206
|
end
|
207
207
|
end
|
208
208
|
|
@@ -210,14 +210,14 @@ describe Arachni::State::Framework do
|
|
210
210
|
context 'when #running is true' do
|
211
211
|
it 'returns true' do
|
212
212
|
subject.running = true
|
213
|
-
subject.
|
213
|
+
expect(subject).to be_running
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
217
217
|
context 'when #running is false' do
|
218
218
|
it 'returns false' do
|
219
219
|
subject.running = false
|
220
|
-
subject.
|
220
|
+
expect(subject).not_to be_running
|
221
221
|
end
|
222
222
|
end
|
223
223
|
end
|
@@ -226,13 +226,13 @@ describe Arachni::State::Framework do
|
|
226
226
|
context 'when the status is set to :scanning' do
|
227
227
|
it 'returns true' do
|
228
228
|
subject.status = :scanning
|
229
|
-
subject.
|
229
|
+
expect(subject).to be_scanning
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
233
|
context 'when the status is not set to :scanning' do
|
234
234
|
it 'returns false' do
|
235
|
-
subject.
|
235
|
+
expect(subject).not_to be_scanning
|
236
236
|
end
|
237
237
|
end
|
238
238
|
end
|
@@ -250,7 +250,7 @@ describe Arachni::State::Framework do
|
|
250
250
|
|
251
251
|
time = Time.now
|
252
252
|
subject.suspend
|
253
|
-
(Time.now - time).
|
253
|
+
expect(Time.now - time).to be > 1
|
254
254
|
t.join
|
255
255
|
end
|
256
256
|
|
@@ -262,7 +262,7 @@ describe Arachni::State::Framework do
|
|
262
262
|
subject.suspend
|
263
263
|
t.join
|
264
264
|
|
265
|
-
subject.status.
|
265
|
+
expect(subject.status).to eq(:suspended)
|
266
266
|
end
|
267
267
|
|
268
268
|
it 'sets the status message to :suspending' do
|
@@ -273,8 +273,9 @@ describe Arachni::State::Framework do
|
|
273
273
|
subject.suspend
|
274
274
|
t.join
|
275
275
|
|
276
|
-
subject.status_messages.
|
276
|
+
expect(subject.status_messages).to eq(
|
277
277
|
[subject.available_status_messages[:suspending]]
|
278
|
+
)
|
278
279
|
end
|
279
280
|
|
280
281
|
it 'returns true' do
|
@@ -282,45 +283,46 @@ describe Arachni::State::Framework do
|
|
282
283
|
sleep 1
|
283
284
|
subject.suspended
|
284
285
|
end
|
285
|
-
subject.suspend.
|
286
|
+
expect(subject.suspend).to be_truthy
|
286
287
|
t.join
|
287
288
|
|
288
|
-
subject.status.
|
289
|
+
expect(subject.status).to eq(:suspended)
|
289
290
|
end
|
290
291
|
end
|
291
292
|
|
292
293
|
context 'when non-blocking' do
|
293
294
|
it 'sets the #status to :suspending' do
|
294
295
|
subject.suspend( false )
|
295
|
-
subject.status.
|
296
|
+
expect(subject.status).to eq(:suspending)
|
296
297
|
end
|
297
298
|
|
298
299
|
it 'sets the status message to :suspending' do
|
299
300
|
subject.suspend( false )
|
300
|
-
subject.status_messages.
|
301
|
+
expect(subject.status_messages).to eq(
|
301
302
|
[subject.available_status_messages[:suspending]]
|
303
|
+
)
|
302
304
|
end
|
303
305
|
|
304
306
|
it 'returns true' do
|
305
|
-
subject.suspend( false ).
|
307
|
+
expect(subject.suspend( false )).to be_truthy
|
306
308
|
end
|
307
309
|
end
|
308
310
|
|
309
311
|
context 'when already #suspending?' do
|
310
312
|
it 'returns false' do
|
311
|
-
subject.suspend( false ).
|
312
|
-
subject.
|
313
|
-
subject.suspend.
|
313
|
+
expect(subject.suspend( false )).to be_truthy
|
314
|
+
expect(subject).to be_suspending
|
315
|
+
expect(subject.suspend).to be_falsey
|
314
316
|
end
|
315
317
|
end
|
316
318
|
|
317
319
|
context 'when already #suspended?' do
|
318
320
|
it 'returns false' do
|
319
|
-
subject.suspend( false ).
|
321
|
+
expect(subject.suspend( false )).to be_truthy
|
320
322
|
subject.suspended
|
321
|
-
subject.
|
323
|
+
expect(subject).to be_suspended
|
322
324
|
|
323
|
-
subject.suspend.
|
325
|
+
expect(subject.suspend).to be_falsey
|
324
326
|
end
|
325
327
|
end
|
326
328
|
|
@@ -352,7 +354,7 @@ describe Arachni::State::Framework do
|
|
352
354
|
describe '#suspended' do
|
353
355
|
it 'sets the #status to :suspended' do
|
354
356
|
subject.suspended
|
355
|
-
subject.status.
|
357
|
+
expect(subject.status).to eq(:suspended)
|
356
358
|
end
|
357
359
|
end
|
358
360
|
|
@@ -360,13 +362,13 @@ describe Arachni::State::Framework do
|
|
360
362
|
context 'when #suspended' do
|
361
363
|
it 'returns true' do
|
362
364
|
subject.suspended
|
363
|
-
subject.
|
365
|
+
expect(subject).to be_suspended
|
364
366
|
end
|
365
367
|
end
|
366
368
|
|
367
369
|
context 'when not #suspended' do
|
368
370
|
it 'returns false' do
|
369
|
-
subject.
|
371
|
+
expect(subject).not_to be_suspended
|
370
372
|
end
|
371
373
|
end
|
372
374
|
end
|
@@ -377,17 +379,17 @@ describe Arachni::State::Framework do
|
|
377
379
|
context 'while suspending' do
|
378
380
|
it 'returns true' do
|
379
381
|
subject.suspend( false )
|
380
|
-
subject.
|
382
|
+
expect(subject).to be_suspending
|
381
383
|
end
|
382
384
|
end
|
383
385
|
|
384
386
|
context 'while not suspending' do
|
385
387
|
it 'returns false' do
|
386
|
-
subject.
|
388
|
+
expect(subject).not_to be_suspending
|
387
389
|
|
388
390
|
subject.suspend( false )
|
389
391
|
subject.suspended
|
390
|
-
subject.
|
392
|
+
expect(subject).not_to be_suspending
|
391
393
|
end
|
392
394
|
end
|
393
395
|
end
|
@@ -398,17 +400,17 @@ describe Arachni::State::Framework do
|
|
398
400
|
context 'when a #suspend signal is in place' do
|
399
401
|
it 'returns true' do
|
400
402
|
subject.suspend( false )
|
401
|
-
subject.
|
403
|
+
expect(subject).to be_suspend
|
402
404
|
end
|
403
405
|
end
|
404
406
|
|
405
407
|
context 'when a #suspend signal is not in place' do
|
406
408
|
it 'returns false' do
|
407
|
-
subject.
|
409
|
+
expect(subject).not_to be_suspend
|
408
410
|
|
409
411
|
subject.suspend( false )
|
410
412
|
subject.suspended
|
411
|
-
subject.
|
413
|
+
expect(subject).not_to be_suspend
|
412
414
|
end
|
413
415
|
end
|
414
416
|
end
|
@@ -426,7 +428,7 @@ describe Arachni::State::Framework do
|
|
426
428
|
|
427
429
|
time = Time.now
|
428
430
|
subject.abort
|
429
|
-
(Time.now - time).
|
431
|
+
expect(Time.now - time).to be > 1
|
430
432
|
t.join
|
431
433
|
end
|
432
434
|
|
@@ -438,7 +440,7 @@ describe Arachni::State::Framework do
|
|
438
440
|
subject.abort
|
439
441
|
t.join
|
440
442
|
|
441
|
-
subject.status.
|
443
|
+
expect(subject.status).to eq(:aborted)
|
442
444
|
end
|
443
445
|
|
444
446
|
it 'sets the status message to :aborting' do
|
@@ -449,8 +451,9 @@ describe Arachni::State::Framework do
|
|
449
451
|
subject.abort
|
450
452
|
t.join
|
451
453
|
|
452
|
-
subject.status_messages.
|
454
|
+
expect(subject.status_messages).to eq(
|
453
455
|
[subject.available_status_messages[:aborting]]
|
456
|
+
)
|
454
457
|
end
|
455
458
|
|
456
459
|
it 'returns true' do
|
@@ -458,45 +461,46 @@ describe Arachni::State::Framework do
|
|
458
461
|
sleep 1
|
459
462
|
subject.aborted
|
460
463
|
end
|
461
|
-
subject.abort.
|
464
|
+
expect(subject.abort).to be_truthy
|
462
465
|
t.join
|
463
466
|
|
464
|
-
subject.status.
|
467
|
+
expect(subject.status).to eq(:aborted)
|
465
468
|
end
|
466
469
|
end
|
467
470
|
|
468
471
|
context 'when non-blocking' do
|
469
472
|
it 'sets the #status to :aborting' do
|
470
473
|
subject.abort( false )
|
471
|
-
subject.status.
|
474
|
+
expect(subject.status).to eq(:aborting)
|
472
475
|
end
|
473
476
|
|
474
477
|
it 'sets the status message to :aborting' do
|
475
478
|
subject.abort( false )
|
476
|
-
subject.status_messages.
|
479
|
+
expect(subject.status_messages).to eq(
|
477
480
|
[subject.available_status_messages[:aborting]]
|
481
|
+
)
|
478
482
|
end
|
479
483
|
|
480
484
|
it 'returns true' do
|
481
|
-
subject.abort( false ).
|
485
|
+
expect(subject.abort( false )).to be_truthy
|
482
486
|
end
|
483
487
|
end
|
484
488
|
|
485
489
|
context 'when already #aborting?' do
|
486
490
|
it 'returns false' do
|
487
|
-
subject.abort( false ).
|
488
|
-
subject.
|
489
|
-
subject.abort.
|
491
|
+
expect(subject.abort( false )).to be_truthy
|
492
|
+
expect(subject).to be_aborting
|
493
|
+
expect(subject.abort).to be_falsey
|
490
494
|
end
|
491
495
|
end
|
492
496
|
|
493
497
|
context 'when already #aborted?' do
|
494
498
|
it 'returns false' do
|
495
|
-
subject.abort( false ).
|
499
|
+
expect(subject.abort( false )).to be_truthy
|
496
500
|
subject.aborted
|
497
|
-
subject.
|
501
|
+
expect(subject).to be_aborted
|
498
502
|
|
499
|
-
subject.abort.
|
503
|
+
expect(subject.abort).to be_falsey
|
500
504
|
end
|
501
505
|
end
|
502
506
|
end
|
@@ -512,13 +516,13 @@ describe Arachni::State::Framework do
|
|
512
516
|
context 'when #status is :done' do
|
513
517
|
it 'returns true' do
|
514
518
|
subject.status = :done
|
515
|
-
subject.
|
519
|
+
expect(subject).to be_done
|
516
520
|
end
|
517
521
|
end
|
518
522
|
|
519
523
|
context 'when not done' do
|
520
524
|
it 'returns false' do
|
521
|
-
subject.
|
525
|
+
expect(subject).not_to be_done
|
522
526
|
end
|
523
527
|
end
|
524
528
|
end
|
@@ -526,7 +530,7 @@ describe Arachni::State::Framework do
|
|
526
530
|
describe '#aborted' do
|
527
531
|
it 'sets the #status to :aborted' do
|
528
532
|
subject.aborted
|
529
|
-
subject.status.
|
533
|
+
expect(subject.status).to eq(:aborted)
|
530
534
|
end
|
531
535
|
end
|
532
536
|
|
@@ -534,13 +538,13 @@ describe Arachni::State::Framework do
|
|
534
538
|
context 'when #aborted' do
|
535
539
|
it 'returns true' do
|
536
540
|
subject.aborted
|
537
|
-
subject.
|
541
|
+
expect(subject).to be_aborted
|
538
542
|
end
|
539
543
|
end
|
540
544
|
|
541
545
|
context 'when not #aborted' do
|
542
546
|
it 'returns false' do
|
543
|
-
subject.
|
547
|
+
expect(subject).not_to be_aborted
|
544
548
|
end
|
545
549
|
end
|
546
550
|
end
|
@@ -551,17 +555,17 @@ describe Arachni::State::Framework do
|
|
551
555
|
context 'while aborting' do
|
552
556
|
it 'returns true' do
|
553
557
|
subject.abort( false )
|
554
|
-
subject.
|
558
|
+
expect(subject).to be_aborting
|
555
559
|
end
|
556
560
|
end
|
557
561
|
|
558
562
|
context 'while not aborting' do
|
559
563
|
it 'returns false' do
|
560
|
-
subject.
|
564
|
+
expect(subject).not_to be_aborting
|
561
565
|
|
562
566
|
subject.abort( false )
|
563
567
|
subject.aborted
|
564
|
-
subject.
|
568
|
+
expect(subject).not_to be_aborting
|
565
569
|
end
|
566
570
|
end
|
567
571
|
end
|
@@ -572,17 +576,17 @@ describe Arachni::State::Framework do
|
|
572
576
|
context 'when a #abort signal is in place' do
|
573
577
|
it 'returns true' do
|
574
578
|
subject.abort( false )
|
575
|
-
subject.
|
579
|
+
expect(subject).to be_abort
|
576
580
|
end
|
577
581
|
end
|
578
582
|
|
579
583
|
context 'when a #abort signal is not in place' do
|
580
584
|
it 'returns false' do
|
581
|
-
subject.
|
585
|
+
expect(subject).not_to be_abort
|
582
586
|
|
583
587
|
subject.abort( false )
|
584
588
|
subject.aborted
|
585
|
-
subject.
|
589
|
+
expect(subject).not_to be_abort
|
586
590
|
end
|
587
591
|
end
|
588
592
|
end
|
@@ -600,7 +604,7 @@ describe Arachni::State::Framework do
|
|
600
604
|
|
601
605
|
time = Time.now
|
602
606
|
subject.pause :a_caller
|
603
|
-
(Time.now - time).
|
607
|
+
expect(Time.now - time).to be > 1
|
604
608
|
t.join
|
605
609
|
end
|
606
610
|
|
@@ -612,7 +616,7 @@ describe Arachni::State::Framework do
|
|
612
616
|
subject.pause :a_caller
|
613
617
|
t.join
|
614
618
|
|
615
|
-
subject.status.
|
619
|
+
expect(subject.status).to eq(:paused)
|
616
620
|
end
|
617
621
|
|
618
622
|
it 'returns true' do
|
@@ -620,21 +624,21 @@ describe Arachni::State::Framework do
|
|
620
624
|
sleep 1
|
621
625
|
subject.paused
|
622
626
|
end
|
623
|
-
subject.pause( :a_caller ).
|
627
|
+
expect(subject.pause( :a_caller )).to be_truthy
|
624
628
|
t.join
|
625
629
|
|
626
|
-
subject.status.
|
630
|
+
expect(subject.status).to eq(:paused)
|
627
631
|
end
|
628
632
|
end
|
629
633
|
|
630
634
|
context 'when non-blocking' do
|
631
635
|
it 'sets the #status to :pausing' do
|
632
636
|
subject.pause( :a_caller, false )
|
633
|
-
subject.status.
|
637
|
+
expect(subject.status).to eq(:pausing)
|
634
638
|
end
|
635
639
|
|
636
640
|
it 'returns true' do
|
637
|
-
subject.pause( :a_caller, false ).
|
641
|
+
expect(subject.pause( :a_caller, false )).to be_truthy
|
638
642
|
end
|
639
643
|
end
|
640
644
|
end
|
@@ -650,8 +654,8 @@ describe Arachni::State::Framework do
|
|
650
654
|
|
651
655
|
time = Time.now
|
652
656
|
subject.pause :a_caller, false
|
653
|
-
subject.status.
|
654
|
-
(Time.now - time).
|
657
|
+
expect(subject.status).to eq(:paused)
|
658
|
+
expect(Time.now - time).to be < 1
|
655
659
|
t.join
|
656
660
|
end
|
657
661
|
end
|
@@ -660,7 +664,7 @@ describe Arachni::State::Framework do
|
|
660
664
|
describe '#paused' do
|
661
665
|
it 'sets the #status to :paused' do
|
662
666
|
subject.paused
|
663
|
-
subject.status.
|
667
|
+
expect(subject.status).to eq(:paused)
|
664
668
|
end
|
665
669
|
end
|
666
670
|
|
@@ -670,17 +674,17 @@ describe Arachni::State::Framework do
|
|
670
674
|
context 'while pausing' do
|
671
675
|
it 'returns true' do
|
672
676
|
subject.pause( :caller, false )
|
673
|
-
subject.
|
677
|
+
expect(subject).to be_pausing
|
674
678
|
end
|
675
679
|
end
|
676
680
|
|
677
681
|
context 'while not pausing' do
|
678
682
|
it 'returns false' do
|
679
|
-
subject.
|
683
|
+
expect(subject).not_to be_pausing
|
680
684
|
|
681
685
|
subject.pause( :caller, false )
|
682
686
|
subject.paused
|
683
|
-
subject.
|
687
|
+
expect(subject).not_to be_pausing
|
684
688
|
end
|
685
689
|
end
|
686
690
|
end
|
@@ -689,18 +693,18 @@ describe Arachni::State::Framework do
|
|
689
693
|
context 'when a #pause signal is in place' do
|
690
694
|
it 'returns true' do
|
691
695
|
subject.pause( :caller, false )
|
692
|
-
subject.
|
696
|
+
expect(subject).to be_pause
|
693
697
|
end
|
694
698
|
end
|
695
699
|
|
696
700
|
context 'when a #pause signal is not in place' do
|
697
701
|
it 'returns false' do
|
698
|
-
subject.
|
702
|
+
expect(subject).not_to be_pause
|
699
703
|
|
700
704
|
subject.pause( :caller, false )
|
701
705
|
subject.paused
|
702
706
|
subject.resume( :caller )
|
703
|
-
subject.
|
707
|
+
expect(subject).not_to be_pause
|
704
708
|
end
|
705
709
|
end
|
706
710
|
end
|
@@ -710,12 +714,12 @@ describe Arachni::State::Framework do
|
|
710
714
|
|
711
715
|
it 'removes a #pause signal' do
|
712
716
|
subject.pause( :caller, false )
|
713
|
-
subject.pause_signals.
|
717
|
+
expect(subject.pause_signals).to include :caller
|
714
718
|
|
715
719
|
subject.resume( :caller )
|
716
720
|
|
717
|
-
subject.pause_signals.
|
718
|
-
subject.
|
721
|
+
expect(subject.pause_signals).not_to include :caller
|
722
|
+
expect(subject).not_to be_paused
|
719
723
|
end
|
720
724
|
|
721
725
|
it 'operates on a per-caller basis' do
|
@@ -726,10 +730,10 @@ describe Arachni::State::Framework do
|
|
726
730
|
subject.pause( :caller2, false )
|
727
731
|
|
728
732
|
subject.resume( :caller )
|
729
|
-
subject.
|
733
|
+
expect(subject).to be_paused
|
730
734
|
|
731
735
|
subject.resume( :caller2 )
|
732
|
-
subject.
|
736
|
+
expect(subject).not_to be_paused
|
733
737
|
end
|
734
738
|
|
735
739
|
it 'restores the previous #status' do
|
@@ -747,13 +751,13 @@ describe Arachni::State::Framework do
|
|
747
751
|
it '#pause? returns false' do
|
748
752
|
subject.pause( :caller, false )
|
749
753
|
subject.resume( :caller )
|
750
|
-
subject.
|
754
|
+
expect(subject).not_to be_pause
|
751
755
|
end
|
752
756
|
|
753
757
|
it '#paused? returns false' do
|
754
758
|
subject.pause( :caller, false )
|
755
759
|
subject.resume( :caller )
|
756
|
-
subject.
|
760
|
+
expect(subject).not_to be_paused
|
757
761
|
end
|
758
762
|
end
|
759
763
|
|
@@ -762,7 +766,7 @@ describe Arachni::State::Framework do
|
|
762
766
|
subject.pause( :caller, false )
|
763
767
|
subject.paused
|
764
768
|
|
765
|
-
subject.resume( :caller ).
|
769
|
+
expect(subject.resume( :caller )).to be_truthy
|
766
770
|
end
|
767
771
|
end
|
768
772
|
|
@@ -772,32 +776,32 @@ describe Arachni::State::Framework do
|
|
772
776
|
subject.pause( :caller2, false )
|
773
777
|
subject.paused
|
774
778
|
|
775
|
-
subject.resume( :caller ).
|
779
|
+
expect(subject.resume( :caller )).to be_falsey
|
776
780
|
end
|
777
781
|
end
|
778
782
|
end
|
779
783
|
|
780
784
|
describe '#browser_skip_states' do
|
781
785
|
it "returns a #{Arachni::Support::LookUp::HashSet}" do
|
782
|
-
subject.browser_skip_states.
|
786
|
+
expect(subject.browser_skip_states).to be_kind_of Arachni::Support::LookUp::HashSet
|
783
787
|
end
|
784
788
|
end
|
785
789
|
|
786
790
|
describe '#update_browser_skip_states' do
|
787
791
|
it 'updates #browser_skip_states' do
|
788
|
-
subject.browser_skip_states.
|
792
|
+
expect(subject.browser_skip_states).to be_empty
|
789
793
|
|
790
794
|
set = Arachni::Support::LookUp::HashSet.new
|
791
795
|
set << 1 << 2 << 3
|
792
796
|
subject.update_browser_skip_states( set )
|
793
|
-
subject.browser_skip_states.
|
797
|
+
expect(subject.browser_skip_states).to eq(set)
|
794
798
|
end
|
795
799
|
end
|
796
800
|
|
797
801
|
describe '#dump' do
|
798
802
|
it 'stores #rpc to disk' do
|
799
803
|
subject.dump( dump_directory )
|
800
|
-
described_class::RPC.load( "#{dump_directory}/rpc" ).
|
804
|
+
expect(described_class::RPC.load( "#{dump_directory}/rpc" )).to be_kind_of described_class::RPC
|
801
805
|
end
|
802
806
|
|
803
807
|
it 'stores #page_queue_filter to disk' do
|
@@ -805,8 +809,8 @@ describe Arachni::State::Framework do
|
|
805
809
|
|
806
810
|
subject.dump( dump_directory )
|
807
811
|
|
808
|
-
Marshal.load( IO.read( "#{dump_directory}/page_queue_filter" ) ).
|
809
|
-
collection.
|
812
|
+
expect(Marshal.load( IO.read( "#{dump_directory}/page_queue_filter" ) ).
|
813
|
+
collection).to eq(Set.new([page.persistent_hash]))
|
810
814
|
end
|
811
815
|
|
812
816
|
it 'stores #url_queue_filter to disk' do
|
@@ -814,8 +818,8 @@ describe Arachni::State::Framework do
|
|
814
818
|
|
815
819
|
subject.dump( dump_directory )
|
816
820
|
|
817
|
-
Marshal.load( IO.read( "#{dump_directory}/url_queue_filter" ) ).
|
818
|
-
collection.
|
821
|
+
expect(Marshal.load( IO.read( "#{dump_directory}/url_queue_filter" ) ).
|
822
|
+
collection).to eq(Set.new([url.persistent_hash]))
|
819
823
|
end
|
820
824
|
|
821
825
|
it 'stores #browser_skip_states to disk' do
|
@@ -827,14 +831,14 @@ describe Arachni::State::Framework do
|
|
827
831
|
set = Arachni::Support::LookUp::HashSet.new( hasher: :persistent_hash)
|
828
832
|
set << stuff
|
829
833
|
|
830
|
-
Marshal.load( IO.read( "#{dump_directory}/browser_skip_states" ) ).
|
834
|
+
expect(Marshal.load( IO.read( "#{dump_directory}/browser_skip_states" ) )).to eq(set)
|
831
835
|
end
|
832
836
|
end
|
833
837
|
|
834
838
|
describe '.load' do
|
835
839
|
it 'loads #rpc from disk' do
|
836
840
|
subject.dump( dump_directory )
|
837
|
-
described_class.load( dump_directory ).rpc.
|
841
|
+
expect(described_class.load( dump_directory ).rpc).to be_kind_of described_class::RPC
|
838
842
|
end
|
839
843
|
|
840
844
|
it 'loads #element_pre_check_filter from disk' do
|
@@ -842,8 +846,8 @@ describe Arachni::State::Framework do
|
|
842
846
|
|
843
847
|
subject.dump( dump_directory )
|
844
848
|
|
845
|
-
described_class.load( dump_directory ).element_pre_check_filter.
|
846
|
-
collection.
|
849
|
+
expect(described_class.load( dump_directory ).element_pre_check_filter.
|
850
|
+
collection).to eq(Set.new([element.coverage_hash]))
|
847
851
|
end
|
848
852
|
|
849
853
|
it 'loads #page_queue_filter from disk' do
|
@@ -851,18 +855,18 @@ describe Arachni::State::Framework do
|
|
851
855
|
|
852
856
|
subject.dump( dump_directory )
|
853
857
|
|
854
|
-
described_class.load( dump_directory ).page_queue_filter.
|
855
|
-
collection.
|
858
|
+
expect(described_class.load( dump_directory ).page_queue_filter.
|
859
|
+
collection).to eq(Set.new([page.persistent_hash]))
|
856
860
|
end
|
857
861
|
|
858
862
|
it 'loads #url_queue_filter from disk' do
|
859
863
|
subject.url_queue_filter << url
|
860
|
-
subject.url_queue_filter.
|
864
|
+
expect(subject.url_queue_filter).to be_any
|
861
865
|
|
862
866
|
subject.dump( dump_directory )
|
863
867
|
|
864
|
-
described_class.load( dump_directory ).url_queue_filter.
|
865
|
-
collection.
|
868
|
+
expect(described_class.load( dump_directory ).url_queue_filter.
|
869
|
+
collection).to eq(Set.new([url.persistent_hash]))
|
866
870
|
end
|
867
871
|
|
868
872
|
it 'loads #browser_skip_states from disk' do
|
@@ -873,7 +877,7 @@ describe Arachni::State::Framework do
|
|
873
877
|
|
874
878
|
set = Arachni::Support::LookUp::HashSet.new( hasher: :persistent_hash)
|
875
879
|
set << stuff
|
876
|
-
described_class.load( dump_directory ).browser_skip_states.
|
880
|
+
expect(described_class.load( dump_directory ).browser_skip_states).to eq(set)
|
877
881
|
end
|
878
882
|
end
|
879
883
|
|
@@ -881,7 +885,7 @@ describe Arachni::State::Framework do
|
|
881
885
|
%w(rpc element_pre_check_filter browser_skip_states page_queue_filter
|
882
886
|
url_queue_filter).each do |method|
|
883
887
|
it "clears ##{method}" do
|
884
|
-
subject.send(method).
|
888
|
+
expect(subject.send(method)).to receive(:clear)
|
885
889
|
subject.clear
|
886
890
|
end
|
887
891
|
end
|
@@ -889,7 +893,7 @@ describe Arachni::State::Framework do
|
|
889
893
|
it 'sets #running to false' do
|
890
894
|
subject.running = true
|
891
895
|
subject.clear
|
892
|
-
subject.
|
896
|
+
expect(subject).not_to be_running
|
893
897
|
end
|
894
898
|
end
|
895
899
|
end
|