arachni 1.4 → 1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +136 -0
- data/Gemfile +3 -1
- data/LICENSE.md +1 -1
- data/README.md +5 -2
- data/Rakefile +1 -1
- data/arachni.gemspec +35 -30
- data/bin/arachni +1 -1
- data/bin/arachni_console +1 -1
- data/bin/arachni_multi +6 -1
- data/bin/arachni_reporter +1 -1
- data/bin/arachni_reproduce +12 -0
- data/bin/arachni_rest_server +1 -1
- data/bin/arachni_restore +1 -1
- data/bin/arachni_rpc +6 -1
- data/bin/arachni_rpcd +1 -1
- data/bin/arachni_rpcd_monitor +6 -1
- data/bin/arachni_script +1 -1
- data/components/checks/active/code_injection.rb +1 -1
- data/components/checks/active/code_injection_php_input_wrapper.rb +1 -1
- data/components/checks/active/code_injection_timing.rb +1 -1
- data/components/checks/active/csrf.rb +15 -75
- data/components/checks/active/file_inclusion.rb +1 -1
- data/components/checks/active/ldap_injection.rb +1 -1
- data/components/checks/active/no_sql_injection.rb +1 -1
- data/components/checks/active/no_sql_injection_differential.rb +1 -1
- data/components/checks/active/os_cmd_injection.rb +1 -1
- data/components/checks/active/os_cmd_injection_timing.rb +1 -1
- data/components/checks/active/path_traversal.rb +3 -3
- data/components/checks/active/response_splitting.rb +1 -1
- data/components/checks/active/rfi.rb +1 -1
- data/components/checks/active/session_fixation.rb +1 -1
- data/components/checks/active/source_code_disclosure.rb +1 -1
- data/components/checks/active/sql_injection.rb +1 -1
- data/components/checks/active/sql_injection/regexps/hsqldb.yaml +1 -0
- data/components/checks/active/sql_injection/substrings/hsqldb +1 -0
- data/components/checks/active/sql_injection/substrings/java +4 -0
- data/components/checks/active/sql_injection/substrings/oracle +0 -1
- data/components/checks/active/sql_injection/substrings/sqlite +1 -0
- data/components/checks/active/sql_injection_differential.rb +1 -1
- data/components/checks/active/sql_injection_timing.rb +1 -1
- data/components/checks/active/trainer.rb +1 -1
- data/components/checks/active/unvalidated_redirect.rb +34 -11
- data/components/checks/active/unvalidated_redirect_dom.rb +4 -4
- data/components/checks/active/xpath_injection.rb +1 -1
- data/components/checks/active/xss.rb +52 -27
- data/components/checks/active/xss_dom.rb +15 -11
- data/components/checks/active/xss_dom_script_context.rb +4 -6
- data/components/checks/active/xss_event.rb +45 -33
- data/components/checks/active/xss_path.rb +9 -6
- data/components/checks/active/xss_script_context.rb +99 -46
- data/components/checks/active/xss_tag.rb +39 -14
- data/components/checks/active/xxe.rb +1 -1
- data/components/checks/passive/allowed_methods.rb +1 -1
- data/components/checks/passive/backdoors.rb +1 -1
- data/components/checks/passive/backup_directories.rb +15 -3
- data/components/checks/passive/backup_files.rb +39 -6
- data/components/checks/passive/common_admin_interfaces.rb +1 -1
- data/components/checks/passive/common_admin_interfaces/admin-panels.txt +1 -0
- data/components/checks/passive/common_directories.rb +1 -1
- data/components/checks/passive/common_files.rb +1 -1
- data/components/checks/passive/directory_listing.rb +1 -1
- data/components/checks/passive/grep/captcha.rb +8 -9
- data/components/checks/passive/grep/cookie_set_for_parent_domain.rb +1 -1
- data/components/checks/passive/grep/credit_card.rb +1 -1
- data/components/checks/passive/grep/cvs_svn_users.rb +1 -1
- data/components/checks/passive/grep/emails.rb +1 -1
- data/components/checks/passive/grep/form_upload.rb +3 -5
- data/components/checks/passive/grep/hsts.rb +1 -1
- data/components/checks/passive/grep/html_objects.rb +1 -1
- data/components/checks/passive/grep/http_only_cookies.rb +1 -1
- data/components/checks/passive/grep/insecure_cookies.rb +5 -5
- data/components/checks/passive/grep/insecure_cors_policy.rb +1 -1
- data/components/checks/passive/grep/mixed_resource.rb +4 -4
- data/components/checks/passive/grep/password_autocomplete.rb +1 -1
- data/components/checks/passive/grep/private_ip.rb +1 -1
- data/components/checks/passive/grep/ssn.rb +1 -1
- data/components/checks/passive/grep/unencrypted_password_forms.rb +3 -3
- data/components/checks/passive/grep/x_frame_options.rb +1 -1
- data/components/checks/passive/htaccess_limit.rb +1 -1
- data/components/checks/passive/http_put.rb +1 -1
- data/components/checks/passive/insecure_client_access_policy.rb +2 -2
- data/components/checks/passive/insecure_cross_domain_policy_access.rb +2 -2
- data/components/checks/passive/insecure_cross_domain_policy_headers.rb +2 -2
- data/components/checks/passive/interesting_responses.rb +1 -1
- data/components/checks/passive/localstart_asp.rb +1 -1
- data/components/checks/passive/origin_spoof_access_restriction_bypass.rb +1 -1
- data/components/checks/passive/webdav.rb +1 -1
- data/components/checks/passive/xst.rb +10 -12
- data/components/fingerprinters/frameworks/aspx_mvc.rb +1 -1
- data/components/fingerprinters/frameworks/cakephp.rb +1 -1
- data/components/fingerprinters/frameworks/cherrypy.rb +1 -1
- data/components/fingerprinters/frameworks/django.rb +1 -1
- data/components/fingerprinters/frameworks/jsf.rb +1 -1
- data/components/fingerprinters/frameworks/nette.rb +1 -1
- data/components/fingerprinters/frameworks/rack.rb +1 -1
- data/components/fingerprinters/frameworks/rails.rb +1 -1
- data/components/fingerprinters/frameworks/symfony.rb +1 -1
- data/components/fingerprinters/languages/asp.rb +1 -1
- data/components/fingerprinters/languages/aspx.rb +1 -1
- data/components/fingerprinters/languages/java.rb +1 -1
- data/components/fingerprinters/languages/php.rb +1 -1
- data/components/fingerprinters/languages/python.rb +1 -1
- data/components/fingerprinters/languages/ruby.rb +1 -1
- data/components/fingerprinters/os/bsd.rb +1 -1
- data/components/fingerprinters/os/linux.rb +1 -1
- data/components/fingerprinters/os/solaris.rb +1 -1
- data/components/fingerprinters/os/unix.rb +1 -1
- data/components/fingerprinters/os/windows.rb +1 -1
- data/components/fingerprinters/servers/apache.rb +1 -1
- data/components/fingerprinters/servers/gunicorn.rb +1 -1
- data/components/fingerprinters/servers/iis.rb +1 -1
- data/components/fingerprinters/servers/jetty.rb +1 -1
- data/components/fingerprinters/servers/nginx.rb +1 -1
- data/components/fingerprinters/servers/tomcat.rb +1 -1
- data/components/path_extractors/anchors.rb +3 -5
- data/components/path_extractors/areas.rb +3 -4
- data/components/path_extractors/comments.rb +4 -5
- data/components/path_extractors/data_url.rb +4 -5
- data/components/path_extractors/forms.rb +3 -4
- data/components/path_extractors/frames.rb +3 -5
- data/components/path_extractors/generic.rb +3 -1
- data/components/path_extractors/links.rb +3 -4
- data/components/path_extractors/meta_refresh.rb +11 -17
- data/components/path_extractors/scripts.rb +18 -15
- data/components/plugins/autologin.rb +3 -2
- data/components/plugins/beep_notify.rb +1 -1
- data/components/plugins/content_types.rb +1 -1
- data/components/plugins/cookie_collector.rb +1 -1
- data/components/plugins/debug/browser_cluster_job_monitor.rb +60 -0
- data/components/plugins/defaults/autothrottle.rb +1 -1
- data/components/plugins/defaults/healthmap.rb +3 -1
- data/components/plugins/defaults/meta/remedies/discovery.rb +1 -1
- data/components/plugins/defaults/meta/remedies/timing_attacks.rb +1 -1
- data/components/plugins/defaults/meta/uniformity.rb +1 -1
- data/components/plugins/email_notify.rb +26 -9
- data/components/plugins/exec.rb +1 -1
- data/components/plugins/form_dicattack.rb +3 -4
- data/components/plugins/headers_collector.rb +1 -1
- data/components/plugins/http_dicattack.rb +4 -5
- data/components/plugins/login_script.rb +2 -2
- data/components/plugins/metrics.rb +41 -15
- data/components/plugins/page_dump.rb +60 -0
- data/components/plugins/proxy.rb +42 -30
- data/components/plugins/proxy/template_scope.rb +6 -1
- data/components/plugins/rate_limiter.rb +80 -0
- data/components/plugins/restrict_to_dom_state.rb +1 -1
- data/components/plugins/script.rb +1 -1
- data/components/plugins/uncommon_headers.rb +1 -1
- data/components/plugins/vector_collector.rb +1 -1
- data/components/plugins/vector_feed.rb +1 -1
- data/components/plugins/waf_detector.rb +3 -3
- data/components/plugins/webhook_notify.rb +99 -0
- data/components/reporters/ap.rb +1 -1
- data/components/reporters/html.rb +2 -3
- data/components/reporters/html/default.erb +1 -2
- data/components/reporters/html/default/configuration.erb +2 -0
- data/components/reporters/json.rb +1 -1
- data/components/reporters/marshal.rb +1 -1
- data/components/reporters/plugin_formatters/html/autologin.rb +1 -1
- data/components/reporters/plugin_formatters/html/content_types.rb +1 -1
- data/components/reporters/plugin_formatters/html/cookie_collector.rb +1 -1
- data/components/reporters/plugin_formatters/html/exec.rb +1 -1
- data/components/reporters/plugin_formatters/html/form_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/html/healthmap.rb +1 -1
- data/components/reporters/plugin_formatters/html/http_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/html/login_script.rb +1 -1
- data/components/reporters/plugin_formatters/html/metrics.rb +46 -1
- data/components/reporters/plugin_formatters/html/uncommon_headers.rb +1 -1
- data/components/reporters/plugin_formatters/html/uniformity.rb +1 -1
- data/components/reporters/plugin_formatters/html/vector_collector.rb +1 -1
- data/components/reporters/plugin_formatters/html/waf_detector.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/autologin.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/content_types.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/cookie_collector.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/exec.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/form_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/healthmap.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/http_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/login_script.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/metrics.rb +11 -1
- data/components/reporters/plugin_formatters/stdout/uncommon_headers.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/uniformity.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/vector_collector.rb +1 -1
- data/components/reporters/plugin_formatters/stdout/waf_detector.rb +1 -1
- data/components/reporters/plugin_formatters/xml/autologin.rb +1 -1
- data/components/reporters/plugin_formatters/xml/content_types.rb +10 -7
- data/components/reporters/plugin_formatters/xml/cookie_collector.rb +6 -3
- data/components/reporters/plugin_formatters/xml/exec.rb +1 -1
- data/components/reporters/plugin_formatters/xml/form_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/xml/healthmap.rb +1 -1
- data/components/reporters/plugin_formatters/xml/http_dicattack.rb +1 -1
- data/components/reporters/plugin_formatters/xml/login_script.rb +1 -1
- data/components/reporters/plugin_formatters/xml/metrics.rb +1 -1
- data/components/reporters/plugin_formatters/xml/uncommon_headers.rb +5 -2
- data/components/reporters/plugin_formatters/xml/uniformity.rb +1 -1
- data/components/reporters/plugin_formatters/xml/vector_collector.rb +8 -5
- data/components/reporters/plugin_formatters/xml/waf_detector.rb +1 -1
- data/components/reporters/stdout.rb +3 -2
- data/components/reporters/txt.rb +1 -1
- data/components/reporters/xml.rb +39 -22
- data/components/reporters/xml/schema.xsd +28 -13
- data/components/reporters/yaml.rb +1 -1
- data/lib/arachni.rb +1 -1
- data/lib/arachni/banner.rb +1 -1
- data/lib/arachni/browser.rb +242 -231
- data/lib/arachni/browser/element_locator.rb +9 -5
- data/lib/arachni/browser/javascript.rb +103 -168
- data/lib/arachni/browser/javascript/dom_monitor.rb +1 -1
- data/lib/arachni/browser/javascript/proxy.rb +1 -1
- data/lib/arachni/browser/javascript/proxy/stub.rb +1 -1
- data/lib/arachni/browser/javascript/scripts/dom_monitor.js +295 -51
- data/lib/arachni/browser/javascript/scripts/polyfills.js +0 -28
- data/lib/arachni/browser/javascript/scripts/taint_tracer.js +46 -8
- data/lib/arachni/browser/javascript/taint_tracer.rb +1 -1
- data/lib/arachni/browser/javascript/taint_tracer/frame.rb +1 -1
- data/lib/arachni/browser/javascript/taint_tracer/frame/called_function.rb +1 -1
- data/lib/arachni/browser/javascript/taint_tracer/sink/base.rb +1 -1
- data/lib/arachni/browser/javascript/taint_tracer/sink/data_flow.rb +1 -1
- data/lib/arachni/browser/javascript/taint_tracer/sink/execution_flow.rb +1 -1
- data/lib/arachni/browser_cluster.rb +78 -60
- data/lib/arachni/browser_cluster/job.rb +9 -2
- data/lib/arachni/browser_cluster/job/result.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/browser_provider.rb +8 -2
- data/lib/arachni/browser_cluster/jobs/dom_exploration.rb +13 -1
- data/lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger/result.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/dom_exploration/result.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace/event_trigger.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace/event_trigger/result.rb +1 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace/result.rb +1 -1
- data/lib/arachni/browser_cluster/worker.rb +109 -84
- data/lib/arachni/check.rb +1 -1
- data/lib/arachni/check/auditor.rb +137 -93
- data/lib/arachni/check/base.rb +1 -1
- data/lib/arachni/check/manager.rb +1 -1
- data/lib/arachni/component.rb +1 -1
- data/lib/arachni/component/base.rb +3 -1
- data/lib/arachni/component/manager.rb +1 -1
- data/lib/arachni/component/options.rb +1 -1
- data/lib/arachni/component/options/address.rb +1 -1
- data/lib/arachni/component/options/base.rb +1 -1
- data/lib/arachni/component/options/bool.rb +1 -1
- data/lib/arachni/component/options/float.rb +1 -1
- data/lib/arachni/component/options/int.rb +1 -1
- data/lib/arachni/component/options/multiple_choice.rb +1 -1
- data/lib/arachni/component/options/object.rb +1 -1
- data/lib/arachni/component/options/path.rb +1 -1
- data/lib/arachni/component/options/port.rb +1 -1
- data/lib/arachni/component/options/string.rb +1 -1
- data/lib/arachni/component/options/url.rb +1 -1
- data/lib/arachni/component/output.rb +8 -2
- data/lib/arachni/component/utilities.rb +1 -1
- data/lib/arachni/data.rb +1 -1
- data/lib/arachni/data/framework.rb +2 -1
- data/lib/arachni/data/framework/rpc.rb +1 -1
- data/lib/arachni/data/issues.rb +1 -1
- data/lib/arachni/data/plugins.rb +1 -1
- data/lib/arachni/data/session.rb +1 -1
- data/lib/arachni/element/base.rb +1 -1
- data/lib/arachni/element/body.rb +1 -1
- data/lib/arachni/element/capabilities/analyzable.rb +1 -1
- data/lib/arachni/element/capabilities/analyzable/differential.rb +142 -175
- data/lib/arachni/element/capabilities/analyzable/signature.rb +39 -17
- data/lib/arachni/element/capabilities/analyzable/timeout.rb +1 -1
- data/lib/arachni/element/capabilities/auditable.rb +2 -8
- data/lib/arachni/element/capabilities/auditable/buffered.rb +92 -0
- data/lib/arachni/element/capabilities/auditable/line_buffered.rb +103 -0
- data/lib/arachni/element/capabilities/dom_only.rb +1 -1
- data/lib/arachni/element/capabilities/inputtable.rb +6 -2
- data/lib/arachni/element/capabilities/mutable.rb +1 -1
- data/lib/arachni/element/capabilities/refreshable.rb +1 -1
- data/lib/arachni/element/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/capabilities/with_auditor.rb +1 -1
- data/lib/arachni/element/capabilities/with_auditor/output.rb +4 -3
- data/lib/arachni/element/capabilities/with_dom.rb +1 -1
- data/lib/arachni/element/capabilities/with_node.rb +3 -3
- data/lib/arachni/element/capabilities/with_scope.rb +1 -1
- data/lib/arachni/element/capabilities/with_scope/scope.rb +1 -1
- data/lib/arachni/element/capabilities/with_source.rb +2 -2
- data/lib/arachni/element/cookie.rb +49 -24
- data/lib/arachni/element/cookie/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/cookie/capabilities/mutable.rb +1 -1
- data/lib/arachni/element/cookie/capabilities/with_dom.rb +1 -1
- data/lib/arachni/element/cookie/dom.rb +1 -1
- data/lib/arachni/element/dom.rb +1 -1
- data/lib/arachni/element/dom/capabilities/auditable.rb +44 -3
- data/lib/arachni/element/dom/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/dom/capabilities/locatable.rb +1 -1
- data/lib/arachni/element/dom/capabilities/mutable.rb +7 -3
- data/lib/arachni/element/dom/capabilities/submittable.rb +51 -22
- data/lib/arachni/element/form.rb +21 -32
- data/lib/arachni/element/form/capabilities/auditable.rb +1 -1
- data/lib/arachni/element/form/capabilities/mutable.rb +16 -11
- data/lib/arachni/element/form/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/form/capabilities/with_dom.rb +1 -1
- data/lib/arachni/element/form/dom.rb +1 -1
- data/lib/arachni/element/generic_dom.rb +1 -1
- data/lib/arachni/element/header.rb +3 -1
- data/lib/arachni/element/header/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/header/capabilities/mutable.rb +1 -1
- data/lib/arachni/element/json.rb +4 -8
- data/lib/arachni/element/json/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/json/capabilities/mutable.rb +1 -1
- data/lib/arachni/element/link.rb +11 -30
- data/lib/arachni/element/link/capabilities/auditable.rb +1 -1
- data/lib/arachni/element/link/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/link/capabilities/with_dom.rb +1 -1
- data/lib/arachni/element/link/dom.rb +1 -1
- data/lib/arachni/element/link/dom/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/link_template.rb +10 -19
- data/lib/arachni/element/link_template/capabilities/auditable.rb +1 -1
- data/lib/arachni/element/link_template/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/link_template/capabilities/with_dom.rb +1 -1
- data/lib/arachni/element/link_template/dom.rb +2 -2
- data/lib/arachni/element/link_template/dom/capabilities/submittable.rb +1 -1
- data/lib/arachni/element/path.rb +1 -1
- data/lib/arachni/element/server.rb +11 -11
- data/lib/arachni/element/ui_form.rb +5 -6
- data/lib/arachni/element/ui_form/dom.rb +1 -1
- data/lib/arachni/element/ui_input.rb +4 -6
- data/lib/arachni/element/ui_input/dom.rb +1 -1
- data/lib/arachni/element/xml.rb +3 -7
- data/lib/arachni/element/xml/capabilities/inputtable.rb +1 -1
- data/lib/arachni/element/xml/capabilities/mutable.rb +1 -1
- data/lib/arachni/element_filter.rb +1 -1
- data/lib/arachni/error.rb +1 -1
- data/lib/arachni/ethon/easy.rb +1 -1
- data/lib/arachni/framework.rb +1 -1
- data/lib/arachni/framework/parts/audit.rb +6 -1
- data/lib/arachni/framework/parts/browser.rb +14 -14
- data/lib/arachni/framework/parts/check.rb +1 -1
- data/lib/arachni/framework/parts/data.rb +1 -1
- data/lib/arachni/framework/parts/platform.rb +1 -1
- data/lib/arachni/framework/parts/plugin.rb +1 -1
- data/lib/arachni/framework/parts/report.rb +2 -2
- data/lib/arachni/framework/parts/scope.rb +1 -1
- data/lib/arachni/framework/parts/state.rb +1 -1
- data/lib/arachni/http.rb +1 -1
- data/lib/arachni/http/client.rb +32 -7
- data/lib/arachni/http/client/dynamic_404_handler.rb +74 -16
- data/lib/arachni/http/cookie_jar.rb +13 -8
- data/lib/arachni/http/headers.rb +11 -5
- data/lib/arachni/http/message.rb +9 -8
- data/lib/arachni/http/message/scope.rb +1 -1
- data/lib/arachni/http/proxy_server.rb +44 -11
- data/lib/arachni/http/proxy_server/connection.rb +113 -80
- data/lib/arachni/http/proxy_server/ssl_interceptor.rb +2 -1
- data/lib/arachni/http/proxy_server/tunnel.rb +4 -4
- data/lib/arachni/http/request.rb +236 -44
- data/lib/arachni/http/request/scope.rb +1 -1
- data/lib/arachni/http/response.rb +71 -8
- data/lib/arachni/http/response/scope.rb +1 -1
- data/lib/arachni/issue.rb +42 -14
- data/lib/arachni/issue/severity.rb +1 -1
- data/lib/arachni/issue/severity/base.rb +1 -1
- data/lib/arachni/option_group.rb +1 -1
- data/lib/arachni/option_groups.rb +1 -1
- data/lib/arachni/option_groups/audit.rb +1 -1
- data/lib/arachni/option_groups/browser_cluster.rb +6 -2
- data/lib/arachni/option_groups/datastore.rb +1 -1
- data/lib/arachni/option_groups/dispatcher.rb +1 -1
- data/lib/arachni/option_groups/http.rb +35 -6
- data/lib/arachni/option_groups/input.rb +1 -1
- data/lib/arachni/option_groups/output.rb +1 -1
- data/lib/arachni/option_groups/paths.rb +1 -1
- data/lib/arachni/option_groups/rpc.rb +1 -1
- data/lib/arachni/option_groups/scope.rb +13 -1
- data/lib/arachni/option_groups/session.rb +1 -1
- data/lib/arachni/option_groups/snapshot.rb +1 -1
- data/lib/arachni/options.rb +23 -4
- data/lib/arachni/page.rb +8 -6
- data/lib/arachni/page/dom.rb +46 -54
- data/lib/arachni/page/dom/transition.rb +5 -2
- data/lib/arachni/page/scope.rb +1 -1
- data/lib/arachni/parser.rb +157 -77
- data/lib/arachni/parser/document.rb +34 -0
- data/lib/arachni/parser/extractors/base.rb +48 -0
- data/lib/arachni/parser/nodes/base.rb +22 -0
- data/lib/arachni/parser/nodes/comment.rb +32 -0
- data/lib/arachni/parser/nodes/element.rb +48 -0
- data/lib/arachni/parser/nodes/element/with_attributes.rb +35 -0
- data/lib/arachni/parser/nodes/element/with_attributes/attributes.rb +31 -0
- data/lib/arachni/parser/nodes/text.rb +32 -0
- data/lib/arachni/parser/nodes/with_value.rb +29 -0
- data/lib/arachni/parser/sax.rb +75 -0
- data/lib/arachni/parser/with_children.rb +35 -0
- data/lib/arachni/parser/with_children/search.rb +92 -0
- data/lib/arachni/platform.rb +1 -1
- data/lib/arachni/platform/fingerprinter.rb +1 -1
- data/lib/arachni/platform/list.rb +1 -1
- data/lib/arachni/platform/manager.rb +2 -2
- data/lib/arachni/plugin.rb +1 -1
- data/lib/arachni/plugin/base.rb +2 -2
- data/lib/arachni/plugin/formatter.rb +1 -1
- data/lib/arachni/plugin/manager.rb +8 -5
- data/lib/arachni/processes.rb +1 -1
- data/lib/arachni/processes/dispatchers.rb +1 -1
- data/lib/arachni/processes/executables/browser.rb +0 -2
- data/lib/arachni/processes/helpers.rb +1 -1
- data/lib/arachni/processes/helpers/dispatchers.rb +1 -1
- data/lib/arachni/processes/helpers/instances.rb +1 -1
- data/lib/arachni/processes/helpers/processes.rb +1 -1
- data/lib/arachni/processes/instances.rb +1 -1
- data/lib/arachni/processes/manager.rb +10 -5
- data/lib/arachni/report.rb +8 -1
- data/lib/arachni/reporter.rb +1 -1
- data/lib/arachni/reporter/base.rb +1 -1
- data/lib/arachni/reporter/formatter_manager.rb +1 -1
- data/lib/arachni/reporter/manager.rb +1 -1
- data/lib/arachni/reporter/options.rb +1 -1
- data/lib/arachni/rest/server.rb +7 -1
- data/lib/arachni/rest/server/instance_helpers.rb +1 -1
- data/lib/arachni/rpc/client/base.rb +1 -1
- data/lib/arachni/rpc/client/dispatcher.rb +1 -1
- data/lib/arachni/rpc/client/instance.rb +1 -1
- data/lib/arachni/rpc/client/instance/framework.rb +1 -1
- data/lib/arachni/rpc/client/instance/service.rb +1 -1
- data/lib/arachni/rpc/serializer.rb +1 -1
- data/lib/arachni/rpc/server/active_options.rb +1 -1
- data/lib/arachni/rpc/server/base.rb +1 -1
- data/lib/arachni/rpc/server/check/manager.rb +1 -1
- data/lib/arachni/rpc/server/dispatcher.rb +1 -1
- data/lib/arachni/rpc/server/dispatcher/node.rb +1 -1
- data/lib/arachni/rpc/server/dispatcher/service.rb +1 -1
- data/lib/arachni/rpc/server/framework.rb +1 -1
- data/lib/arachni/rpc/server/framework/distributor.rb +1 -1
- data/lib/arachni/rpc/server/framework/master.rb +1 -1
- data/lib/arachni/rpc/server/framework/multi_instance.rb +1 -1
- data/lib/arachni/rpc/server/framework/slave.rb +1 -1
- data/lib/arachni/rpc/server/instance.rb +1 -1
- data/lib/arachni/rpc/server/output.rb +1 -1
- data/lib/arachni/rpc/server/plugin/manager.rb +1 -1
- data/lib/arachni/ruby.rb +1 -1
- data/lib/arachni/ruby/array.rb +1 -1
- data/lib/arachni/ruby/hash.rb +1 -1
- data/lib/arachni/ruby/object.rb +1 -1
- data/lib/arachni/ruby/set.rb +1 -1
- data/lib/arachni/ruby/string.rb +9 -5
- data/lib/arachni/ruby/webrick.rb +1 -1
- data/lib/arachni/ruby/webrick/cookie.rb +1 -1
- data/lib/arachni/ruby/webrick/httprequest.rb +1 -1
- data/lib/arachni/scope.rb +1 -1
- data/lib/arachni/selenium/webdriver/element.rb +4 -4
- data/lib/arachni/selenium/webdriver/remote/typhoeus.rb +69 -0
- data/lib/arachni/session.rb +32 -13
- data/lib/arachni/snapshot.rb +1 -1
- data/lib/arachni/state.rb +1 -1
- data/lib/arachni/state/audit.rb +1 -1
- data/lib/arachni/state/element_filter.rb +1 -1
- data/lib/arachni/state/framework.rb +1 -1
- data/lib/arachni/state/framework/rpc.rb +1 -1
- data/lib/arachni/state/http.rb +2 -2
- data/lib/arachni/state/options.rb +1 -1
- data/lib/arachni/state/plugins.rb +1 -1
- data/lib/arachni/support.rb +1 -1
- data/lib/arachni/support/buffer.rb +1 -1
- data/lib/arachni/support/buffer/autoflush.rb +1 -1
- data/lib/arachni/support/buffer/base.rb +1 -1
- data/lib/arachni/support/cache.rb +1 -1
- data/lib/arachni/support/cache/base.rb +1 -1
- data/lib/arachni/support/cache/least_cost_replacement.rb +1 -1
- data/lib/arachni/support/cache/least_recently_pushed.rb +1 -1
- data/lib/arachni/support/cache/least_recently_used.rb +1 -1
- data/lib/arachni/support/cache/preference.rb +1 -1
- data/lib/arachni/support/cache/random_replacement.rb +1 -1
- data/lib/arachni/support/crypto.rb +1 -1
- data/lib/arachni/support/crypto/rsa_aes_cbc.rb +1 -1
- data/lib/arachni/support/database.rb +1 -1
- data/lib/arachni/support/database/base.rb +1 -1
- data/lib/arachni/support/database/hash.rb +1 -1
- data/lib/arachni/support/database/queue.rb +1 -1
- data/lib/arachni/support/glob.rb +1 -1
- data/lib/arachni/support/lookup.rb +1 -1
- data/lib/arachni/support/lookup/base.rb +1 -1
- data/lib/arachni/support/lookup/hash_set.rb +1 -1
- data/lib/arachni/support/lookup/moolb.rb +1 -1
- data/lib/arachni/support/mixins.rb +1 -1
- data/lib/arachni/support/mixins/observable.rb +1 -1
- data/lib/arachni/support/mixins/terminal.rb +1 -1
- data/lib/arachni/support/profiler.rb +52 -13
- data/lib/arachni/support/signature.rb +18 -6
- data/lib/arachni/trainer.rb +55 -39
- data/lib/arachni/ui/foo/output.rb +1 -1
- data/lib/arachni/uri.rb +132 -103
- data/lib/arachni/uri/scope.rb +15 -13
- data/lib/arachni/utilities.rb +10 -10
- data/lib/arachni/version.rb +1 -1
- data/lib/version +1 -1
- data/logs/error-11897.log +2006 -0
- data/logs/error-3855.log +382 -0
- data/spec/arachni/browser/element_locator_spec.rb +42 -18
- data/spec/arachni/browser/javascript/dom_monitor_spec.rb +214 -63
- data/spec/arachni/browser/javascript/polyfills_spec.rb +0 -15
- data/spec/arachni/browser/javascript/taint_tracer_spec.rb +68 -121
- data/spec/arachni/browser/javascript_spec.rb +92 -51
- data/spec/arachni/browser_cluster/job_spec.rb +23 -8
- data/spec/arachni/browser_cluster/jobs/dom_exploration_spec.rb +6 -1
- data/spec/arachni/browser_cluster/worker_spec.rb +31 -57
- data/spec/arachni/browser_cluster_spec.rb +124 -43
- data/spec/arachni/browser_spec.rb +352 -312
- data/spec/arachni/check/auditor_spec.rb +118 -33
- data/spec/arachni/element/capabilities/analyzable/signature_spec.rb +46 -3
- data/spec/arachni/element/cookie/dom_spec.rb +1 -1
- data/spec/arachni/element/cookie_spec.rb +158 -63
- data/spec/arachni/element/form/dom_spec.rb +1 -1
- data/spec/arachni/element/form_spec.rb +101 -54
- data/spec/arachni/element/header_spec.rb +3 -1
- data/spec/arachni/element/json_spec.rb +2 -0
- data/spec/arachni/element/link/dom_spec.rb +2 -2
- data/spec/arachni/element/link_spec.rb +46 -15
- data/spec/arachni/element/link_template/dom_spec.rb +1 -1
- data/spec/arachni/element/link_template_spec.rb +36 -12
- data/spec/arachni/element/server_spec.rb +22 -5
- data/spec/arachni/element/ui_form/dom_spec.rb +1 -1
- data/spec/arachni/element/ui_input/dom_spec.rb +1 -1
- data/spec/arachni/element/xml_spec.rb +5 -3
- data/spec/arachni/framework/parts/audit_spec.rb +2 -14
- data/spec/arachni/framework/parts/data_spec.rb +0 -6
- data/spec/arachni/http/client/dynamic_404_handlers_spec.rb +126 -0
- data/spec/arachni/http/client_spec.rb +82 -10
- data/spec/arachni/http/headers_spec.rb +59 -12
- data/spec/arachni/http/proxy_server_spec.rb +56 -25
- data/spec/arachni/http/request_spec.rb +379 -33
- data/spec/arachni/http/response_spec.rb +135 -7
- data/spec/arachni/issue_spec.rb +20 -1
- data/spec/arachni/option_groups/http_spec.rb +15 -0
- data/spec/arachni/option_groups/scope_spec.rb +26 -1
- data/spec/arachni/options_spec.rb +8 -1
- data/spec/arachni/page/dom_spec.rb +20 -6
- data/spec/arachni/page_spec.rb +5 -5
- data/spec/arachni/parser/document_spec.rb +49 -0
- data/spec/arachni/parser/nodes/comment_spec.rb +24 -0
- data/spec/arachni/parser/nodes/element/with_attributes/attributes_spec.rb +40 -0
- data/spec/arachni/parser/nodes/element/with_attributes_spec.rb +50 -0
- data/spec/arachni/parser/nodes/element_spec.rb +18 -0
- data/spec/arachni/parser/nodes/text_spec.rb +24 -0
- data/spec/arachni/parser/sax_spec.rb +88 -0
- data/spec/arachni/parser/with_children/search_spec.rb +146 -0
- data/spec/arachni/parser/with_children_spec.rb +37 -0
- data/spec/arachni/parser_spec.rb +166 -26
- data/spec/arachni/report_spec.rb +9 -2
- data/spec/arachni/rest/server_spec.rb +52 -6
- data/spec/arachni/rpc/server/active_options_spec.rb +1 -1
- data/spec/arachni/rpc/server/framework/distributor_spec.rb +6 -6
- data/spec/arachni/ruby/string_spec.rb +6 -0
- data/spec/arachni/session_spec.rb +69 -8
- data/spec/arachni/support/signature_spec.rb +58 -0
- data/spec/arachni/trainer_spec.rb +102 -21
- data/spec/arachni/uri_spec.rb +11 -8
- data/spec/arachni/utilities_spec.rb +3 -3
- data/spec/components/checks/active/csrf_spec.rb +1 -21
- data/spec/components/checks/active/path_traversal_spec.rb +12 -12
- data/spec/components/checks/active/sql_injection_spec.rb +10 -1
- data/spec/components/checks/active/unvalidated_redirect_spec.rb +6 -6
- data/spec/components/checks/active/xss_dom_script_context_spec.rb +1 -5
- data/spec/components/checks/active/xss_dom_spec.rb +2 -2
- data/spec/components/checks/active/xss_event_spec.rb +8 -2
- data/spec/components/checks/active/xss_script_context_spec.rb +5 -5
- data/spec/components/checks/active/xss_spec.rb +3 -3
- data/spec/components/checks/passive/backup_directories_spec.rb +3 -1
- data/spec/components/checks/passive/backup_files_spec.rb +8 -1
- data/spec/components/checks/passive/grep/insecure_cookies_spec.rb +2 -2
- data/spec/components/path_extractors/comments_spec.rb +3 -1
- data/spec/components/path_extractors/data_url_spec.rb +6 -2
- data/spec/components/path_extractors/links_spec.rb +1 -1
- data/spec/components/plugins/autologin_spec.rb +2 -2
- data/spec/components/plugins/webhook_notify_spec.rb +69 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/support/factories/page/dom.rb +6 -0
- data/spec/support/factories/scan_report.rb +1 -0
- data/spec/support/factories/vector.rb +7 -3
- data/spec/support/fixtures/check_with_invalid_platforms/with_invalid_platforms.rb +1 -1
- data/spec/support/fixtures/checks/test.rb +1 -1
- data/spec/support/fixtures/checks/test2.rb +1 -1
- data/spec/support/fixtures/checks/test3.rb +1 -1
- data/spec/support/fixtures/cookies.txt +2 -2
- data/spec/support/fixtures/fingerprinters/test.rb +1 -1
- data/spec/support/fixtures/plugins/bad.rb +1 -1
- data/spec/support/fixtures/plugins/defaults/default.rb +1 -1
- data/spec/support/fixtures/plugins/distributable.rb +1 -1
- data/spec/support/fixtures/plugins/loop.rb +1 -1
- data/spec/support/fixtures/plugins/suspendable.rb +1 -1
- data/spec/support/fixtures/plugins/wait.rb +1 -1
- data/spec/support/fixtures/plugins/with_options.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p0.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p00.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p1.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p2.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p22.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p222.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p_nil.rb +1 -1
- data/spec/support/fixtures/plugins_with_priorities/p_nil2.rb +1 -1
- data/spec/support/fixtures/report.afr +0 -0
- data/spec/support/fixtures/reporters/base_spec/plugin_formatters/with_formatters/foobar.rb +1 -1
- data/spec/support/fixtures/reporters/base_spec/with_formatters.rb +1 -1
- data/spec/support/fixtures/reporters/base_spec/with_outfile.rb +1 -1
- data/spec/support/fixtures/reporters/base_spec/without_outfile.rb +1 -1
- data/spec/support/fixtures/reporters/manager_spec/afr.rb +1 -1
- data/spec/support/fixtures/reporters/manager_spec/error.rb +1 -1
- data/spec/support/fixtures/reporters/manager_spec/foo.rb +1 -1
- data/spec/support/fixtures/run_check/body.rb +1 -1
- data/spec/support/fixtures/run_check/cookies.rb +1 -1
- data/spec/support/fixtures/run_check/empty.rb +1 -1
- data/spec/support/fixtures/run_check/flch.rb +1 -1
- data/spec/support/fixtures/run_check/forms.rb +1 -1
- data/spec/support/fixtures/run_check/headers.rb +1 -1
- data/spec/support/fixtures/run_check/links.rb +1 -1
- data/spec/support/fixtures/run_check/nil.rb +1 -1
- data/spec/support/fixtures/run_check/path.rb +1 -1
- data/spec/support/fixtures/run_check/server.rb +1 -1
- data/spec/support/fixtures/signature_check/signature.rb +1 -1
- data/spec/support/fixtures/wait_check/wait.rb +1 -1
- data/spec/support/helpers/browser_cluster/jobs/taint_tracer.rb +0 -3
- data/spec/support/helpers/framework.rb +1 -1
- data/spec/support/helpers/misc.rb +1 -1
- data/spec/support/helpers/paths.rb +1 -1
- data/spec/support/helpers/requires.rb +1 -1
- data/spec/support/helpers/resets.rb +1 -1
- data/spec/support/helpers/web_server.rb +1 -1
- data/spec/support/lib/factory.rb +1 -1
- data/spec/support/lib/web_server_client.rb +1 -1
- data/spec/support/lib/web_server_dispatcher.rb +1 -1
- data/spec/support/lib/web_server_manager.rb +4 -2
- data/spec/support/logs/Dispatcher - 1024-31864.log +10 -0
- data/spec/support/logs/Dispatcher - 1047-41465.log +10 -0
- data/spec/support/logs/Dispatcher - 1274-60799.log +64 -0
- data/spec/support/logs/Dispatcher - 1295-1058.log +44 -0
- data/spec/support/logs/Dispatcher - 1313-27076.log +40 -0
- data/spec/support/logs/Dispatcher - 1332-17127.log +35 -0
- data/spec/support/logs/Dispatcher - 1350-7351.log +29 -0
- data/spec/support/logs/Dispatcher - 1368-38528.log +22 -0
- data/spec/support/logs/Dispatcher - 1386-17419.log +14 -0
- data/spec/support/logs/Dispatcher - 31030-26156.log +10 -0
- data/spec/support/logs/Dispatcher - 321-27189.log +12 -0
- data/spec/support/logs/Dispatcher - 32353-50061.log +20 -0
- data/spec/support/logs/Dispatcher - 32450-61574.log +10 -0
- data/spec/support/logs/Dispatcher - 32470-53874.log +20 -0
- data/spec/support/logs/Dispatcher - 32491-10523.log +18 -0
- data/spec/support/logs/Dispatcher - 32509-8583.log +14 -0
- data/spec/support/logs/Dispatcher - 32536-21209.log +10 -0
- data/spec/support/logs/Dispatcher - 32556-53881.log +10 -0
- data/spec/support/logs/Dispatcher - 32579-49083.log +50 -0
- data/spec/support/logs/Dispatcher - 32761-20025.log +12 -0
- data/spec/support/logs/Dispatcher - 347-17512.log +12 -0
- data/spec/support/logs/Dispatcher - 3489-43230.log +24 -0
- data/spec/support/logs/Dispatcher - 3524-57459.log +26 -0
- data/spec/support/logs/Dispatcher - 3559-21544.log +20 -0
- data/spec/support/logs/Dispatcher - 3764-33844.log +25 -0
- data/spec/support/logs/Dispatcher - 3798-45350.log +26 -0
- data/spec/support/logs/Dispatcher - 382-15725.log +12 -0
- data/spec/support/logs/Dispatcher - 3836-6205.log +21 -0
- data/spec/support/logs/Dispatcher - 4112-45433.log +22 -0
- data/spec/support/logs/Dispatcher - 4148-53510.log +26 -0
- data/spec/support/logs/Dispatcher - 415-29873.log +14 -0
- data/spec/support/logs/Dispatcher - 4185-29736.log +18 -0
- data/spec/support/logs/Dispatcher - 4268-60912.log +25 -0
- data/spec/support/logs/Dispatcher - 4303-39372.log +26 -0
- data/spec/support/logs/Dispatcher - 4342-42190.log +21 -0
- data/spec/support/logs/Dispatcher - 463-55220.log +26 -0
- data/spec/support/logs/Dispatcher - 4649-12104.log +22 -0
- data/spec/support/logs/Dispatcher - 4683-32355.log +26 -0
- data/spec/support/logs/Dispatcher - 4724-41636.log +18 -0
- data/spec/support/logs/Dispatcher - 4881-57692.log +22 -0
- data/spec/support/logs/Dispatcher - 4961-64665.log +26 -0
- data/spec/support/logs/Dispatcher - 502-8742.log +25 -0
- data/spec/support/logs/Dispatcher - 5052-61726.log +18 -0
- data/spec/support/logs/Dispatcher - 536-15972.log +22 -0
- data/spec/support/logs/Dispatcher - 620-2220.log +20 -0
- data/spec/support/logs/Dispatcher - 638-17826.log +18 -0
- data/spec/support/logs/Dispatcher - 656-23967.log +16 -0
- data/spec/support/logs/Dispatcher - 700-15701.log +12 -0
- data/spec/support/logs/Dispatcher - 726-6080.log +10 -0
- data/spec/support/logs/Dispatcher - 749-56590.log +18 -0
- data/spec/support/logs/Dispatcher - 807-19073.log +18 -0
- data/spec/support/logs/Dispatcher - 871-8764.log +10 -0
- data/spec/support/logs/Dispatcher - 898-21496.log +12 -0
- data/spec/support/logs/Dispatcher - 933-64070.log +12 -0
- data/spec/support/logs/Instance - 1577-32284.error.log +151 -0
- data/spec/support/logs/Instance - 1625-58174.error.log +154 -0
- data/spec/support/logs/Instance - 2727-57968.error.log +151 -0
- data/spec/support/logs/Instance - 2898-20648.error.log +303 -0
- data/spec/support/logs/Instance - 2901-30845.error.log +429 -0
- data/spec/support/logs/Instance - 31185-37600.error.log +174 -0
- data/spec/support/logs/Instance - 3319-20111.error.log +175 -0
- data/spec/support/logs/error-3855.log +5132 -0
- data/spec/support/servers/arachni/browser.rb +275 -4
- data/spec/support/servers/arachni/browser/javascript/dom_monitor.rb +48 -0
- data/spec/support/servers/arachni/browser/javascript/taint_tracer.rb +15 -3
- data/spec/support/servers/arachni/check/auditor.rb +8 -0
- data/spec/support/servers/arachni/element/cookie.rb +34 -0
- data/spec/support/servers/arachni/element/form.rb +34 -0
- data/spec/support/servers/arachni/element/header.rb +36 -1
- data/spec/support/servers/arachni/element/json.rb +33 -0
- data/spec/support/servers/arachni/element/link.rb +33 -1
- data/spec/support/servers/arachni/element/link_template.rb +37 -5
- data/spec/support/servers/arachni/element/xml.rb +33 -0
- data/spec/support/servers/arachni/http/client.rb +43 -4
- data/spec/support/servers/arachni/http/client/dynamic_404_handler.rb +36 -0
- data/spec/support/servers/arachni/http/client/dynamic_404_handler_redirect_1.rb +18 -0
- data/spec/support/servers/arachni/http/client/dynamic_404_handler_redirect_2.rb +11 -0
- data/spec/support/servers/arachni/http/proxy_server.rb +12 -0
- data/spec/support/servers/arachni/session.rb +24 -1
- data/spec/support/servers/checks/active/csrf.rb +0 -76
- data/spec/support/servers/checks/active/sql_injection/java +2 -0
- data/spec/support/servers/checks/active/unvalidated_redirect.rb +81 -0
- data/spec/support/servers/checks/active/xss_event.rb +1 -1
- data/spec/support/servers/checks/passive/backup_files.rb +20 -1
- data/spec/support/servers/checks/passive/grep/cookie_set_for_parent_domain.rb +3 -5
- data/spec/support/servers/checks/passive/grep/insecure_cookies_https.rb +9 -0
- data/spec/support/servers/plugins/autologin.rb +17 -1
- data/spec/support/servers/plugins/webhook_notify.rb +9 -0
- data/spec/support/shared/element/capabilities/auditable.rb +26 -32
- data/spec/support/shared/element/capabilities/auditable/buffered.rb +791 -0
- data/spec/support/shared/element/capabilities/auditable/line_buffered.rb +797 -0
- data/spec/support/shared/element/capabilities/inputtable.rb +26 -0
- data/spec/support/shared/element/capabilities/with_node.rb +2 -2
- data/spec/support/shared/element/dom/submittable.rb +10 -10
- data/spec/support/shared/path_extractor.rb +17 -5
- data/ui/cli/framework.rb +24 -4
- data/ui/cli/framework/option_parser.rb +35 -6
- data/ui/cli/option_parser.rb +1 -1
- data/ui/cli/output.rb +10 -3
- data/ui/cli/reporter.rb +1 -1
- data/ui/cli/reporter/option_parser.rb +1 -1
- data/ui/cli/reproduce.rb +228 -0
- data/ui/cli/reproduce/option_parser.rb +90 -0
- data/ui/cli/rest/server.rb +1 -1
- data/ui/cli/rest/server/option_parser.rb +1 -1
- data/ui/cli/restored_framework.rb +1 -1
- data/ui/cli/restored_framework/option_parser.rb +1 -1
- data/ui/cli/rpc/client/dispatcher_monitor.rb +9 -11
- data/ui/cli/rpc/client/dispatcher_monitor/option_parser.rb +1 -1
- data/ui/cli/rpc/client/instance.rb +1 -1
- data/ui/cli/rpc/client/local.rb +1 -1
- data/ui/cli/rpc/client/local/option_parser.rb +1 -1
- data/ui/cli/rpc/client/remote.rb +1 -1
- data/ui/cli/rpc/client/remote/option_parser.rb +1 -1
- data/ui/cli/rpc/server/dispatcher.rb +1 -1
- data/ui/cli/rpc/server/dispatcher/option_parser.rb +1 -1
- data/ui/cli/utilities.rb +1 -1
- metadata +253 -49
- data/ACKNOWLEDGMENTS.md +0 -21
- data/AUTHORS.md +0 -3
- data/CONTRIBUTORS.md +0 -22
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arachni::Parser::Nodes::Element::WithAttributes::Attributes do
|
4
|
+
subject { described_class.new }
|
5
|
+
|
6
|
+
describe '#[]' do
|
7
|
+
it 'converts the key to string' do
|
8
|
+
subject[:key] = 'val'
|
9
|
+
|
10
|
+
expect(subject).to eq( 'key' => 'val' )
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'is case insensitive' do
|
14
|
+
subject[:kEy] = 'val'
|
15
|
+
|
16
|
+
expect(subject).to eq( 'key' => 'val' )
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#[]=' do
|
21
|
+
it 'converts the key to string' do
|
22
|
+
subject['key'] = 'val'
|
23
|
+
|
24
|
+
expect(subject).to eq( 'key' => 'val' )
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'is case insensitive' do
|
28
|
+
subject[:kEy] = 'val'
|
29
|
+
subject['key'] = 'val2'
|
30
|
+
|
31
|
+
expect(subject).to eq( 'key' => 'val2' )
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'freezes the value' do
|
35
|
+
subject['key'] = 'val'
|
36
|
+
|
37
|
+
expect(subject['key']).to be_frozen
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class WithAttributes
|
4
|
+
include Arachni::Parser::Nodes::Element::WithAttributes
|
5
|
+
end
|
6
|
+
|
7
|
+
describe Arachni::Parser::Nodes::Element::WithAttributes do
|
8
|
+
subject { WithAttributes.new }
|
9
|
+
|
10
|
+
describe '#attributes' do
|
11
|
+
it "returns #{described_class::Attributes}" do
|
12
|
+
expect(subject.attributes).to be_kind_of described_class::Attributes
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#[]' do
|
17
|
+
it 'converts the key to string' do
|
18
|
+
subject[:key] = 'val'
|
19
|
+
|
20
|
+
expect(subject.attributes).to eq( 'key' => 'val' )
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'is case insensitive' do
|
24
|
+
subject[:kEy] = 'val'
|
25
|
+
|
26
|
+
expect(subject.attributes).to eq( 'key' => 'val' )
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#[]=' do
|
31
|
+
it 'converts the key to string' do
|
32
|
+
subject['key'] = 'val'
|
33
|
+
|
34
|
+
expect(subject.attributes).to eq( 'key' => 'val' )
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'is case insensitive' do
|
38
|
+
subject[:kEy] = 'val'
|
39
|
+
subject['key'] = 'val2'
|
40
|
+
|
41
|
+
expect(subject.attributes).to eq( 'key' => 'val2' )
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'freezes the value' do
|
45
|
+
subject['key'] = 'val'
|
46
|
+
|
47
|
+
expect(subject['key']).to be_frozen
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arachni::Parser::Nodes::Element do
|
4
|
+
subject { described_class.new( name ) }
|
5
|
+
let(:name) { 'dIv' }
|
6
|
+
|
7
|
+
describe '#name' do
|
8
|
+
it 'returns the given value' do
|
9
|
+
expect(subject.name).to eq :div
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#to_html' do
|
14
|
+
it 'returns the given value' do
|
15
|
+
expect(subject.to_html).to eq "<div>\n</div>\n"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arachni::Parser::Nodes::Text do
|
4
|
+
subject { described_class.new( value ) }
|
5
|
+
let(:value) { 'my text' }
|
6
|
+
|
7
|
+
describe '#value' do
|
8
|
+
it 'returns the given value' do
|
9
|
+
expect(subject.value).to eq value
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#text' do
|
14
|
+
it 'returns the given value' do
|
15
|
+
expect(subject.text).to eq value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#to_html' do
|
20
|
+
it 'returns the given value' do
|
21
|
+
expect(subject.to_html).to eq "my text\n"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arachni::Parser::SAX do
|
4
|
+
let(:options) do
|
5
|
+
{
|
6
|
+
stop_on_first: []
|
7
|
+
}
|
8
|
+
end
|
9
|
+
let(:document) { Arachni::Parser.parse( html, options ) }
|
10
|
+
let(:html) do
|
11
|
+
<<-EOHTML
|
12
|
+
<html>
|
13
|
+
<div id="my-id">
|
14
|
+
<!-- My comment -->
|
15
|
+
<p class="my-class">
|
16
|
+
<a href="/stuff">Stuff</a>
|
17
|
+
</p>
|
18
|
+
|
19
|
+
My text
|
20
|
+
</div>
|
21
|
+
</html>
|
22
|
+
EOHTML
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'parses nodes' do
|
26
|
+
children = document.children
|
27
|
+
|
28
|
+
expect(children.size).to eq 1
|
29
|
+
|
30
|
+
html = children.first
|
31
|
+
expect(html).to be_kind_of Arachni::Parser::Nodes::Element
|
32
|
+
expect(html.name).to eq :html
|
33
|
+
expect(html.attributes).to be_empty
|
34
|
+
|
35
|
+
div = html.children.first
|
36
|
+
expect(div).to be_kind_of Arachni::Parser::Nodes::Element
|
37
|
+
expect(div.name).to eq :div
|
38
|
+
expect(div.attributes).to eq({ 'id' => 'my-id' })
|
39
|
+
|
40
|
+
comment = div.children[0]
|
41
|
+
expect(comment).to be_kind_of Arachni::Parser::Nodes::Comment
|
42
|
+
expect(comment.value).to eq 'My comment'
|
43
|
+
|
44
|
+
p = div.children[1]
|
45
|
+
expect(p).to be_kind_of Arachni::Parser::Nodes::Element
|
46
|
+
expect(p.name).to eq :p
|
47
|
+
expect(p.attributes).to eq({ 'class' => 'my-class' })
|
48
|
+
|
49
|
+
text = div.children[2]
|
50
|
+
expect(text).to be_kind_of Arachni::Parser::Nodes::Text
|
51
|
+
expect(text.value).to eq 'My text'
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#initialize' do
|
55
|
+
describe ':stop_on_first' do
|
56
|
+
let(:options) { super().merge( stop_on_first: [ 'div' ] ) }
|
57
|
+
let(:html) do
|
58
|
+
<<-EOHTML
|
59
|
+
<html>
|
60
|
+
<div>
|
61
|
+
<p>
|
62
|
+
<a href="/stuff">Stuff</a>
|
63
|
+
</p>
|
64
|
+
</div>
|
65
|
+
</html
|
66
|
+
EOHTML
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'stops parsing then it finds a matching element' do
|
70
|
+
expect(document.descendants.map(&:name)).to eq [:html, :div]
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'when multiple elements are specified' do
|
74
|
+
let(:options) { super().merge( stop_on_first: [ 'div', 'a' ] ) }
|
75
|
+
|
76
|
+
it 'stops on the first one' do
|
77
|
+
expect(document.descendants.map(&:name)).to eq [:html, :div]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#document' do
|
84
|
+
it 'returns the document' do
|
85
|
+
expect(document).to be_kind_of Arachni::Parser::Document
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arachni::Parser::WithChildren::Search do
|
4
|
+
let(:options) do
|
5
|
+
{}
|
6
|
+
end
|
7
|
+
subject { Arachni::Parser.parse( html, options ) }
|
8
|
+
let(:html) do
|
9
|
+
<<-EOHTML
|
10
|
+
<html>
|
11
|
+
<div id="my-id">
|
12
|
+
<!-- My comment -->
|
13
|
+
<p class="my-class">
|
14
|
+
<a href="/stuff">
|
15
|
+
<span data-id='deepest'>Deepest</span>
|
16
|
+
</a>
|
17
|
+
</p>
|
18
|
+
|
19
|
+
<span id='second-span'>Second span</span>
|
20
|
+
|
21
|
+
My text
|
22
|
+
</div>
|
23
|
+
</html>
|
24
|
+
EOHTML
|
25
|
+
end
|
26
|
+
|
27
|
+
def summarize( n )
|
28
|
+
if n.is_a? Arachni::Parser::Nodes::Element
|
29
|
+
[n.name, n.attributes]
|
30
|
+
else
|
31
|
+
[n.class, n.value]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#traverse' do
|
36
|
+
it 'passes each descendant node to the block' do
|
37
|
+
nodes = []
|
38
|
+
|
39
|
+
subject.traverse do |n|
|
40
|
+
nodes << summarize( n )
|
41
|
+
end
|
42
|
+
|
43
|
+
expect(nodes).to eq([
|
44
|
+
[:html, {}],
|
45
|
+
[:div, {"id"=>"my-id"}],
|
46
|
+
[Arachni::Parser::Nodes::Comment, "My comment"],
|
47
|
+
[:p, {"class"=>"my-class"}],
|
48
|
+
[:a, {"href"=>"/stuff"}],
|
49
|
+
[:span, {"data-id"=>"deepest"}],
|
50
|
+
[Arachni::Parser::Nodes::Text, "Deepest"],
|
51
|
+
[:span, {"id"=>"second-span"}],
|
52
|
+
[Arachni::Parser::Nodes::Text, "Second span"],
|
53
|
+
[Arachni::Parser::Nodes::Text, "My text"]
|
54
|
+
])
|
55
|
+
|
56
|
+
nodes = []
|
57
|
+
subject.children.first.children.first.children[1].traverse do |n|
|
58
|
+
nodes << summarize( n )
|
59
|
+
end
|
60
|
+
|
61
|
+
expect(nodes).to eq([
|
62
|
+
[:a, {"href"=>"/stuff"}],
|
63
|
+
[:span, {"data-id"=>"deepest"}],
|
64
|
+
[Arachni::Parser::Nodes::Text, "Deepest"]
|
65
|
+
])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#descendants' do
|
70
|
+
it 'returns all descendants' do
|
71
|
+
nodes = subject.descendants.map do |n|
|
72
|
+
summarize n
|
73
|
+
end
|
74
|
+
|
75
|
+
expect(nodes).to eq([
|
76
|
+
[:html, {}],
|
77
|
+
[:div, {"id"=>"my-id"}],
|
78
|
+
[Arachni::Parser::Nodes::Comment, "My comment"],
|
79
|
+
[:p, {"class"=>"my-class"}],
|
80
|
+
[:a, {"href"=>"/stuff"}],
|
81
|
+
[:span, {"data-id"=>"deepest"}],
|
82
|
+
[Arachni::Parser::Nodes::Text, "Deepest"],
|
83
|
+
[:span, {"id"=>"second-span"}],
|
84
|
+
[Arachni::Parser::Nodes::Text, "Second span"],
|
85
|
+
[Arachni::Parser::Nodes::Text, "My text"]
|
86
|
+
])
|
87
|
+
|
88
|
+
nodes = []
|
89
|
+
subject.children.first.children.first.children[1].descendants.each do |n|
|
90
|
+
nodes << summarize( n )
|
91
|
+
end
|
92
|
+
|
93
|
+
expect(nodes).to eq([
|
94
|
+
[:a, {"href"=>"/stuff"}],
|
95
|
+
[:span, {"data-id"=>"deepest"}],
|
96
|
+
[Arachni::Parser::Nodes::Text, "Deepest"]
|
97
|
+
])
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe '#nodes_by_name' do
|
102
|
+
it 'returns all descendant nodes that have the given tag name' do
|
103
|
+
nodes = subject.nodes_by_name( :span ).map { |n| summarize n }
|
104
|
+
expect(nodes).to eq([
|
105
|
+
[:span, {"data-id"=>"deepest"}],
|
106
|
+
[:span, {"id"=>"second-span"}]
|
107
|
+
])
|
108
|
+
|
109
|
+
nodes = subject.nodes_by_name( :a ).first.
|
110
|
+
nodes_by_name( :span ).map { |n| summarize n }
|
111
|
+
|
112
|
+
expect(nodes).to eq([
|
113
|
+
[:span, {"data-id"=>"deepest"}]
|
114
|
+
])
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe '#nodes_by_names' do
|
119
|
+
it 'returns all descendant nodes that have the given tag names' do
|
120
|
+
nodes = subject.nodes_by_names( :span, :a ).map { |n| summarize n }
|
121
|
+
expect(nodes).to eq([
|
122
|
+
[:span, {"data-id"=>"deepest"}],
|
123
|
+
[:span, {"id"=>"second-span"}],
|
124
|
+
[:a, {"href"=>"/stuff"}]
|
125
|
+
])
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe '#nodes_by_attribute_name' do
|
130
|
+
it 'returns all descendant nodes that have the given attribute name' do
|
131
|
+
nodes = subject.nodes_by_attribute_name( 'data-id' ).map { |n| summarize n }
|
132
|
+
expect(nodes).to eq([
|
133
|
+
[:span, {"data-id"=>"deepest"}],
|
134
|
+
])
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe '#nodes_by_attribute_name_and_value' do
|
139
|
+
it 'returns all descendant nodes that have the given attribute name' do
|
140
|
+
nodes = subject.nodes_by_attribute_name_and_value( 'id', 'second-span' ).map { |n| summarize n }
|
141
|
+
expect(nodes).to eq([
|
142
|
+
[:span, {"id"=>"second-span"}],
|
143
|
+
])
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arachni::Parser::WithChildren do
|
4
|
+
subject { Arachni::Parser::Nodes::Element.new( :stuff ) }
|
5
|
+
|
6
|
+
describe '#children' do
|
7
|
+
context 'by default' do
|
8
|
+
it 'is empty' do
|
9
|
+
expect(subject.children).to be_empty
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#parent' do
|
15
|
+
context 'by default' do
|
16
|
+
let(:html) { '' }
|
17
|
+
|
18
|
+
it 'is empty' do
|
19
|
+
expect(subject.children).to be_empty
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#<<' do
|
25
|
+
let(:other) { Arachni::Parser::Nodes::Element.new( :stuff ) }
|
26
|
+
|
27
|
+
it 'adds a child' do
|
28
|
+
subject << other
|
29
|
+
expect(subject.children).to eq [other]
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'sets the #parent on the child' do
|
33
|
+
subject << other
|
34
|
+
expect(other.parent).to eq subject
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/arachni/parser_spec.rb
CHANGED
@@ -20,8 +20,52 @@ describe Arachni::Parser do
|
|
20
20
|
Arachni::HTTP::Client.reset
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
let(:document) { described_class.parse response.body }
|
24
|
+
let(:response) { @response }
|
24
25
|
subject { Arachni::Parser.new( response ) }
|
26
|
+
let(:from_response) { Arachni::Parser.new( response ) }
|
27
|
+
let(:from_document) { Arachni::Parser.new( document ) }
|
28
|
+
|
29
|
+
describe '#initialize' do
|
30
|
+
context 'Arachni::Parser::Document' do
|
31
|
+
subject { from_document }
|
32
|
+
|
33
|
+
it 'sets it as #document' do
|
34
|
+
expect(subject.document).to eq document
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'Arachni::HTTP::Response' do
|
39
|
+
subject { from_response }
|
40
|
+
|
41
|
+
it 'parses it' do
|
42
|
+
expect(subject.body).to eq response.body
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'Array of Arachni::HTTP::Response' do
|
47
|
+
subject do
|
48
|
+
described_class.new(
|
49
|
+
[response,
|
50
|
+
Arachni::HTTP::Client.get( @url, mode: :sync )]
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'parses the first' do
|
55
|
+
expect(subject.body).to eq response.body
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#response=' do
|
61
|
+
subject { described_class.new( document ) }
|
62
|
+
|
63
|
+
it 'sets the response' do
|
64
|
+
expect(subject.response).to be_nil
|
65
|
+
subject.response = response
|
66
|
+
expect(subject.response).to eq response
|
67
|
+
end
|
68
|
+
end
|
25
69
|
|
26
70
|
describe '#url' do
|
27
71
|
it 'holds the effective URL of the response' do
|
@@ -36,6 +80,27 @@ describe Arachni::Parser do
|
|
36
80
|
end
|
37
81
|
end
|
38
82
|
|
83
|
+
describe '#body' do
|
84
|
+
context 'when the body has been explicitly set' do
|
85
|
+
it 'returns it' do
|
86
|
+
subject.body = 'blah'
|
87
|
+
expect(subject.body). to eq 'blah'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'when the parser was initialized from an HTTP::Response' do
|
92
|
+
it 'returns the response body' do
|
93
|
+
expect(from_response.body). to eq response.body
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context 'when the parser was initialized from a Document' do
|
98
|
+
it 'returns nil' do
|
99
|
+
expect(from_document.body). to be_nil
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
39
104
|
describe '#body=' do
|
40
105
|
let(:response) do
|
41
106
|
Arachni::HTTP::Response.new(
|
@@ -46,7 +111,7 @@ describe Arachni::Parser do
|
|
46
111
|
end
|
47
112
|
|
48
113
|
it 'overrides the body of the HTTP response for the parsing process' do
|
49
|
-
subject.body = '<a href="/?name2=val2">Stuff</a>'
|
114
|
+
subject.body = '<html><div><a href="/?name2=val2">Stuff</a></div></html>'
|
50
115
|
expect(subject.links.size).to eq(1)
|
51
116
|
expect(subject.links.first.inputs).to eq({ 'name2' => 'val2' })
|
52
117
|
end
|
@@ -142,39 +207,54 @@ describe Arachni::Parser do
|
|
142
207
|
end
|
143
208
|
|
144
209
|
describe '#text?' do
|
145
|
-
context 'when the
|
146
|
-
|
147
|
-
|
210
|
+
context 'when the parser was initialized from an HTTP::Response' do
|
211
|
+
context 'when the response is text based' do
|
212
|
+
it { expect(subject.text?).to be_truthy }
|
213
|
+
end
|
148
214
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
215
|
+
context 'when the response is not text based' do
|
216
|
+
let(:response) do
|
217
|
+
Arachni::HTTP::Response.new( url: @url, headers: {
|
218
|
+
'Content-Type' => 'bin/stuff'
|
219
|
+
})
|
220
|
+
end
|
221
|
+
it { expect(subject.text?).to be_falsey }
|
154
222
|
end
|
155
|
-
it { expect(subject.text?).to be_falsey }
|
156
223
|
end
|
157
|
-
end
|
158
224
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
subject.document.class == Nokogiri::HTML::Document
|
225
|
+
context 'when the parser was initialized from a Document' do
|
226
|
+
it 'returns true' do
|
227
|
+
expect(from_document).to be_text
|
163
228
|
end
|
164
229
|
end
|
230
|
+
end
|
165
231
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
232
|
+
describe '#document' do
|
233
|
+
context 'when the parser was initialized with an HTTP::Response' do
|
234
|
+
context 'when the response is text based' do
|
235
|
+
it 'returns the parsed document' do
|
236
|
+
subject.document.class == Nokogiri::HTML::Document
|
237
|
+
end
|
171
238
|
end
|
172
239
|
|
173
|
-
|
174
|
-
|
240
|
+
context 'when the response is not text based' do
|
241
|
+
let(:response) do
|
242
|
+
Arachni::HTTP::Response.new( url: @url, headers: {
|
243
|
+
'Content-Type' => 'bin/stuff'
|
244
|
+
})
|
245
|
+
end
|
246
|
+
|
247
|
+
it 'returns nil' do
|
248
|
+
expect(subject.document).to be_nil
|
249
|
+
end
|
175
250
|
end
|
176
251
|
end
|
177
252
|
|
253
|
+
context 'when the parser was initialized with a Document' do
|
254
|
+
it 'returns it' do
|
255
|
+
expect(from_document.document). to eq document
|
256
|
+
end
|
257
|
+
end
|
178
258
|
end
|
179
259
|
|
180
260
|
describe '#links' do
|
@@ -283,7 +363,7 @@ describe Arachni::Parser do
|
|
283
363
|
responses << Arachni::HTTP::Client.get( @opts.url + 'with_nonce', mode: :sync )
|
284
364
|
responses << Arachni::HTTP::Client.get( @opts.url + 'with_nonce', mode: :sync )
|
285
365
|
|
286
|
-
parser = Arachni::Parser.new( responses
|
366
|
+
parser = Arachni::Parser.new( responses )
|
287
367
|
expect(parser.forms.map { |f| f.nonce_name }.sort).to eq(%w(nonce nonce2).sort)
|
288
368
|
end
|
289
369
|
end
|
@@ -385,6 +465,25 @@ describe Arachni::Parser do
|
|
385
465
|
end
|
386
466
|
|
387
467
|
describe '#paths' do
|
468
|
+
context 'when it includes mailto: links' do
|
469
|
+
let(:response) do
|
470
|
+
Arachni::HTTP::Response.new(
|
471
|
+
url: @opts.url,
|
472
|
+
body: '
|
473
|
+
<html>
|
474
|
+
<body>
|
475
|
+
<a href="' + @opts.url + '/test2/param/myvalue"></a>
|
476
|
+
<a href="mailto:name@address.com"></a>
|
477
|
+
</body>
|
478
|
+
</html>'
|
479
|
+
)
|
480
|
+
end
|
481
|
+
|
482
|
+
it 'ignores them' do
|
483
|
+
expect(subject.paths).to eq([@opts.url + 'test2/param/myvalue'])
|
484
|
+
end
|
485
|
+
end
|
486
|
+
|
388
487
|
context 'when an error occurs' do
|
389
488
|
it 'returns an empty array' do
|
390
489
|
allow(described_class).to receive(:extractors){ raise }
|
@@ -395,8 +494,8 @@ describe Arachni::Parser do
|
|
395
494
|
|
396
495
|
context 'without base' do
|
397
496
|
describe '#base' do
|
398
|
-
it 'returns
|
399
|
-
expect(subject.base).to eq(
|
497
|
+
it 'returns the response URL' do
|
498
|
+
expect(subject.base).to eq(subject.response.url)
|
400
499
|
end
|
401
500
|
end
|
402
501
|
|
@@ -502,6 +601,16 @@ describe Arachni::Parser do
|
|
502
601
|
subject.response.request.headers['X-Custom-Header'] = 'My-stuff'
|
503
602
|
expect(subject.headers.find { |h| h.name == 'X-Custom-Header' }).to be_truthy
|
504
603
|
end
|
604
|
+
|
605
|
+
it "excludes #{Arachni::HTTP::Client::SEED_HEADER_NAME}" do
|
606
|
+
subject.response.request.headers[Arachni::HTTP::Client::SEED_HEADER_NAME] = 'My-stuff'
|
607
|
+
expect(subject.headers.find { |h| h.name == Arachni::HTTP::Client::SEED_HEADER_NAME }).to be_falsey
|
608
|
+
end
|
609
|
+
|
610
|
+
it 'excludes Content-Type' do
|
611
|
+
subject.response.request.headers['Content-Length'] = '123'
|
612
|
+
expect(subject.headers.find { |h| h.name == 'Content-Length' }).to be_falsey
|
613
|
+
end
|
505
614
|
end
|
506
615
|
|
507
616
|
describe '#link_vars' do
|
@@ -533,4 +642,35 @@ describe Arachni::Parser do
|
|
533
642
|
end
|
534
643
|
end
|
535
644
|
|
645
|
+
describe '.markup?' do
|
646
|
+
context 'when dealing with markup' do
|
647
|
+
it 'returns true' do
|
648
|
+
expect(described_class.markup?( '<stuff></stuff>' )).to be_truthy
|
649
|
+
end
|
650
|
+
end
|
651
|
+
|
652
|
+
context 'when not dealing with markup' do
|
653
|
+
it 'returns false' do
|
654
|
+
expect(described_class.markup?( 'stuff' )).to be_falsey
|
655
|
+
end
|
656
|
+
|
657
|
+
context 'but includes markup' do
|
658
|
+
it 'returns false' do
|
659
|
+
s = { test: '<stuff></stuff>' }.to_json
|
660
|
+
expect(described_class.markup?( s )).to be_falsey
|
661
|
+
|
662
|
+
expect(described_class.markup?( 'blah <stuff></stuff>' )).to be_falsey
|
663
|
+
end
|
664
|
+
|
665
|
+
context 'and begins with a doctype' do
|
666
|
+
it 'returns false' do
|
667
|
+
s = { test: '<stuff></stuff>' }.to_json
|
668
|
+
s = "<!DOCTYPE html>#{s}"
|
669
|
+
|
670
|
+
expect(described_class.markup?( s )).to be_falsey
|
671
|
+
end
|
672
|
+
end
|
673
|
+
end
|
674
|
+
end
|
675
|
+
end
|
536
676
|
end
|