arachni 1.2.1 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -36,12 +36,12 @@ describe Arachni::Support::Database::Queue do
|
|
36
36
|
consumed = []
|
37
37
|
consumed << poped.pop while !poped.empty?
|
38
38
|
|
39
|
-
consumed.sort.
|
39
|
+
expect(consumed.sort).to eq((0...entries).map { |i| 'a' * i })
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "#{described_class}::DEFAULT_MAX_BUFFER_SIZE" do
|
43
43
|
it 'returns 100' do
|
44
|
-
described_class::DEFAULT_MAX_BUFFER_SIZE.
|
44
|
+
expect(described_class::DEFAULT_MAX_BUFFER_SIZE).to eq(100)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -50,7 +50,7 @@ describe Arachni::Support::Database::Queue do
|
|
50
50
|
subject << 1
|
51
51
|
subject << 2
|
52
52
|
|
53
|
-
subject.buffer.
|
53
|
+
expect(subject.buffer).to eq([1, 2])
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -60,9 +60,9 @@ describe Arachni::Support::Database::Queue do
|
|
60
60
|
subject << 1
|
61
61
|
subject << 2
|
62
62
|
|
63
|
-
subject.disk.size.
|
63
|
+
expect(subject.disk.size).to eq(2)
|
64
64
|
subject.disk.each do |path|
|
65
|
-
File.exists?( path ).
|
65
|
+
expect(File.exists?( path )).to be_truthy
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -70,7 +70,7 @@ describe Arachni::Support::Database::Queue do
|
|
70
70
|
describe '#max_buffer_size' do
|
71
71
|
context 'by default' do
|
72
72
|
it "returns #{described_class}::DEFAULT_MAX_BUFFER_SIZE" do
|
73
|
-
subject.max_buffer_size.
|
73
|
+
expect(subject.max_buffer_size).to eq(described_class::DEFAULT_MAX_BUFFER_SIZE)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -78,21 +78,21 @@ describe Arachni::Support::Database::Queue do
|
|
78
78
|
describe '#max_buffer_size=' do
|
79
79
|
it 'sets #max_buffer_size' do
|
80
80
|
subject.max_buffer_size = 10
|
81
|
-
subject.max_buffer_size.
|
81
|
+
expect(subject.max_buffer_size).to eq(10)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
describe '#empty?' do
|
86
86
|
context 'when the queue is empty' do
|
87
87
|
it 'returns true' do
|
88
|
-
subject.empty
|
88
|
+
expect(subject.empty?).to be_truthy
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
92
|
context 'when the queue is not empty' do
|
93
93
|
it 'returns false' do
|
94
94
|
subject << :stuff
|
95
|
-
subject.empty
|
95
|
+
expect(subject.empty?).to be_falsey
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
@@ -104,7 +104,7 @@ describe Arachni::Support::Database::Queue do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
sample_size.times do |i|
|
107
|
-
subject.pop.
|
107
|
+
expect(subject.pop).to eq("stuff #{i}")
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
@@ -112,14 +112,14 @@ describe Arachni::Support::Database::Queue do
|
|
112
112
|
describe '#push' do
|
113
113
|
it 'pushes an object' do
|
114
114
|
subject.push :stuff
|
115
|
-
subject.pop.
|
115
|
+
expect(subject.pop).to eq(:stuff)
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
119
|
describe '#enq' do
|
120
120
|
it 'pushes an object' do
|
121
121
|
subject.enq :stuff
|
122
|
-
subject.pop.
|
122
|
+
expect(subject.pop).to eq(:stuff)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -130,7 +130,7 @@ describe Arachni::Support::Database::Queue do
|
|
130
130
|
end
|
131
131
|
|
132
132
|
sample_size.times do |i|
|
133
|
-
subject.pop.
|
133
|
+
expect(subject.pop).to eq("stuff #{i}")
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -142,76 +142,76 @@ describe Arachni::Support::Database::Queue do
|
|
142
142
|
Thread.new { subject << :stuff }
|
143
143
|
t.join
|
144
144
|
|
145
|
-
val.
|
145
|
+
expect(val).to eq(:stuff)
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
149
|
describe '#deq' do
|
150
150
|
it 'removes an object' do
|
151
151
|
subject << :stuff
|
152
|
-
subject.deq.
|
152
|
+
expect(subject.deq).to eq(:stuff)
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
156
|
describe '#shift' do
|
157
157
|
it 'removes an object' do
|
158
158
|
subject << :stuff
|
159
|
-
subject.shift.
|
159
|
+
expect(subject.shift).to eq(:stuff)
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
163
|
describe '#size' do
|
164
164
|
it 'returns the size of the queue' do
|
165
165
|
sample_size.times { |i| subject << i }
|
166
|
-
subject.size.
|
166
|
+
expect(subject.size).to eq(sample_size)
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
170
|
describe '#free_buffer_size' do
|
171
171
|
it 'returns the size of the available buffer' do
|
172
172
|
(subject.max_buffer_size - 2).times { |i| subject << i }
|
173
|
-
subject.free_buffer_size.
|
173
|
+
expect(subject.free_buffer_size).to eq(2)
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
177
177
|
describe '#buffer_size' do
|
178
178
|
it 'returns the size of the in-memory entries' do
|
179
|
-
subject.buffer_size.
|
179
|
+
expect(subject.buffer_size).to eq(0)
|
180
180
|
|
181
181
|
(subject.max_buffer_size - 1).times { |i| subject << i }
|
182
|
-
subject.buffer_size.
|
182
|
+
expect(subject.buffer_size).to eq(subject.max_buffer_size - 1)
|
183
183
|
|
184
184
|
subject.clear
|
185
185
|
|
186
186
|
sample_size.times { |i| subject << i }
|
187
|
-
subject.buffer_size.
|
187
|
+
expect(subject.buffer_size).to eq(subject.max_buffer_size)
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
191
191
|
describe '#disk_size' do
|
192
192
|
it 'returns the size of the disk entries' do
|
193
|
-
subject.buffer_size.
|
193
|
+
expect(subject.buffer_size).to eq(0)
|
194
194
|
|
195
195
|
(subject.max_buffer_size + 1).times { |i| subject << i }
|
196
|
-
subject.disk_size.
|
196
|
+
expect(subject.disk_size).to eq(1)
|
197
197
|
|
198
198
|
subject.clear
|
199
199
|
|
200
200
|
sample_size.times { |i| subject << i }
|
201
|
-
subject.disk_size.
|
201
|
+
expect(subject.disk_size).to eq(sample_size - subject.max_buffer_size)
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
205
205
|
describe '#num_waiting' do
|
206
206
|
it 'returns the amount of threads waiting to pop' do
|
207
|
-
subject.num_waiting.
|
207
|
+
expect(subject.num_waiting).to eq(0)
|
208
208
|
|
209
209
|
2.times do
|
210
210
|
Thread.new { subject.pop }
|
211
211
|
end
|
212
212
|
sleep 0.1
|
213
213
|
|
214
|
-
subject.num_waiting.
|
214
|
+
expect(subject.num_waiting).to eq(2)
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
@@ -219,7 +219,7 @@ describe Arachni::Support::Database::Queue do
|
|
219
219
|
it 'empties the queue' do
|
220
220
|
sample_size.times { |i| subject << i }
|
221
221
|
subject.clear
|
222
|
-
subject.size.
|
222
|
+
expect(subject.size).to eq(0)
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
@@ -11,8 +11,8 @@ describe Arachni::Support::LookUp::HashSet do
|
|
11
11
|
new << 'test2'
|
12
12
|
|
13
13
|
subject.merge new
|
14
|
-
subject.
|
15
|
-
subject.
|
14
|
+
expect(subject).to include 'test'
|
15
|
+
expect(subject).to include 'test2'
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -24,8 +24,8 @@ describe Arachni::Support::LookUp::HashSet do
|
|
24
24
|
new << 'test2'
|
25
25
|
|
26
26
|
subject.replace new
|
27
|
-
subject.
|
28
|
-
subject.
|
27
|
+
expect(subject).to include 'test2'
|
28
|
+
expect(subject).not_to include 'test'
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -42,13 +42,13 @@ describe Arachni::Support::LookUp::HashSet do
|
|
42
42
|
|
43
43
|
context 'when the set is a superset of another set' do
|
44
44
|
it 'returns true' do
|
45
|
-
new.
|
45
|
+
expect(new).to be_superset subject
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
context 'when the set is not a superset of another set' do
|
50
50
|
it 'returns true' do
|
51
|
-
subject.
|
51
|
+
expect(subject).to be_superset new
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -66,13 +66,13 @@ describe Arachni::Support::LookUp::HashSet do
|
|
66
66
|
|
67
67
|
context 'when the set is a subset of another set' do
|
68
68
|
it 'returns true' do
|
69
|
-
subject.
|
69
|
+
expect(subject).to be_subset new
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
73
|
context 'when the set is not a subset of another set' do
|
74
74
|
it 'returns true' do
|
75
|
-
new.
|
75
|
+
expect(new).to be_subset subject
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -17,10 +17,10 @@ describe Arachni::Support::LookUp::Moolb do
|
|
17
17
|
lu << i
|
18
18
|
end
|
19
19
|
|
20
|
-
lu.include?( 0 ).
|
20
|
+
expect(lu.include?( 0 )).to be_falsey
|
21
21
|
|
22
22
|
1.upto( 3 ) do |i|
|
23
|
-
lu.include?( i ).
|
23
|
+
expect(lu.include?( i )).to be_truthy
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -34,7 +34,7 @@ describe Arachni::Support::LookUp::Moolb do
|
|
34
34
|
lu << i
|
35
35
|
end
|
36
36
|
|
37
|
-
lu.size.
|
37
|
+
expect(lu.size).to eq(3)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -23,11 +23,11 @@ describe Arachni::Support::Mixins::Observable do
|
|
23
23
|
subject.my_event { called = true }
|
24
24
|
subject.notify :my_event
|
25
25
|
|
26
|
-
called.
|
26
|
+
expect(called).to be_truthy
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'returns self' do
|
30
|
-
subject.my_event { }.
|
30
|
+
expect(subject.my_event { }).to eq(subject)
|
31
31
|
end
|
32
32
|
|
33
33
|
context 'when no block is given' do
|
@@ -46,7 +46,7 @@ describe Arachni::Support::Mixins::Observable do
|
|
46
46
|
end
|
47
47
|
subject.notify :my_other_event, sent_args
|
48
48
|
|
49
|
-
received_args.
|
49
|
+
expect(received_args).to eq(sent_args)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -60,7 +60,7 @@ describe Arachni::Support::Mixins::Observable do
|
|
60
60
|
describe '#notify' do
|
61
61
|
it 'returns nil' do
|
62
62
|
subject.my_event { }
|
63
|
-
subject.notify( :my_event ).
|
63
|
+
expect(subject.notify( :my_event )).to be_nil
|
64
64
|
end
|
65
65
|
|
66
66
|
context 'when a callback raises an exception' do
|
@@ -73,7 +73,7 @@ describe Arachni::Support::Mixins::Observable do
|
|
73
73
|
|
74
74
|
subject.notify( :my_event )
|
75
75
|
|
76
|
-
called.
|
76
|
+
expect(called).to eq([1, 2, 3])
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -87,7 +87,7 @@ describe Arachni::Support::Mixins::Observable do
|
|
87
87
|
|
88
88
|
subject.notify :my_event
|
89
89
|
|
90
|
-
called.
|
90
|
+
expect(called).to be_falsey
|
91
91
|
|
92
92
|
end
|
93
93
|
end
|
@@ -26,19 +26,19 @@ describe Arachni::Support::Signature do
|
|
26
26
|
|
27
27
|
s = described_class.new( seed1, threshold: 0.01 )
|
28
28
|
s1 = described_class.new( seed2 )
|
29
|
-
s.
|
29
|
+
expect(s).not_to be_similar s1
|
30
30
|
|
31
31
|
s = described_class.new( seed1, threshold: 0.1 )
|
32
32
|
s1 = described_class.new( seed2 )
|
33
|
-
s.
|
33
|
+
expect(s).not_to be_similar s1
|
34
34
|
|
35
35
|
s = described_class.new( seed1, threshold: 0.7 )
|
36
36
|
s1 = described_class.new( seed2 )
|
37
|
-
s.
|
37
|
+
expect(s).to be_similar s1
|
38
38
|
|
39
39
|
s = described_class.new( seed1, threshold: 1 )
|
40
40
|
s1 = described_class.new( seed2 )
|
41
|
-
s.
|
41
|
+
expect(s).to be_similar s1
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'when not a number' do
|
@@ -54,7 +54,7 @@ describe Arachni::Support::Signature do
|
|
54
54
|
|
55
55
|
describe '#refine' do
|
56
56
|
it 'removes noise from the signature' do
|
57
|
-
string_with_noise.
|
57
|
+
expect(string_with_noise).not_to eq(string_with_noise)
|
58
58
|
|
59
59
|
signature1 = described_class.new( string_with_noise )
|
60
60
|
|
@@ -63,18 +63,18 @@ describe Arachni::Support::Signature do
|
|
63
63
|
signature2 = described_class.new( string_with_noise )
|
64
64
|
10.times{ signature2 = signature2.refine( string_with_noise ) }
|
65
65
|
|
66
|
-
signature1.
|
66
|
+
expect(signature1).to eq(signature2)
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'returns a new signature instance' do
|
70
70
|
signature1 = described_class.new( string_with_noise )
|
71
|
-
signature1.refine( string_with_noise ).object_id.
|
71
|
+
expect(signature1.refine( string_with_noise ).object_id).not_to eq(signature1.object_id)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
75
|
describe '#refine!' do
|
76
76
|
it 'destructively removes noise from the signature' do
|
77
|
-
string_with_noise.
|
77
|
+
expect(string_with_noise).not_to eq(string_with_noise)
|
78
78
|
|
79
79
|
signature1 = described_class.new( string_with_noise )
|
80
80
|
10.times{ signature1.refine!( string_with_noise ) }
|
@@ -82,12 +82,12 @@ describe Arachni::Support::Signature do
|
|
82
82
|
signature2 = described_class.new( string_with_noise )
|
83
83
|
10.times{ signature2.refine!( string_with_noise ) }
|
84
84
|
|
85
|
-
signature1.
|
85
|
+
expect(signature1).to eq(signature2)
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'returns self' do
|
89
89
|
signature = described_class.new( string_with_noise )
|
90
|
-
signature.refine!( string_with_noise ).object_id.
|
90
|
+
expect(signature.refine!( string_with_noise ).object_id).to eq(signature.object_id)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -98,12 +98,12 @@ describe Arachni::Support::Signature do
|
|
98
98
|
signature3 = described_class.new( different_string_with_noise )
|
99
99
|
signature4 = described_class.new( different_string_with_noise )
|
100
100
|
|
101
|
-
signature1.differences( signature2 ).round(3).
|
102
|
-
signature2.differences( signature2 ).
|
101
|
+
expect(signature1.differences( signature2 ).round(3)).to eq(0.348)
|
102
|
+
expect(signature2.differences( signature2 )).to eq(0)
|
103
103
|
|
104
|
-
signature3.differences( signature4 ).
|
105
|
-
signature4.differences( signature4 ).
|
106
|
-
signature1.differences( signature3 ).round(3).
|
104
|
+
expect(signature3.differences( signature4 )).to eq(0.2)
|
105
|
+
expect(signature4.differences( signature4 )).to eq(0)
|
106
|
+
expect(signature1.differences( signature3 ).round(3)).to eq(0.667)
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -116,7 +116,7 @@ describe Arachni::Support::Signature do
|
|
116
116
|
signature2 = described_class.new( string_with_noise )
|
117
117
|
10.times{ signature2.refine!( string_with_noise ) }
|
118
118
|
|
119
|
-
signature1.
|
119
|
+
expect(signature1).to eq(signature2)
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -128,15 +128,15 @@ describe Arachni::Support::Signature do
|
|
128
128
|
signature2 = described_class.new( different_string_with_noise )
|
129
129
|
10.times{ signature2.refine!( different_string_with_noise ) }
|
130
130
|
|
131
|
-
signature1.
|
131
|
+
expect(signature1).not_to eq(signature2)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
136
|
describe '#dup' do
|
137
137
|
it 'returns a duplicate instance' do
|
138
|
-
signature.dup.
|
139
|
-
signature.dup.object_id.
|
138
|
+
expect(signature.dup).to eq(signature)
|
139
|
+
expect(signature.dup.object_id).not_to eq(signature.object_id)
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
@@ -76,43 +76,43 @@ describe Arachni::Trainer do
|
|
76
76
|
describe 'HTTP requests with "train" set to' do
|
77
77
|
describe 'nil' do
|
78
78
|
it 'skips the Trainer' do
|
79
|
-
@framework.pages.size.
|
79
|
+
expect(@framework.pages.size).to eq(0)
|
80
80
|
|
81
81
|
Arachni::HTTP::Client.request( @url + '/elems' )
|
82
82
|
@framework.run
|
83
83
|
|
84
|
-
@framework.pages.size.
|
84
|
+
expect(@framework.pages.size).to eq(0)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
describe false do
|
88
88
|
it 'skips the Trainer' do
|
89
|
-
@framework.pages.size.
|
89
|
+
expect(@framework.pages.size).to eq(0)
|
90
90
|
|
91
91
|
Arachni::HTTP::Client.request( @url + '/elems', train: false )
|
92
92
|
@framework.run
|
93
93
|
|
94
|
-
@framework.pages.size.
|
94
|
+
expect(@framework.pages.size).to eq(0)
|
95
95
|
end
|
96
96
|
end
|
97
97
|
describe true do
|
98
98
|
it 'passes the response to the Trainer' do
|
99
|
-
@framework.pages.size.
|
99
|
+
expect(@framework.pages.size).to eq(0)
|
100
100
|
|
101
101
|
Arachni::HTTP::Client.request( @url + '/elems', train: true )
|
102
102
|
|
103
|
-
@trainer.
|
103
|
+
expect(@trainer).to receive(:push)
|
104
104
|
@framework.run
|
105
105
|
end
|
106
106
|
|
107
107
|
context 'when a redirection leads to new elements' do
|
108
108
|
it 'passes the response to the Trainer' do
|
109
|
-
@framework.pages.size.
|
109
|
+
expect(@framework.pages.size).to eq(0)
|
110
110
|
|
111
111
|
Arachni::HTTP::Client.request( @url + '/train/redirect', train: true )
|
112
112
|
@framework.run
|
113
113
|
|
114
114
|
page = @framework.pages.first
|
115
|
-
page.links.first.inputs.include?( 'msg' ).
|
115
|
+
expect(page.links.first.inputs.include?( 'msg' )).to be_truthy
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
@@ -121,25 +121,25 @@ describe Arachni::Trainer do
|
|
121
121
|
context 'when a page' do
|
122
122
|
context 'has not changed' do
|
123
123
|
it 'is skipped' do
|
124
|
-
@framework.pages.
|
124
|
+
expect(@framework.pages).to be_empty
|
125
125
|
|
126
126
|
Arachni::HTTP::Client.request( @url, train: true )
|
127
127
|
@framework.run
|
128
128
|
|
129
|
-
@framework.pages.
|
129
|
+
expect(@framework.pages).to be_empty
|
130
130
|
end
|
131
131
|
|
132
132
|
context 'but has new paths' do
|
133
133
|
it 'pushes them to the framework' do
|
134
|
-
@framework.urls.
|
134
|
+
expect(@framework.urls).to be_empty
|
135
135
|
|
136
136
|
Arachni::HTTP::Client.request( @url, train: true )
|
137
137
|
|
138
138
|
Arachni::HTTP::Client.request( @url + '/new-paths', train: true )
|
139
139
|
@framework.run
|
140
140
|
|
141
|
-
@framework.pages.
|
142
|
-
@framework.urls.
|
141
|
+
expect(@framework.pages).to be_empty
|
142
|
+
expect(@framework.urls).to be_any
|
143
143
|
end
|
144
144
|
end
|
145
145
|
end
|
@@ -162,7 +162,7 @@ describe Arachni::Trainer do
|
|
162
162
|
|
163
163
|
100.times { @trainer.push( get_response.call ) }
|
164
164
|
|
165
|
-
pages.size.
|
165
|
+
expect(pages.size).to eq(Arachni::Trainer::MAX_TRAININGS_PER_URL)
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
@@ -171,7 +171,7 @@ describe Arachni::Trainer do
|
|
171
171
|
res = Arachni::HTTP::Response.new(
|
172
172
|
url: @url + '/exclude_me'
|
173
173
|
)
|
174
|
-
@trainer.push( res ).
|
174
|
+
expect(@trainer.push( res )).to be_falsey
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
@@ -197,7 +197,7 @@ describe Arachni::Trainer do
|
|
197
197
|
Arachni::Options.scope.redundant_path_patterns = { /match_this/ => 0 }
|
198
198
|
trainer.push( get_response.call )
|
199
199
|
|
200
|
-
pages.size.
|
200
|
+
expect(pages.size).to eq(0)
|
201
201
|
end
|
202
202
|
end
|
203
203
|
end
|
@@ -207,9 +207,9 @@ describe Arachni::Trainer do
|
|
207
207
|
it 'returns nil' do
|
208
208
|
@trainer.page = @page
|
209
209
|
|
210
|
-
@trainer.
|
210
|
+
allow(@trainer).to receive(:analyze) { raise }
|
211
211
|
|
212
|
-
@trainer.push( request( @url ) ).
|
212
|
+
expect(@trainer.push( request( @url ) )).to be_nil
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
@@ -218,7 +218,7 @@ describe Arachni::Trainer do
|
|
218
218
|
@trainer.page = @page
|
219
219
|
|
220
220
|
Arachni::Options.scope.exclude_path_patterns = @url
|
221
|
-
@trainer.push( request( @url ) ).
|
221
|
+
expect(@trainer.push( request( @url ) )).to be_falsey
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
@@ -226,14 +226,14 @@ describe Arachni::Trainer do
|
|
226
226
|
context 'text-based' do
|
227
227
|
it 'returns true' do
|
228
228
|
@trainer.page = @page
|
229
|
-
@trainer.push( request( @url ) ).
|
229
|
+
expect(@trainer.push( request( @url ) )).to be_truthy
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
233
|
context 'not text-based' do
|
234
234
|
it 'returns false' do
|
235
235
|
ct = @url + '/non_text_content_type'
|
236
|
-
@trainer.push( request( ct ) ).
|
236
|
+
expect(@trainer.push( request( ct ) )).to be_falsey
|
237
237
|
end
|
238
238
|
end
|
239
239
|
end
|
@@ -243,15 +243,15 @@ describe Arachni::Trainer do
|
|
243
243
|
it 'returns a page with the new form' do
|
244
244
|
url = @url + '/new_form'
|
245
245
|
@trainer.page = @page
|
246
|
-
@trainer.push( request( url ) ).
|
246
|
+
expect(@trainer.push( request( url ) )).to be_truthy
|
247
247
|
|
248
248
|
pages = @framework.pages
|
249
|
-
pages.size.
|
249
|
+
expect(pages.size).to eq(1)
|
250
250
|
|
251
251
|
page = pages.pop
|
252
252
|
new_forms = (page.forms - @page.forms)
|
253
|
-
new_forms.size.
|
254
|
-
new_forms.first.inputs.include?( 'input2' ).
|
253
|
+
expect(new_forms.size).to eq(1)
|
254
|
+
expect(new_forms.first.inputs.include?( 'input2' )).to be_truthy
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
@@ -259,13 +259,13 @@ describe Arachni::Trainer do
|
|
259
259
|
it 'returns a page with the new link' do
|
260
260
|
url = @url + '/new_link'
|
261
261
|
@trainer.page = @page
|
262
|
-
@trainer.push( request( url ) ).
|
262
|
+
expect(@trainer.push( request( url ) )).to be_truthy
|
263
263
|
|
264
264
|
page = @framework.pages.first
|
265
265
|
|
266
266
|
new_links = (page.links - @page.links)
|
267
|
-
new_links.size.
|
268
|
-
new_links.select { |l| l.inputs.include?( 'link_param' ) }.
|
267
|
+
expect(new_links.size).to eq(1)
|
268
|
+
expect(new_links.select { |l| l.inputs.include?( 'link_param' ) }).to be_any
|
269
269
|
end
|
270
270
|
end
|
271
271
|
|
@@ -273,11 +273,11 @@ describe Arachni::Trainer do
|
|
273
273
|
it 'returns a page with the new cookie appended' do
|
274
274
|
url = @url + '/new_cookie'
|
275
275
|
@trainer.page = @page
|
276
|
-
@trainer.push( request( url ) ).
|
276
|
+
expect(@trainer.push( request( url ) )).to be_truthy
|
277
277
|
|
278
278
|
page = @framework.pages.first
|
279
|
-
page.cookies.size.
|
280
|
-
page.cookies.select { |l| l.inputs.include?( 'new_cookie' ) }.
|
279
|
+
expect(page.cookies.size).to eq(2)
|
280
|
+
expect(page.cookies.select { |l| l.inputs.include?( 'new_cookie' ) }).to be_any
|
281
281
|
end
|
282
282
|
end
|
283
283
|
end
|
@@ -286,9 +286,9 @@ describe Arachni::Trainer do
|
|
286
286
|
it 'extracts query vars from the effective url' do
|
287
287
|
url = @url + '/redirect?redirected=true'
|
288
288
|
@trainer.page = @page
|
289
|
-
@trainer.push( request( url ) ).
|
289
|
+
expect(@trainer.push( request( url ) )).to be_truthy
|
290
290
|
page = @framework.pages.first
|
291
|
-
page.links.last.inputs['redirected'].
|
291
|
+
expect(page.links.last.inputs['redirected']).to eq('true')
|
292
292
|
end
|
293
293
|
end
|
294
294
|
|
@@ -310,28 +310,28 @@ describe Arachni::Trainer do
|
|
310
310
|
let(:subject) { TrainerMockFramework.new.trainer }
|
311
311
|
|
312
312
|
context true do
|
313
|
-
before { TrainerMockFramework.
|
313
|
+
before { allow_any_instance_of(TrainerMockFramework).to receive(:accepts_more_pages?){ true } }
|
314
314
|
|
315
315
|
it 'processes pages' do
|
316
316
|
pages = []
|
317
317
|
subject.on_new_page { |p| pages << p }
|
318
318
|
|
319
|
-
subject.push( get_response.call ).
|
319
|
+
expect(subject.push( get_response.call )).to be_truthy
|
320
320
|
|
321
|
-
pages.size.
|
321
|
+
expect(pages.size).to eq(1)
|
322
322
|
end
|
323
323
|
end
|
324
324
|
|
325
325
|
context false do
|
326
|
-
before { TrainerMockFramework.
|
326
|
+
before { allow_any_instance_of(TrainerMockFramework).to receive(:accepts_more_pages?){ false } }
|
327
327
|
|
328
328
|
it 'does not process the page' do
|
329
329
|
pages = []
|
330
330
|
subject.on_new_page { |p| pages << p }
|
331
331
|
|
332
|
-
subject.push( get_response.call ).
|
332
|
+
expect(subject.push( get_response.call )).to be_falsey
|
333
333
|
|
334
|
-
pages.
|
334
|
+
expect(pages).to be_empty
|
335
335
|
end
|
336
336
|
end
|
337
337
|
end
|