From bf12c08ef46a555cfb024b68088b4fa322619b00 Mon Sep 17 00:00:00 2001 From: Q_back Date: Mon, 4 May 2020 18:14:44 +0200 Subject: [PATCH 01/41] ignore __pychace__/ and another script file pattern (for tests) --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 84738c9bce..f87c5ef342 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.py[cod] *.py~ +__pycache__/ *~ *.swp @@ -69,6 +70,7 @@ top-1m.csv.zip # To make testing easier test.w3af output-w3af.txt +w3af-script-* # Ignore some profiling data *.dump @@ -100,4 +102,4 @@ ysoserial-0.0.6-SNAPSHOT-all.jar node_modules/ # Ignore scan logs -scan-logs/ \ No newline at end of file +scan-logs/ From fa7f7438d5b902219dd4fe91c29bad351c6cc185 Mon Sep 17 00:00:00 2001 From: Q_back Date: Fri, 8 May 2020 12:11:36 +0200 Subject: [PATCH 02/41] automatically marked slow and deprecated tests, added pytest.ini --- conftest.py | 0 pytest.ini | 5 ++ .../auto_update/tests/test_changelog.py | 1 + .../auto_update/tests/test_git_client.py | 3 + .../auto_update/tests/test_update_utils.py | 3 + .../auto_update/tests/test_version_manager.py | 3 + .../bruteforce/tests/test_bruteforcer.py | 1 + .../consumers/tests/test_audit.py | 2 + .../consumers/tests/test_base_consumer.py | 2 + .../tests/test_crawl_infrastructure.py | 2 + .../core_helpers/consumers/tests/test_grep.py | 1 + .../tests/test_404_fuzzy_string_match.py | 1 + .../not_found/tests/test_fingerprint_404.py | 13 ++++ .../tests/test_fingerprint_404_perf.py | 1 + .../tests/test_fuzzy_equal_for_diff.py | 1 + .../tests/test_generate_404_filename.py | 2 + .../not_found/tests/test_get_clean_body.py | 1 + .../not_found/tests/test_response.py | 1 + .../tests/test_disk_space_observer.py | 1 + .../tests/test_thread_state_observer.py | 2 + .../tests/test_exception_handler.py | 6 ++ .../core_helpers/tests/test_plugins.py | 1 + .../core_helpers/tests/test_profiles.py | 6 ++ .../core_helpers/tests/test_status.py | 2 + .../core_helpers/tests/test_strategy.py | 5 ++ .../tests/test_strategy_low_level.py | 7 ++ .../core_helpers/tests/test_target.py | 1 + .../controllers/cors/tests/test_cors_utils.py | 2 + .../controllers/csp/tests/test_csp_utils.py | 1 + .../proxy/tests/test_intercept_proxy.py | 5 ++ .../daemons/proxy/tests/test_proxy.py | 5 ++ .../daemons/tests/test_webserver.py | 1 + .../tests/test_aprox_delay_controller.py | 2 + .../tests/test_exact_delay_controller.py | 1 + .../platforms/tests/test_all_platforms.py | 1 + .../platforms/tests/test_current_platform.py | 1 + .../tests/test_dependencies.py | 1 + .../tests/test_dependency_check.py | 5 ++ .../tests/test_helper_requirements_txt.py | 3 +- .../tests/test_latest_vulndb.py | 2 + .../tests/test_github_issues.py | 3 + .../tests/test_cleanup_bug_report.py | 1 + .../tests/test_extrusion_scanner.py | 2 + .../tests/test_execMethodHelpers.py | 1 + .../misc/tests/test_common_attack_methods.py | 1 + .../misc/tests/test_contains_source_code.py | 1 + w3af/core/controllers/misc/tests/test_diff.py | 1 + .../misc/tests/test_diff_performance.py | 3 + .../misc/tests/test_fuzzy_string_cmp.py | 1 + .../misc/tests/test_get_w3af_version.py | 2 + w3af/core/controllers/misc/tests/test_io.py | 1 + .../misc/tests/test_is_ip_address.py | 1 + .../misc/tests/test_is_private_site.py | 3 + .../controllers/misc/tests/test_make_leet.py | 1 + .../core/controllers/misc/tests/test_which.py | 1 + .../tests/test_output_manager.py | 2 + .../tests/test_clientless_reverse_http.py | 1 + .../payload_transfer/tests/test_echo_linux.py | 1 + .../plugins/tests/test_404_errors.py | 3 + .../plugins/tests/test_audit_plugin.py | 3 + .../controllers/plugins/tests/test_plugin.py | 1 + .../profiling/tests/test_thread_time.py | 1 + .../profiling/tests/test_took_helper.py | 3 + w3af/core/controllers/sca/tests/test_sca.py | 1 + .../core_test_suite/test_core_exceptions.py | 4 ++ .../core_test_suite/test_exception_handler.py | 1 + .../core_test_suite/test_history_access.py | 2 + .../test_multiple_instances.py | 1 + .../tests/core_test_suite/test_pause_stop.py | 4 ++ .../controllers/tests/test_misc_settings.py | 1 + w3af/core/controllers/tests/test_pylint.py | 5 ++ .../controllers/tests/test_special_chars.py | 2 + w3af/core/controllers/tests/test_w3af_gui.py | 1 + .../threads/tests/test_is_main_process.py | 1 + .../threads/tests/test_is_main_thread.py | 1 + .../tests/test_pebble_limit_memory_usage.py | 5 ++ .../threads/tests/test_return_args.py | 1 + .../threads/tests/test_threadpool.py | 5 ++ .../bloomfilter/tests/generic_filter_test.py | 1 + .../tests/test_bloomfilter_impl_selection.py | 1 + .../bloomfilter/tests/test_cmmap_bloom.py | 2 + .../tests/test_scalable_performance.py | 1 + .../tests/test_file_templates.py | 1 + w3af/core/data/constants/tests/test_all.py | 1 + .../tests/test_common_directories.py | 1 + w3af/core/data/constants/tests/test_vulns.py | 3 + w3af/core/data/context/tests/test_css.py | 1 + w3af/core/data/context/tests/test_html.py | 1 + w3af/core/data/context/tests/test_html_css.py | 1 + .../context/tests/test_html_javascript.py | 2 + .../data/context/tests/test_javascript.py | 1 + .../data/db/tests/test_cached_disk_dict.py | 1 + w3af/core/data/db/tests/test_dbms.py | 1 + w3af/core/data/db/tests/test_disk_deque.py | 1 + w3af/core/data/db/tests/test_disk_dict.py | 2 + w3af/core/data/db/tests/test_disk_list.py | 8 +++ w3af/core/data/db/tests/test_disk_set.py | 1 + w3af/core/data/db/tests/test_history.py | 13 ++++ w3af/core/data/db/tests/test_startup_cfg.py | 1 + w3af/core/data/db/tests/test_url_tree.py | 1 + w3af/core/data/db/tests/test_variant_db.py | 2 + .../dc/generic/tests/test_data_container.py | 1 + w3af/core/data/dc/generic/tests/test_form.py | 1 + .../dc/generic/tests/test_kv_container.py | 2 + .../dc/generic/tests/test_nr_kv_container.py | 2 + w3af/core/data/dc/generic/tests/test_plain.py | 1 + w3af/core/data/dc/tests/test_cookie.py | 1 + .../tests/test_data_container_subclasses.py | 1 + w3af/core/data/dc/tests/test_factory.py | 1 + w3af/core/data/dc/tests/test_headers.py | 1 + .../core/data/dc/tests/test_json_container.py | 1 + w3af/core/data/dc/tests/test_multipart.py | 1 + w3af/core/data/dc/tests/test_query_string.py | 1 + .../data/dc/tests/test_urlencoded_form.py | 1 + w3af/core/data/dc/tests/test_xmlrpc.py | 1 + .../dc/utils/tests/test_json_iter_setters.py | 1 + .../data/dc/utils/tests/test_multipart.py | 1 + w3af/core/data/dc/utils/tests/test_token.py | 1 + .../data/export/tests/test_ajax_export.py | 1 + .../data/export/tests/test_html_export.py | 1 + .../data/export/tests/test_python_export.py | 1 + .../data/export/tests/test_ruby_export.py | 1 + .../mutants/tests/test_cookie_mutant.py | 1 + .../fuzzer/mutants/tests/test_empty_mutant.py | 1 + .../mutants/tests/test_filecontent_mutant.py | 1 + .../mutants/tests/test_filename_mutant.py | 1 + .../mutants/tests/test_headers_mutants.py | 1 + .../fuzzer/mutants/tests/test_json_mutant.py | 1 + .../data/fuzzer/mutants/tests/test_mutant.py | 1 + .../mutants/tests/test_postdata_mutant.py | 1 + .../mutants/tests/test_querystring_mutant.py | 1 + .../mutants/tests/test_urlparts_mutant.py | 2 + .../mutants/tests/test_xmlrpc_mutant.py | 1 + .../data/fuzzer/tests/test_form_filler.py | 1 + w3af/core/data/fuzzer/tests/test_fuzzer.py | 3 + .../data/fuzzer/tests/test_fuzzer_utils.py | 1 + w3af/core/data/kb/tests/test_exec_shell.py | 1 + w3af/core/data/kb/tests/test_info.py | 2 + w3af/core/data/kb/tests/test_info_set.py | 1 + .../core/data/kb/tests/test_knowledge_base.py | 69 +++++++++++++++++++ w3af/core/data/kb/tests/test_read_shell.py | 1 + .../data/kb/tests/test_update_urls_in_kb.py | 2 + w3af/core/data/kb/tests/test_vuln.py | 1 + .../tests/test_base_template.py | 1 + .../vuln_templates/tests/test_dav_template.py | 2 + .../tests/test_template_utils.py | 1 + .../core/data/misc/tests/test_cached_queue.py | 2 + w3af/core/data/misc/tests/test_encoding.py | 1 + w3af/core/data/misc/tests/test_file_utils.py | 1 + .../data/misc/tests/test_mask_password.py | 1 + .../misc/tests/test_ordered_cached_queue.py | 2 + w3af/core/data/misc/tests/test_smart_queue.py | 4 ++ w3af/core/data/misc/tests/test_xml_bones.py | 1 + .../nltk_wrapper/tests/test_nltk_wrapper.py | 1 + .../options/tests/test_form_id_list_option.py | 1 + .../data/options/tests/test_header_option.py | 1 + .../options/tests/test_input_file_option.py | 1 + .../data/options/tests/test_opt_factory.py | 2 + .../options/tests/test_query_string_option.py | 1 + .../doc/open_api/tests/test_fuzzing.py | 1 + .../parsers/doc/open_api/tests/test_main.py | 1 + .../doc/open_api/tests/test_requests.py | 1 + .../doc/open_api/tests/test_specification.py | 1 + .../data/parsers/doc/tests/test_baseparser.py | 1 + .../doc/tests/test_complex_html_form.py | 1 + .../parsers/doc/tests/test_cookie_parser.py | 1 + w3af/core/data/parsers/doc/tests/test_html.py | 1 + .../doc/tests/test_htmlparser_performance.py | 2 + .../doc/tests/test_http_request_parser.py | 1 + .../data/parsers/doc/tests/test_javascript.py | 3 + w3af/core/data/parsers/doc/tests/test_pdf.py | 1 + w3af/core/data/parsers/doc/tests/test_sgml.py | 1 + w3af/core/data/parsers/doc/tests/test_swf.py | 2 + w3af/core/data/parsers/doc/tests/test_url.py | 3 + .../data/parsers/doc/tests/test_wml_parser.py | 1 + .../data/parsers/doc/tests/test_xmlrpc.py | 1 + .../pynarcissus/tests/test_link_extractor.py | 1 + .../tests/test_string_extractor.py | 1 + .../parsers/tests/test_document_parser.py | 1 + .../parsers/tests/test_mp_document_parser.py | 9 +++ .../data/parsers/tests/test_parser_cache.py | 7 ++ .../parsers/utils/tests/test_encode_decode.py | 1 + .../data/parsers/utils/tests/test_form_id.py | 1 + .../utils/tests/test_form_id_matcher.py | 1 + .../parsers/utils/tests/test_form_params.py | 3 + .../utils/tests/test_header_link_extract.py | 1 + .../parsers/utils/tests/test_re_extract.py | 1 + .../parsers/utils/tests/test_url_regex.py | 1 + w3af/core/data/profile/tests/test_profile.py | 1 + .../data/quick_match/tests/test_multi_in.py | 1 + .../data/quick_match/tests/test_multire.py | 1 + .../tests/test_create_fuzzable_request.py | 1 + .../data/request/tests/test_empty_request.py | 1 + .../request/tests/test_fuzzable_request.py | 2 + .../tests/test_variant_identification.py | 1 + .../data/search_engines/tests/test_bing.py | 3 + .../data/search_engines/tests/test_google.py | 6 ++ w3af/core/data/statistics/tests/test_utils.py | 1 + .../data/url/handlers/tests/test_errors.py | 2 + .../data/url/handlers/tests/test_keepalive.py | 3 + .../data/url/handlers/tests/test_mangle.py | 2 + .../data/url/handlers/tests/test_multipart.py | 5 ++ .../data/url/handlers/tests/test_ntlm_auth.py | 2 + .../data/url/handlers/tests/test_redirect.py | 1 + .../url/handlers/tests/test_url_parameter.py | 2 + .../openssl_wrapper/tests/test_ssl_wrapper.py | 3 + .../tests/helpers/tests/test_http_daemon.py | 1 + .../tests/helpers/tests/test_ssl_daemon.py | 1 + .../tests/helpers/tests/test_upper_daemon.py | 1 + w3af/core/data/url/tests/test_HTTPRequest.py | 2 + w3af/core/data/url/tests/test_HTTPResponse.py | 1 + .../data/url/tests/test_get_average_rtt.py | 3 + .../data/url/tests/test_get_clean_body.py | 1 + .../data/url/tests/test_opener_settings.py | 2 + w3af/core/data/url/tests/test_xurllib.py | 14 ++++ .../url/tests/test_xurllib_error_handling.py | 4 ++ .../url/tests/test_xurllib_integration.py | 6 ++ .../core/data/url/tests/test_xurllib_proxy.py | 3 + .../data/url/tests/test_xurllib_timeout.py | 3 + .../tests/test_random_user_agent.py | 1 + .../tests/test_string_representation.py | 1 + w3af/core/ui/api/tests/test_auth.py | 1 + w3af/core/ui/api/tests/test_exceptions.py | 6 +- .../ui/api/tests/test_fuzzable_requests.py | 2 + .../ui/api/tests/test_integration_scan.py | 6 ++ w3af/core/ui/api/tests/test_kb.py | 2 + w3af/core/ui/api/tests/test_log.py | 2 + w3af/core/ui/api/tests/test_require_json.py | 3 + w3af/core/ui/api/tests/test_urls.py | 2 + w3af/core/ui/api/tests/test_version.py | 2 + w3af/core/ui/console/tests/test_basic.py | 9 +++ w3af/core/ui/console/tests/test_bug_report.py | 2 + w3af/core/ui/console/tests/test_ctrl_c.py | 3 + w3af/core/ui/console/tests/test_exploit.py | 2 + w3af/core/ui/console/tests/test_kb_add.py | 4 ++ w3af/core/ui/console/tests/test_profiles.py | 10 +++ w3af/core/ui/console/tests/test_save.py | 5 ++ w3af/core/ui/console/tests/test_scan_run.py | 3 + .../ui/console/tests/test_w3af_console.py | 1 + .../ui/console/tests/test_wrapped_w3af.py | 1 + w3af/core/ui/gui/tests/test_history.py | 4 +- .../tests/gui/auto_update/test_auto_update.py | 2 + .../test_disclaimer_accept.py | 4 ++ .../gui/encode_decode/test_encode_decode.py | 4 ++ .../core/ui/tests/gui/exploit/test_exploit.py | 2 + .../test_exploit_from_template.py | 2 + .../gui/export_request/test_export_request.py | 2 + .../test_fuzzy_request_editor.py | 5 ++ .../invalid_target_url/test_invalid_url.py | 3 + .../tests/gui/main_window/test_main_window.py | 5 ++ .../manual_requests/test_manual_requests.py | 5 ++ .../tests/gui/new_profile/test_new_profile.py | 2 + .../no_plugins_scan/test_no_plugins_scan.py | 2 + .../profile_loading/test_profile_loading.py | 2 + w3af/core/ui/tests/gui/proxy/test_proxy.py | 3 + .../gui/request_help/test_request_help.py | 2 + .../scan_offline_url/test_scan_offline_url.py | 2 + .../tests/gui/tools_menu/test_click_menu.py | 2 + .../ui/tests/gui/two_scans/test_two_scans.py | 2 + w3af/core/ui/tests/test_fuzzygen.py | 1 + .../tests/wrappers/tests/test_xvfb_server.py | 16 ++++- .../attack/db/tests/test_sqlmap_update.py | 2 + .../attack/db/tests/test_sqlmap_wrapper.py | 11 +++ .../tests/test_apache_config_directory.py | 2 + .../tests/test_apache_config_files.py | 6 +- .../payloads/tests/test_apache_htaccess.py | 6 +- .../tests/test_apache_mod_security.py | 8 ++- .../tests/test_apache_root_directory.py | 6 +- .../payloads/tests/test_apache_run_group.py | 2 + .../payloads/tests/test_apache_run_user.py | 2 + .../payloads/tests/test_apache_ssl.py | 7 +- .../payloads/tests/test_apache_version.py | 7 +- .../payloads/payloads/tests/test_arp_cache.py | 4 ++ .../payloads/payloads/tests/test_cpu_info.py | 6 +- .../payloads/tests/test_current_user.py | 2 + .../payloads/tests/test_dhcp_config_files.py | 7 +- .../payloads/tests/test_dns_config_files.py | 7 +- .../payloads/tests/test_domainname.py | 4 ++ .../payloads/tests/test_filesystem.py | 4 ++ .../payloads/tests/test_firefox_stealer.py | 6 +- .../payloads/tests/test_ftp_config_files.py | 7 +- .../payloads/tests/test_gcc_version.py | 6 +- .../payloads/tests/test_get_hashes.py | 4 ++ .../payloads/tests/test_get_source_code.py | 6 +- .../payloads/payloads/tests/test_hostname.py | 6 +- .../payloads/payloads/tests/test_hosts.py | 2 + .../payloads/tests/test_iis_root_directory.py | 7 +- .../payloads/tests/test_interesting_files.py | 4 ++ .../payloads/payloads/tests/test_is_root.py | 2 + .../tests/test_kerberos_config_files.py | 7 +- .../payloads/tests/test_kernel_version.py | 6 +- .../payloads/tests/test_ldap_config_files.py | 3 + .../tests/test_list_kernel_modules.py | 6 +- .../payloads/tests/test_list_processes.py | 4 ++ .../payloads/tests/test_log_reader.py | 6 +- .../payloads/tests/test_mail_config_files.py | 6 +- .../payloads/tests/test_mysql_config.py | 2 + .../tests/test_mysql_config_directory.py | 2 + .../payloads/tests/test_netcat_installed.py | 4 ++ .../payloads/tests/test_os_fingerprint.py | 4 ++ .../payloads/tests/test_payload_handler.py | 1 + .../payloads/payloads/tests/test_php_sca.py | 6 +- .../payloads/payloads/tests/test_pixy.py | 7 +- .../payloads/payloads/tests/test_portscan.py | 6 +- .../payloads/payloads/tests/test_read_mail.py | 6 +- .../payloads/tests/test_root_login_allowed.py | 4 ++ .../payloads/tests/test_rootkit_hunter.py | 6 +- .../payloads/payloads/tests/test_route.py | 4 ++ .../payloads/tests/test_running_honeypot.py | 7 +- .../payloads/tests/test_running_vm.py | 4 ++ .../payloads/tests/test_smb_config_files.py | 4 ++ .../payloads/payloads/tests/test_spider.py | 4 ++ .../payloads/tests/test_ssh_config_files.py | 2 + .../payloads/tests/test_ssh_version.py | 4 ++ .../payloads/tests/test_svn_config_files.py | 4 ++ .../payloads/payloads/tests/test_tcp.py | 2 + .../payloads/payloads/tests/test_udp.py | 2 + .../payloads/payloads/tests/test_uptime.py | 4 ++ .../payloads/payloads/tests/test_users.py | 2 + .../payloads/tests/test_users_config_files.py | 2 + .../payloads/tests/test_w3af_agent.py | 4 ++ .../payloads/tests/test_base_payload.py | 1 + .../payloads/tests/test_shell_handler.py | 8 +++ .../tests/test_pdf.py | 1 + w3af/plugins/tests/attack/test_dav.py | 3 + w3af/plugins/tests/attack/test_eval.py | 3 + w3af/plugins/tests/attack/test_file_upload.py | 4 ++ .../tests/attack/test_local_file_reader.py | 3 + .../tests/attack/test_os_commanding.py | 3 + w3af/plugins/tests/attack/test_rfi.py | 3 + w3af/plugins/tests/attack/test_sqlmap.py | 5 ++ w3af/plugins/tests/attack/test_xpath.py | 3 + .../tests/audit/test_all_false_positive.py | 2 + w3af/plugins/tests/audit/test_blind_sqli.py | 8 +++ .../tests/audit/test_buffer_overflow.py | 2 + w3af/plugins/tests/audit/test_cors_origin.py | 13 ++++ w3af/plugins/tests/audit/test_csrf.py | 13 ++++ w3af/plugins/tests/audit/test_dav.py | 4 ++ .../tests/audit/test_deserialization.py | 4 ++ w3af/plugins/tests/audit/test_eval.py | 5 ++ w3af/plugins/tests/audit/test_file_upload.py | 5 ++ .../plugins/tests/audit/test_format_string.py | 2 + w3af/plugins/tests/audit/test_frontpage.py | 2 + w3af/plugins/tests/audit/test_generic.py | 4 ++ .../tests/audit/test_global_redirect.py | 8 +++ .../tests/audit/test_htaccess_methods.py | 7 ++ w3af/plugins/tests/audit/test_ldapi.py | 2 + w3af/plugins/tests/audit/test_lfi.py | 3 + w3af/plugins/tests/audit/test_memcachei.py | 2 + w3af/plugins/tests/audit/test_mx_injection.py | 2 + .../plugins/tests/audit/test_os_commanding.py | 2 + .../tests/audit/test_phishing_vector.py | 2 + w3af/plugins/tests/audit/test_preg_replace.py | 2 + w3af/plugins/tests/audit/test_redos.py | 3 + .../tests/audit/test_response_splitting.py | 4 ++ w3af/plugins/tests/audit/test_rfd.py | 5 ++ w3af/plugins/tests/audit/test_rfi.py | 6 ++ .../plugins/tests/audit/test_rosetta_flash.py | 3 + w3af/plugins/tests/audit/test_shell_shock.py | 3 + w3af/plugins/tests/audit/test_sqli.py | 13 ++++ w3af/plugins/tests/audit/test_ssi.py | 3 + .../tests/audit/test_ssl_certificate.py | 4 ++ w3af/plugins/tests/audit/test_un_ssl.py | 3 + .../tests/audit/test_websocket_hijacking.py | 8 +++ w3af/plugins/tests/audit/test_xpath.py | 2 + w3af/plugins/tests/audit/test_xss.py | 9 +++ w3af/plugins/tests/audit/test_xst.py | 2 + w3af/plugins/tests/audit/test_xxe.py | 6 ++ w3af/plugins/tests/auth/test_autocomplete.py | 6 ++ w3af/plugins/tests/auth/test_detailed.py | 6 ++ w3af/plugins/tests/auth/test_generic.py | 3 + .../tests/bruteforce/test_basic_auth.py | 3 + .../tests/bruteforce/test_form_auth.py | 10 +++ .../phishtank/test_phishtank_xml_parsing.py | 1 + .../tests/crawl/test_archive_dot_org.py | 4 ++ w3af/plugins/tests/crawl/test_bing_spider.py | 2 + .../tests/crawl/test_content_negotiation.py | 2 + .../crawl/test_crawl_exception_handling.py | 2 + w3af/plugins/tests/crawl/test_digit_sum.py | 3 + .../tests/crawl/test_dir_file_bruter.py | 5 ++ w3af/plugins/tests/crawl/test_dot_ds_store.py | 2 + w3af/plugins/tests/crawl/test_dot_listing.py | 3 + w3af/plugins/tests/crawl/test_dwsync_xml.py | 2 + .../tests/crawl/test_find_backdoors.py | 5 ++ .../plugins/tests/crawl/test_find_captchas.py | 2 + w3af/plugins/tests/crawl/test_find_dvcs.py | 6 ++ w3af/plugins/tests/crawl/test_genexus_xml.py | 2 + w3af/plugins/tests/crawl/test_ghdb.py | 5 ++ .../plugins/tests/crawl/test_google_spider.py | 2 + .../tests/crawl/test_import_results.py | 4 ++ w3af/plugins/tests/crawl/test_open_api.py | 8 +++ .../tests/crawl/test_oracle_discovery.py | 2 + .../crawl/test_payment_webhook_finder.py | 5 ++ w3af/plugins/tests/crawl/test_phishtank.py | 6 ++ w3af/plugins/tests/crawl/test_phpinfo.py | 5 ++ w3af/plugins/tests/crawl/test_pykto.py | 12 ++++ .../tests/crawl/test_ria_enumerator.py | 2 + w3af/plugins/tests/crawl/test_robots_txt.py | 2 + w3af/plugins/tests/crawl/test_sitemap_xml.py | 2 + w3af/plugins/tests/crawl/test_spider_man.py | 3 + w3af/plugins/tests/crawl/test_url_fuzzer.py | 2 + w3af/plugins/tests/crawl/test_urllist_txt.py | 2 + w3af/plugins/tests/crawl/test_user_dir.py | 2 + w3af/plugins/tests/crawl/test_web_diff.py | 2 + w3af/plugins/tests/crawl/test_web_spider.py | 10 +++ w3af/plugins/tests/crawl/test_wordnet.py | 3 + .../crawl/test_wordpress_enumerate_users.py | 2 + .../tests/crawl/test_wordpress_fingerprint.py | 5 ++ .../test_wordpress_fullpathdisclosure.py | 2 + w3af/plugins/tests/crawl/test_wsdl_finder.py | 2 + .../tests/evasion/test_core_integration.py | 2 + .../tests/evasion/test_mod_security.py | 2 + w3af/plugins/tests/grep/test_all.py | 5 ++ .../tests/grep/test_analyze_cookies.py | 18 +++++ w3af/plugins/tests/grep/test_blank_body.py | 7 ++ w3af/plugins/tests/grep/test_cache_control.py | 8 +++ w3af/plugins/tests/grep/test_cdn_providers.py | 5 ++ w3af/plugins/tests/grep/test_clamav.py | 8 ++- w3af/plugins/tests/grep/test_click_jacking.py | 8 +++ .../tests/grep/test_code_disclosure.py | 7 ++ .../tests/grep/test_content_sniffing.py | 4 ++ w3af/plugins/tests/grep/test_credit_cards.py | 7 ++ .../tests/grep/test_cross_domain_js.py | 5 ++ w3af/plugins/tests/grep/test_csp.py | 2 + .../tests/grep/test_directory_indexing.py | 2 + w3af/plugins/tests/grep/test_dom_xss.py | 2 + .../grep/test_dot_net_event_validation.py | 3 + w3af/plugins/tests/grep/test_error_500.py | 2 + w3af/plugins/tests/grep/test_error_pages.py | 4 ++ w3af/plugins/tests/grep/test_expect_ct.py | 5 ++ w3af/plugins/tests/grep/test_feeds.py | 8 +++ w3af/plugins/tests/grep/test_file_upload.py | 4 ++ .../tests/grep/test_form_autocomplete.py | 3 + .../grep/test_form_cleartext_password.py | 18 ++++- w3af/plugins/tests/grep/test_get_emails.py | 3 + w3af/plugins/tests/grep/test_html_comments.py | 4 ++ .../tests/grep/test_http_auth_detect.py | 6 ++ w3af/plugins/tests/grep/test_http_in_body.py | 2 + w3af/plugins/tests/grep/test_keys.py | 7 ++ w3af/plugins/tests/grep/test_lang.py | 4 ++ .../plugins/tests/grep/test_meta_generator.py | 6 ++ w3af/plugins/tests/grep/test_meta_tags.py | 6 +- w3af/plugins/tests/grep/test_motw.py | 3 + w3af/plugins/tests/grep/test_objects.py | 4 ++ w3af/plugins/tests/grep/test_oracle.py | 4 ++ .../tests/grep/test_password_profiling.py | 4 ++ .../tests/grep/test_path_disclosure.py | 9 +++ w3af/plugins/tests/grep/test_private_ip.py | 9 +++ w3af/plugins/tests/grep/test_retirejs.py | 3 + .../tests/grep/test_serialized_object.py | 9 +++ w3af/plugins/tests/grep/test_ssn.py | 8 +++ .../tests/grep/test_strange_headers.py | 6 ++ .../tests/grep/test_strange_http_codes.py | 7 ++ .../tests/grep/test_strange_parameters.py | 10 +++ .../plugins/tests/grep/test_strange_reason.py | 7 ++ .../grep/test_strict_transport_security.py | 5 ++ w3af/plugins/tests/grep/test_svn_users.py | 2 + w3af/plugins/tests/grep/test_symfony.py | 8 +++ w3af/plugins/tests/grep/test_url_session.py | 5 ++ .../tests/grep/test_user_defined_regex.py | 5 ++ w3af/plugins/tests/grep/test_vulners_db.py | 2 + .../tests/grep/test_websockets_links.py | 10 ++- w3af/plugins/tests/grep/test_wsdl_greper.py | 5 ++ .../tests/grep/test_xss_protection_header.py | 6 ++ w3af/plugins/tests/infrastructure/test_afd.py | 6 ++ .../infrastructure/test_allowed_methods.py | 3 + .../test_detect_reverse_proxy.py | 3 + .../test_detect_transparent_proxy.py | 2 + .../tests/infrastructure/test_dns_wildcard.py | 2 + .../tests/infrastructure/test_domain_dot.py | 2 + .../infrastructure/test_dot_net_errors.py | 3 + .../test_favicon_identification.py | 3 + .../tests/infrastructure/test_find_jboss.py | 2 + .../tests/infrastructure/test_find_vhosts.py | 3 + .../tests/infrastructure/test_finger_bing.py | 2 + .../infrastructure/test_finger_google.py | 2 + .../tests/infrastructure/test_finger_pks.py | 2 + .../infrastructure/test_fingerprint_WAF.py | 3 + .../infrastructure/test_fingerprint_os.py | 3 + .../infrastructure/test_frontpage_version.py | 2 + .../tests/infrastructure/test_halberd.py | 2 + .../plugins/tests/infrastructure/test_hmap.py | 3 + .../infrastructure/test_http_vs_https_dist.py | 7 ++ .../tests/infrastructure/test_jetleak.py | 3 + .../tests/infrastructure/test_ms15_034.py | 3 + .../tests/infrastructure/test_php_eggs.py | 3 + .../infrastructure/test_server_header.py | 2 + .../infrastructure/test_server_status.py | 2 + .../infrastructure/test_shared_hosting.py | 3 + .../infrastructure/test_werkzeug_debugger.py | 4 ++ .../infrastructure/test_xssed_dot_com.py | 7 ++ .../tests/infrastructure/test_zone_h.py | 4 ++ w3af/plugins/tests/output/test_csv_file.py | 2 + .../plugins/tests/output/test_email_report.py | 2 + .../tests/output/test_export_requests.py | 2 + w3af/plugins/tests/output/test_html_file.py | 3 + w3af/plugins/tests/output/test_json_file.py | 2 + w3af/plugins/tests/output/test_text_file.py | 2 + w3af/plugins/tests/output/test_xml_file.py | 19 +++++ w3af/plugins/tests/test_basic.py | 4 ++ w3af/plugins/tests/test_no_debug_unittest.py | 1 + w3af/plugins/tests/test_unittest_coverage.py | 3 + w3af/tests/vuln_sites/test_asp_vulnweb_com.py | 3 + .../vuln_sites/test_aspnet_vulnweb_com.py | 3 + .../vuln_sites/test_crackme_cenzic_com.py | 3 + .../vuln_sites/test_demo_testfire_net.py | 3 + w3af/tests/vuln_sites/test_php_vulnweb_com.py | 3 + w3af/tests/vuln_sites/test_webscantest_com.py | 3 + .../test_zero_webappsecurity_com.py | 3 + 509 files changed, 1697 insertions(+), 36 deletions(-) create mode 100644 conftest.py create mode 100644 pytest.ini diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000000..e245f139ec --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +addopts = -m "not slow and not deprecated" --ignore "w3af/core/ui/gui/" +markers = + deprecated: legacy tests which failing with actual code. Marked automatically. + slow: legacy tests which were slowed than 10 seconds. Marked automatically. diff --git a/w3af/core/controllers/auto_update/tests/test_changelog.py b/w3af/core/controllers/auto_update/tests/test_changelog.py index 10f47e560f..275cb34008 100644 --- a/w3af/core/controllers/auto_update/tests/test_changelog.py +++ b/w3af/core/controllers/auto_update/tests/test_changelog.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.auto_update.changelog import ChangeLog diff --git a/w3af/core/controllers/auto_update/tests/test_git_client.py b/w3af/core/controllers/auto_update/tests/test_git_client.py index de676ee18c..603809a53a 100644 --- a/w3af/core/controllers/auto_update/tests/test_git_client.py +++ b/w3af/core/controllers/auto_update/tests/test_git_client.py @@ -18,9 +18,11 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import subprocess +import pytest from mock import MagicMock from nose.plugins.skip import SkipTest @@ -29,6 +31,7 @@ from w3af.core.controllers.auto_update.utils import get_current_branch +@pytest.mark.skip(reason="deprecated") class TestGitClient(unittest.TestCase): def test_get_URL(self): diff --git a/w3af/core/controllers/auto_update/tests/test_update_utils.py b/w3af/core/controllers/auto_update/tests/test_update_utils.py index 6138fc0415..5a0079b67c 100644 --- a/w3af/core/controllers/auto_update/tests/test_update_utils.py +++ b/w3af/core/controllers/auto_update/tests/test_update_utils.py @@ -18,16 +18,19 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import subprocess import git +import pytest from w3af.core.controllers.auto_update.utils import (is_git_repo, get_latest_commit, get_current_branch) +@pytest.mark.skip(reason='deprecated') class TestGitUtils(unittest.TestCase): def test_is_git_repo(self): diff --git a/w3af/core/controllers/auto_update/tests/test_version_manager.py b/w3af/core/controllers/auto_update/tests/test_version_manager.py index 68a7b76fe0..f037af0674 100644 --- a/w3af/core/controllers/auto_update/tests/test_version_manager.py +++ b/w3af/core/controllers/auto_update/tests/test_version_manager.py @@ -18,10 +18,12 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import gc import unittest import datetime +import pytest from nose.plugins.attrib import attr from mock import MagicMock @@ -32,6 +34,7 @@ from w3af.core.controllers.auto_update.git_client import GitClient +@pytest.mark.skip(reason='deprecated') class TestVersionMgr(unittest.TestCase): def setUp(self): diff --git a/w3af/core/controllers/bruteforce/tests/test_bruteforcer.py b/w3af/core/controllers/bruteforce/tests/test_bruteforcer.py index 56f6f2a023..e1d4de20b2 100644 --- a/w3af/core/controllers/bruteforce/tests/test_bruteforcer.py +++ b/w3af/core/controllers/bruteforce/tests/test_bruteforcer.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest diff --git a/w3af/core/controllers/core_helpers/consumers/tests/test_audit.py b/w3af/core/controllers/core_helpers/consumers/tests/test_audit.py index f43349b6e9..f232707500 100644 --- a/w3af/core/controllers/core_helpers/consumers/tests/test_audit.py +++ b/w3af/core/controllers/core_helpers/consumers/tests/test_audit.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import httpretty @@ -39,6 +40,7 @@ def tearDown(self): kb.kb.cleanup() @httpretty.activate + @pytest.mark.deprecated def test_teardown_with_must_stop_exception(self): w3af_core = w3afCore() diff --git a/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py b/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py index 17334489d3..4218191323 100644 --- a/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py +++ b/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import Mock @@ -33,6 +34,7 @@ class TestBaseConsumer(unittest.TestCase): def setUp(self): self.bc = BaseConsumer([], w3afCore(), 'TestConsumer') + @pytest.mark.deprecated def test_handle_exception(self): url = URL('http://moth/') fr = FuzzableRequest(url) diff --git a/w3af/core/controllers/core_helpers/consumers/tests/test_crawl_infrastructure.py b/w3af/core/controllers/core_helpers/consumers/tests/test_crawl_infrastructure.py index be55c6b8fa..b77071d63d 100644 --- a/w3af/core/controllers/core_helpers/consumers/tests/test_crawl_infrastructure.py +++ b/w3af/core/controllers/core_helpers/consumers/tests/test_crawl_infrastructure.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import time from nose.plugins.attrib import attr @@ -47,6 +48,7 @@ class TestTimeLimit(PluginTest): @attr('slow') @attr('ci_fails') + @pytest.mark.deprecated def test_spider_with_time_limit(self): # # First scan diff --git a/w3af/core/controllers/core_helpers/consumers/tests/test_grep.py b/w3af/core/controllers/core_helpers/consumers/tests/test_grep.py index 1ebad6efe1..9ca630053f 100644 --- a/w3af/core/controllers/core_helpers/consumers/tests/test_grep.py +++ b/w3af/core/controllers/core_helpers/consumers/tests/test_grep.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest diff --git a/w3af/core/controllers/core_helpers/not_found/tests/test_404_fuzzy_string_match.py b/w3af/core/controllers/core_helpers/not_found/tests/test_404_fuzzy_string_match.py index 3f56e8d1f7..fdd7e45226 100644 --- a/w3af/core/controllers/core_helpers/not_found/tests/test_404_fuzzy_string_match.py +++ b/w3af/core/controllers/core_helpers/not_found/tests/test_404_fuzzy_string_match.py @@ -21,6 +21,7 @@ """ from __future__ import division +import pytest import unittest import random diff --git a/w3af/core/controllers/core_helpers/not_found/tests/test_fingerprint_404.py b/w3af/core/controllers/core_helpers/not_found/tests/test_fingerprint_404.py index 85495aae50..2ac62c59e1 100644 --- a/w3af/core/controllers/core_helpers/not_found/tests/test_fingerprint_404.py +++ b/w3af/core/controllers/core_helpers/not_found/tests/test_fingerprint_404.py @@ -21,6 +21,7 @@ """ from __future__ import division +import pytest import re import os @@ -91,6 +92,7 @@ def test_issue_3234(self): class Test404FalseNegative(Generic404Test): @httpretty.activate + @pytest.mark.deprecated def test_false_negative_with_500(self): server_error = ('500 error that does NOT\n' 'look like one\n' @@ -129,6 +131,7 @@ def get_random_unique_parts_body(self): return self.get_body(unique_parts) @httpretty.activate + @pytest.mark.slow def test_page_found_with_large_response_random(self): httpretty.register_uri(httpretty.GET, @@ -151,6 +154,7 @@ def test_page_found_with_large_response_random(self): self.assertFalse(self.fingerprint_404.is_404(success_200)) @httpretty.activate + @pytest.mark.slow def test_page_marked_as_404_with_large_response_random(self): httpretty.register_uri(httpretty.GET, @@ -192,6 +196,7 @@ def get_short_body(self): return '\n'.join(parts) @httpretty.activate + @pytest.mark.deprecated def test_1byte_short_not_404(self): httpretty.register_uri(httpretty.GET, @@ -238,6 +243,7 @@ def get_short_body(self): return '\n'.join(parts) @httpretty.activate + @pytest.mark.deprecated def test_1byte_large_is_404(self): httpretty.register_uri(httpretty.GET, @@ -257,6 +263,7 @@ def test_1byte_large_is_404(self): self.assertTrue(self.fingerprint_404.is_404(not_found)) @httpretty.activate + @pytest.mark.deprecated def test_1byte_large_is_200(self): httpretty.register_uri(httpretty.GET, @@ -286,6 +293,7 @@ def get_body_with_unique_params(self): return self.get_body(unique_parts) @httpretty.activate + @pytest.mark.slow def test_page_not_found_with_large_response(self): httpretty.register_uri(httpretty.GET, @@ -308,6 +316,7 @@ def test_page_not_found_with_large_response(self): self.assertFalse(self.fingerprint_404.is_404(success_200)) @httpretty.activate + @pytest.mark.slow def test_page_marked_as_404_with_large_response(self): httpretty.register_uri(httpretty.GET, @@ -339,6 +348,7 @@ def request_callback(self, request, uri, headers): return 200, headers, body @httpretty.activate + @pytest.mark.slow def test_is_404_with_csrf_token(self): httpretty.register_uri(httpretty.GET, @@ -360,6 +370,7 @@ def test_is_404_with_csrf_token(self): self.assertTrue(self.fingerprint_404.is_404(not_found_404)) @httpretty.activate + @pytest.mark.slow def test_exists_with_csrf_token_in_404_page(self): httpretty.register_uri(httpretty.GET, @@ -396,6 +407,7 @@ def request_callback(self, request, uri, headers): return 200, headers, body @httpretty.activate + @pytest.mark.slow def test_false_positive(self): httpretty.register_uri(httpretty.GET, @@ -547,6 +559,7 @@ def request_callback(self, request, uri, headers): return 200, headers, body @httpretty.activate + @pytest.mark.deprecated def test_handle_really_a_404(self): httpretty.register_uri(httpretty.GET, diff --git a/w3af/core/controllers/core_helpers/not_found/tests/test_fingerprint_404_perf.py b/w3af/core/controllers/core_helpers/not_found/tests/test_fingerprint_404_perf.py index 3a76199fa6..338aa5faa7 100644 --- a/w3af/core/controllers/core_helpers/not_found/tests/test_fingerprint_404_perf.py +++ b/w3af/core/controllers/core_helpers/not_found/tests/test_fingerprint_404_perf.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import time import random diff --git a/w3af/core/controllers/core_helpers/not_found/tests/test_fuzzy_equal_for_diff.py b/w3af/core/controllers/core_helpers/not_found/tests/test_fuzzy_equal_for_diff.py index 3f8484915d..6fb6e00c32 100644 --- a/w3af/core/controllers/core_helpers/not_found/tests/test_fuzzy_equal_for_diff.py +++ b/w3af/core/controllers/core_helpers/not_found/tests/test_fuzzy_equal_for_diff.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import unittest import random diff --git a/w3af/core/controllers/core_helpers/not_found/tests/test_generate_404_filename.py b/w3af/core/controllers/core_helpers/not_found/tests/test_generate_404_filename.py index 931f0078f9..b53d4dfc39 100644 --- a/w3af/core/controllers/core_helpers/not_found/tests/test_generate_404_filename.py +++ b/w3af/core/controllers/core_helpers/not_found/tests/test_generate_404_filename.py @@ -21,6 +21,7 @@ """ from __future__ import division +import pytest import unittest @@ -28,6 +29,7 @@ class TestGenerate404Filename(unittest.TestCase): + @pytest.mark.deprecated def test_404_generation(self): tests = [ diff --git a/w3af/core/controllers/core_helpers/not_found/tests/test_get_clean_body.py b/w3af/core/controllers/core_helpers/not_found/tests/test_get_clean_body.py index 54af812a21..1fabf9887a 100644 --- a/w3af/core/controllers/core_helpers/not_found/tests/test_get_clean_body.py +++ b/w3af/core/controllers/core_helpers/not_found/tests/test_get_clean_body.py @@ -21,6 +21,7 @@ """ from __future__ import division +import pytest import unittest diff --git a/w3af/core/controllers/core_helpers/not_found/tests/test_response.py b/w3af/core/controllers/core_helpers/not_found/tests/test_response.py index 0e24560847..1f4d3e4fd4 100644 --- a/w3af/core/controllers/core_helpers/not_found/tests/test_response.py +++ b/w3af/core/controllers/core_helpers/not_found/tests/test_response.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.core_helpers.not_found.response import FourOhFourResponse diff --git a/w3af/core/controllers/core_helpers/strategy_observers/tests/test_disk_space_observer.py b/w3af/core/controllers/core_helpers/strategy_observers/tests/test_disk_space_observer.py index a208c01632..b336fc8829 100644 --- a/w3af/core/controllers/core_helpers/strategy_observers/tests/test_disk_space_observer.py +++ b/w3af/core/controllers/core_helpers/strategy_observers/tests/test_disk_space_observer.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import time diff --git a/w3af/core/controllers/core_helpers/strategy_observers/tests/test_thread_state_observer.py b/w3af/core/controllers/core_helpers/strategy_observers/tests/test_thread_state_observer.py index 4393e4f7e8..cb862f0b97 100644 --- a/w3af/core/controllers/core_helpers/strategy_observers/tests/test_thread_state_observer.py +++ b/w3af/core/controllers/core_helpers/strategy_observers/tests/test_thread_state_observer.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import time @@ -27,6 +28,7 @@ class TestThreadStateObserver(unittest.TestCase): + @pytest.mark.deprecated def test_inspect_data_to_log(self): worker_pool = Pool(processes=1, worker_names='WorkerThread') tso = ThreadStateObserver() diff --git a/w3af/core/controllers/core_helpers/tests/test_exception_handler.py b/w3af/core/controllers/core_helpers/tests/test_exception_handler.py index cb98c08400..994c80781d 100644 --- a/w3af/core/controllers/core_helpers/tests/test_exception_handler.py +++ b/w3af/core/controllers/core_helpers/tests/test_exception_handler.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import sys import cPickle import unittest @@ -50,6 +51,7 @@ def setUp(self): 'http://www.w3af.org/') @attr('smoke') + @pytest.mark.deprecated def test_handle_one(self): try: @@ -84,6 +86,7 @@ def test_handle_one(self): self.assertEquals(edata.lineno, 50) @attr('smoke') + @pytest.mark.deprecated def test_handle_multiple(self): for _ in xrange(10): @@ -110,6 +113,7 @@ def test_handle_multiple(self): self.assertEquals(edata.fuzzable_request, 'http://www.w3af.org/') self.assertEquals(edata.filename, 'test_exception_handler.py') + @pytest.mark.deprecated def test_get_unique_exceptions(self): for _ in xrange(10): @@ -137,6 +141,7 @@ def test_get_unique_exceptions(self): self.assertEquals(edata.fuzzable_request, 'http://www.w3af.org/') self.assertEquals(edata.filename, 'test_exception_handler.py') + @pytest.mark.deprecated def test_handle_threads_calls(self): def test2(): @@ -170,6 +175,7 @@ def test(ehandler): # the only way to do it without much effort self.assertEquals(edata.lineno, 137) + @pytest.mark.deprecated def test_handle_multi_calls(self): def test3(): diff --git a/w3af/core/controllers/core_helpers/tests/test_plugins.py b/w3af/core/controllers/core_helpers/tests/test_plugins.py index ad8e9e2a43..aedec05baf 100644 --- a/w3af/core/controllers/core_helpers/tests/test_plugins.py +++ b/w3af/core/controllers/core_helpers/tests/test_plugins.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import itertools diff --git a/w3af/core/controllers/core_helpers/tests/test_profiles.py b/w3af/core/controllers/core_helpers/tests/test_profiles.py index e46244ec4a..bc4c5c8220 100644 --- a/w3af/core/controllers/core_helpers/tests/test_profiles.py +++ b/w3af/core/controllers/core_helpers/tests/test_profiles.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os @@ -137,6 +138,9 @@ def test_use_all_profiles(self): self.core.profiles.use_profile(profile_name, workdir='.') + @pytest.mark.deprecated + @pytest.mark.slow + @pytest.mark.slow def test_cant_start_new_thread_bug(self): """ This tests that https://github.com/andresriancho/w3af/issues/56 was @@ -150,6 +154,7 @@ def test_cant_start_new_thread_bug(self): self.core.profiles.use_profile(profile_name, workdir='.') + @pytest.mark.deprecated def test_use_profile_variable_replace(self): self.core.profiles.use_profile('OWASP_TOP10', workdir='.') @@ -158,6 +163,7 @@ def test_use_profile_variable_replace(self): ca_path = plugin_opts['caFileName'].get_value() self.assertEqual(ca_path, self.INPUT_FILE) + @pytest.mark.deprecated def test_load_save_as_no_changes(self): """ During some tests I noticed that the console UI was removing the plugin diff --git a/w3af/core/controllers/core_helpers/tests/test_status.py b/w3af/core/controllers/core_helpers/tests/test_status.py index 10456e9166..f5ee079a63 100644 --- a/w3af/core/controllers/core_helpers/tests/test_status.py +++ b/w3af/core/controllers/core_helpers/tests/test_status.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import Mock @@ -65,6 +66,7 @@ def test_simple(self): self.assertEqual(s.get_status(), STOPPED) self.assertFalse(s.is_running()) + @pytest.mark.deprecated def test_queue_status_not_started(self): core = w3afCore() s = CoreStatus(core) diff --git a/w3af/core/controllers/core_helpers/tests/test_strategy.py b/w3af/core/controllers/core_helpers/tests/test_strategy.py index 06b7ddb5c0..9ff5344e89 100644 --- a/w3af/core/controllers/core_helpers/tests/test_strategy.py +++ b/w3af/core/controllers/core_helpers/tests/test_strategy.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import subprocess import sys import os @@ -83,6 +84,9 @@ def tearDown(self): if os.path.exists(OUTPUT_PATH): os.unlink(OUTPUT_PATH) + @pytest.mark.deprecated + @pytest.mark.slow + @pytest.mark.slow def test_1557_random_number_of_results(self): """ Pseudo-random number of vulnerabilities found in audit phase (xss) @@ -143,6 +147,7 @@ class TestSameFuzzableRequestSet(PluginTest): @attr('smoke') @attr('moth') + @pytest.mark.deprecated def test_same_fr_set_object(self): cfg = self._run_configs['cfg'] diff --git a/w3af/core/controllers/core_helpers/tests/test_strategy_low_level.py b/w3af/core/controllers/core_helpers/tests/test_strategy_low_level.py index 394a9b133b..35853a1fdf 100644 --- a/w3af/core/controllers/core_helpers/tests/test_strategy_low_level.py +++ b/w3af/core/controllers/core_helpers/tests/test_strategy_low_level.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import unittest import threading @@ -42,6 +43,7 @@ class TestStrategy(unittest.TestCase): def setUp(self): kb.cleanup() + @pytest.mark.deprecated def test_strategy_run(self): core = w3afCore() @@ -100,6 +102,7 @@ def _assert_thread_names(self): self.assertEqual(thread_names_set, expected_names) + @pytest.mark.deprecated def test_strategy_exception(self): core = w3afCore() @@ -128,6 +131,7 @@ def test_strategy_exception(self): self._assert_thread_names() + @pytest.mark.deprecated def test_strategy_verify_target_server_up(self): core = w3afCore() @@ -155,6 +159,7 @@ def test_strategy_verify_target_server_up(self): self.assertTrue(False) @httpretty.activate + @pytest.mark.deprecated def test_alert_if_target_is_301_all_proto_redir(self): """ Tests that the protocol redirection is detected and reported in @@ -185,6 +190,7 @@ def test_alert_if_target_is_301_all_proto_redir(self): self.assertEqual(len(infos), 1, infos) @httpretty.activate + @pytest.mark.deprecated def test_alert_if_target_is_301_all_domain_redir(self): """ Tests that the domain redirection is detected and reported in @@ -215,6 +221,7 @@ def test_alert_if_target_is_301_all_domain_redir(self): self.assertEqual(len(infos), 1, infos) @httpretty.activate + @pytest.mark.deprecated def test_alert_if_target_is_301_all_internal_redir(self): """ Tests that no info is created if the site redirects internally diff --git a/w3af/core/controllers/core_helpers/tests/test_target.py b/w3af/core/controllers/core_helpers/tests/test_target.py index 70fcbc9256..04d3e88cf9 100644 --- a/w3af/core/controllers/core_helpers/tests/test_target.py +++ b/w3af/core/controllers/core_helpers/tests/test_target.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os diff --git a/w3af/core/controllers/cors/tests/test_cors_utils.py b/w3af/core/controllers/cors/tests/test_cors_utils.py index 18e0e6d1fb..350082047f 100644 --- a/w3af/core/controllers/cors/tests/test_cors_utils.py +++ b/w3af/core/controllers/cors/tests/test_cors_utils.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import MagicMock, Mock @@ -38,6 +39,7 @@ class TestUtils(unittest.TestCase): def test_provides_cors_features_fails(self): self.assertRaises(AttributeError, provides_cors_features, None, None, None) + @pytest.mark.deprecated def test_provides_cors_features_false(self): url = URL('http://moth/') fr = FuzzableRequest(url) diff --git a/w3af/core/controllers/csp/tests/test_csp_utils.py b/w3af/core/controllers/csp/tests/test_csp_utils.py index c7bea01da6..94cb70ef1c 100644 --- a/w3af/core/controllers/csp/tests/test_csp_utils.py +++ b/w3af/core/controllers/csp/tests/test_csp_utils.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.url.HTTPResponse import HTTPResponse diff --git a/w3af/core/controllers/daemons/proxy/tests/test_intercept_proxy.py b/w3af/core/controllers/daemons/proxy/tests/test_intercept_proxy.py index ce0a94210c..f73c426fd2 100644 --- a/w3af/core/controllers/daemons/proxy/tests/test_intercept_proxy.py +++ b/w3af/core/controllers/daemons/proxy/tests/test_intercept_proxy.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import threading import unittest import urllib2 @@ -68,6 +69,7 @@ def test_get_thread_name(self): def test_no_request(self): self.assertEqual(self._proxy.get_trapped_request(), None) + @pytest.mark.deprecated def test_no_trap(self): self._proxy.set_trap(False) response = self.proxy_opener.open(get_moth_http()) @@ -75,6 +77,7 @@ def test_no_trap(self): self.assertIn(self.MOTH_MESSAGE, response.read()) self.assertEqual(response.code, 200) + @pytest.mark.deprecated def test_request_trapped_drop(self): def send_request(proxy_opener, result_queue): try: @@ -104,6 +107,7 @@ def send_request(proxy_opener, result_queue): self.assertEqual(response.code, 403) self.assertIn('HTTP request drop by user', response.read()) + @pytest.mark.deprecated def test_request_trapped_send(self): def send_request(proxy_opener, result_queue): try: @@ -137,6 +141,7 @@ def send_request(proxy_opener, result_queue): self.assertEqual(response.code, 200) self.assertIn(self.MOTH_MESSAGE, response.read()) + @pytest.mark.deprecated def test_trap_many(self): def send_request(_id, proxy_opener, results, exceptions): url = get_moth_http('/%s' % _id) diff --git a/w3af/core/controllers/daemons/proxy/tests/test_proxy.py b/w3af/core/controllers/daemons/proxy/tests/test_proxy.py index 9c781fb960..2ee439ca51 100644 --- a/w3af/core/controllers/daemons/proxy/tests/test_proxy.py +++ b/w3af/core/controllers/daemons/proxy/tests/test_proxy.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import urllib2 import unittest @@ -53,6 +54,7 @@ def setUp(self): self.proxy_opener = urllib2.build_opener(proxy_handler, urllib2.HTTPHandler) + @pytest.mark.deprecated def test_do_req_through_proxy(self): resp_body = self.proxy_opener.open(get_moth_http()).read() @@ -85,6 +87,7 @@ def test_do_req_through_proxy(self): self.assertEqual(direct_resp_headers, proxy_resp_headers) + @pytest.mark.deprecated def test_do_ssl_req_through_proxy(self): resp_body = self.proxy_opener.open(get_moth_https()).read() @@ -114,6 +117,7 @@ def test_do_ssl_req_through_proxy(self): self.assertEqual(direct_resp_headers, proxy_resp_headers) + @pytest.mark.deprecated def test_proxy_req_ok(self): """Test if self._proxy.stop() works as expected. Note that the check content is the same as the previous check, but it might be that this @@ -156,6 +160,7 @@ def test_error_handling(self): self.assertIn('Proxy error', body) self.assertIn('HTTP request', body) + @pytest.mark.deprecated def test_proxy_gzip_encoding(self): """ When we perform a request to a site which returns gzip encoded data, the diff --git a/w3af/core/controllers/daemons/tests/test_webserver.py b/w3af/core/controllers/daemons/tests/test_webserver.py index 8b5ed6f04b..8707cc6404 100644 --- a/w3af/core/controllers/daemons/tests/test_webserver.py +++ b/w3af/core/controllers/daemons/tests/test_webserver.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import urllib2 import unittest import tempfile diff --git a/w3af/core/controllers/delay_detection/tests/test_aprox_delay_controller.py b/w3af/core/controllers/delay_detection/tests/test_aprox_delay_controller.py index c56a79157e..d1848fa990 100644 --- a/w3af/core/controllers/delay_detection/tests/test_aprox_delay_controller.py +++ b/w3af/core/controllers/delay_detection/tests/test_aprox_delay_controller.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import random @@ -72,6 +73,7 @@ class TestAproxDelayController(unittest.TestCase): (False, (0.1, 0.1, 0.1, 2.3, 0.1, 0.1, 0.1, 0.9, 0.1, 0.1, 0.1, 0.1)) ] + @pytest.mark.deprecated def test_delay_controlled(self): for expected_result, delays in self.TEST_SUITE: diff --git a/w3af/core/controllers/delay_detection/tests/test_exact_delay_controller.py b/w3af/core/controllers/delay_detection/tests/test_exact_delay_controller.py index 411f3a1fca..8515a1c1b0 100644 --- a/w3af/core/controllers/delay_detection/tests/test_exact_delay_controller.py +++ b/w3af/core/controllers/delay_detection/tests/test_exact_delay_controller.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import random diff --git a/w3af/core/controllers/dependency_check/platforms/tests/test_all_platforms.py b/w3af/core/controllers/dependency_check/platforms/tests/test_all_platforms.py index 019521252c..df18596638 100644 --- a/w3af/core/controllers/dependency_check/platforms/tests/test_all_platforms.py +++ b/w3af/core/controllers/dependency_check/platforms/tests/test_all_platforms.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from ..current_platform import KNOWN_PLATFORMS diff --git a/w3af/core/controllers/dependency_check/platforms/tests/test_current_platform.py b/w3af/core/controllers/dependency_check/platforms/tests/test_current_platform.py index eaefb49aca..1e33d93a66 100644 --- a/w3af/core/controllers/dependency_check/platforms/tests/test_current_platform.py +++ b/w3af/core/controllers/dependency_check/platforms/tests/test_current_platform.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from ..current_platform import get_current_platform diff --git a/w3af/core/controllers/dependency_check/tests/test_dependencies.py b/w3af/core/controllers/dependency_check/tests/test_dependencies.py index 444ef64102..7441d84e1e 100644 --- a/w3af/core/controllers/dependency_check/tests/test_dependencies.py +++ b/w3af/core/controllers/dependency_check/tests/test_dependencies.py @@ -3,6 +3,7 @@ import shlex import sys +import pytest from nose.plugins.attrib import attr diff --git a/w3af/core/controllers/dependency_check/tests/test_dependency_check.py b/w3af/core/controllers/dependency_check/tests/test_dependency_check.py index ac7f9cc9ce..b64a3853ed 100644 --- a/w3af/core/controllers/dependency_check/tests/test_dependency_check.py +++ b/w3af/core/controllers/dependency_check/tests/test_dependency_check.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import patch @@ -80,6 +81,7 @@ def test_default_platform_core_missing_deps(self): all_stdout = ''.join(k[1][0] for k in stdout_mock.method_calls) self.assertIn(self.MISSING_DEP_CMD, all_stdout) + @pytest.mark.deprecated def test_default_platform_gui(self): """ Test that the dependency check works for gui + default platform when the @@ -91,6 +93,7 @@ def test_default_platform_gui(self): exit_on_failure=False) self.assertFalse(must_exit) + @pytest.mark.deprecated def test_default_platform_gui_missing_deps(self): """ Test that the dependency check works for gui + default platform when @@ -112,6 +115,7 @@ def test_default_platform_gui_missing_deps(self): all_stdout = ''.join(k[1][0] for k in stdout_mock.method_calls) self.assertIn(self.MISSING_DEP_CMD, all_stdout) + @pytest.mark.deprecated def test_ubuntu1204_core(self): """ Test that the dependency check works for core + ubuntu1204 @@ -122,6 +126,7 @@ def test_ubuntu1204_core(self): exit_on_failure=False) self.assertFalse(must_exit) + @pytest.mark.deprecated def test_ubuntu1204_gui(self): """ Test that the dependency check works for core + ubuntu1204 diff --git a/w3af/core/controllers/dependency_check/tests/test_helper_requirements_txt.py b/w3af/core/controllers/dependency_check/tests/test_helper_requirements_txt.py index 42bea994eb..63d5a2cb3d 100644 --- a/w3af/core/controllers/dependency_check/tests/test_helper_requirements_txt.py +++ b/w3af/core/controllers/dependency_check/tests/test_helper_requirements_txt.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest @@ -33,6 +34,7 @@ class TestGenerateTXT(unittest.TestCase): MOCK_TARGET = 'w3af.core.controllers.ci.only_ci_decorator.is_running_on_ci' @patch(MOCK_TARGET, return_value=True) + @pytest.mark.deprecated def test_generate_requirements_txt_empty(self, ci_mock): requirements_file = generate_requirements_txt([]) @@ -47,4 +49,3 @@ def test_generate_requirements_txt(self, ci_mock): self.assertEqual(EXPECTED, file(requirements_file).read()) os.unlink(requirements_file) - \ No newline at end of file diff --git a/w3af/core/controllers/dependency_check/tests/test_latest_vulndb.py b/w3af/core/controllers/dependency_check/tests/test_latest_vulndb.py index a12edae234..ab4fd60123 100644 --- a/w3af/core/controllers/dependency_check/tests/test_latest_vulndb.py +++ b/w3af/core/controllers/dependency_check/tests/test_latest_vulndb.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import pkg_resources @@ -34,6 +35,7 @@ class TestLatestVulnDB(unittest.TestCase): + @pytest.mark.deprecated def test_latest_vulndb(self): pkg = 'vulndb' found = None diff --git a/w3af/core/controllers/easy_contribution/tests/test_github_issues.py b/w3af/core/controllers/easy_contribution/tests/test_github_issues.py index 5d6180a43e..8b9739bca9 100644 --- a/w3af/core/controllers/easy_contribution/tests/test_github_issues.py +++ b/w3af/core/controllers/easy_contribution/tests/test_github_issues.py @@ -19,8 +19,10 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest +import pytest from github import Github from nose.plugins.attrib import attr @@ -31,6 +33,7 @@ @attr('internet') +@pytest.mark.skip(reason='deprecated') class TestGithubIssues(unittest.TestCase): def test_report(self): diff --git a/w3af/core/controllers/exception_handling/tests/test_cleanup_bug_report.py b/w3af/core/controllers/exception_handling/tests/test_cleanup_bug_report.py index 9c32d2b5ac..8b8ceaac1b 100644 --- a/w3af/core/controllers/exception_handling/tests/test_cleanup_bug_report.py +++ b/w3af/core/controllers/exception_handling/tests/test_cleanup_bug_report.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.config as cf diff --git a/w3af/core/controllers/extrusion_scanning/tests/test_extrusion_scanner.py b/w3af/core/controllers/extrusion_scanning/tests/test_extrusion_scanner.py index 4f40d1079c..933358febf 100644 --- a/w3af/core/controllers/extrusion_scanning/tests/test_extrusion_scanner.py +++ b/w3af/core/controllers/extrusion_scanning/tests/test_extrusion_scanner.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import commands @@ -33,6 +34,7 @@ class TestExtrusionScanner(unittest.TestCase): """ Test the extrusion scanner's basic features. """ + @pytest.mark.deprecated def test_basic(self): es = extrusionScanner(commands.getoutput) diff --git a/w3af/core/controllers/intrusion_tools/tests/test_execMethodHelpers.py b/w3af/core/controllers/intrusion_tools/tests/test_execMethodHelpers.py index e21dcb6ef1..d17e4322c9 100644 --- a/w3af/core/controllers/intrusion_tools/tests/test_execMethodHelpers.py +++ b/w3af/core/controllers/intrusion_tools/tests/test_execMethodHelpers.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import commands diff --git a/w3af/core/controllers/misc/tests/test_common_attack_methods.py b/w3af/core/controllers/misc/tests/test_common_attack_methods.py index f132ae0715..83f91b87c2 100644 --- a/w3af/core/controllers/misc/tests/test_common_attack_methods.py +++ b/w3af/core/controllers/misc/tests/test_common_attack_methods.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr diff --git a/w3af/core/controllers/misc/tests/test_contains_source_code.py b/w3af/core/controllers/misc/tests/test_contains_source_code.py index 130914ac95..c1e811f501 100644 --- a/w3af/core/controllers/misc/tests/test_contains_source_code.py +++ b/w3af/core/controllers/misc/tests/test_contains_source_code.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest diff --git a/w3af/core/controllers/misc/tests/test_diff.py b/w3af/core/controllers/misc/tests/test_diff.py index f3e2283518..9cdbdb22b7 100644 --- a/w3af/core/controllers/misc/tests/test_diff.py +++ b/w3af/core/controllers/misc/tests/test_diff.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import unittest diff --git a/w3af/core/controllers/misc/tests/test_diff_performance.py b/w3af/core/controllers/misc/tests/test_diff_performance.py index db35c96e6a..9ba405199a 100644 --- a/w3af/core/controllers/misc/tests/test_diff_performance.py +++ b/w3af/core/controllers/misc/tests/test_diff_performance.py @@ -21,6 +21,7 @@ """ from __future__ import print_function +import pytest import os import time @@ -36,9 +37,11 @@ class TestDiffPerformance(unittest.TestCase): FUNCTIONS = [chunked_diff, diff_dmp] ROUNDS = 5 + @pytest.mark.slow def test_xml(self): self._generic_runner(self._run_test_xml) + @pytest.mark.slow def test_diff_large_different_responses(self): self._generic_runner(self._run_diff_large_different_responses) diff --git a/w3af/core/controllers/misc/tests/test_fuzzy_string_cmp.py b/w3af/core/controllers/misc/tests/test_fuzzy_string_cmp.py index b42de785e1..60fe2867de 100644 --- a/w3af/core/controllers/misc/tests/test_fuzzy_string_cmp.py +++ b/w3af/core/controllers/misc/tests/test_fuzzy_string_cmp.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.misc.fuzzy_string_cmp import (relative_distance, diff --git a/w3af/core/controllers/misc/tests/test_get_w3af_version.py b/w3af/core/controllers/misc/tests/test_get_w3af_version.py index cc9d96bd7b..dda95a1ceb 100644 --- a/w3af/core/controllers/misc/tests/test_get_w3af_version.py +++ b/w3af/core/controllers/misc/tests/test_get_w3af_version.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.misc.get_w3af_version import (get_w3af_version_as_dict, @@ -31,6 +32,7 @@ class TestGetVersion(unittest.TestCase): def test_trivial(self): self.assertIn(get_minimalistic_version(), get_w3af_version()) + @pytest.mark.deprecated def test_minimal(self): self.assertTrue(get_minimalistic_version().startswith('1')) diff --git a/w3af/core/controllers/misc/tests/test_io.py b/w3af/core/controllers/misc/tests/test_io.py index d3e9bf411d..c329c6506e 100644 --- a/w3af/core/controllers/misc/tests/test_io.py +++ b/w3af/core/controllers/misc/tests/test_io.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.misc.io import NamedStringIO diff --git a/w3af/core/controllers/misc/tests/test_is_ip_address.py b/w3af/core/controllers/misc/tests/test_is_ip_address.py index 879e146d98..d3d08f0bb0 100644 --- a/w3af/core/controllers/misc/tests/test_is_ip_address.py +++ b/w3af/core/controllers/misc/tests/test_is_ip_address.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.misc.is_ip_address import is_ip_address diff --git a/w3af/core/controllers/misc/tests/test_is_private_site.py b/w3af/core/controllers/misc/tests/test_is_private_site.py index d2a5380fde..2fad8e75cd 100644 --- a/w3af/core/controllers/misc/tests/test_is_private_site.py +++ b/w3af/core/controllers/misc/tests/test_is_private_site.py @@ -19,15 +19,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.misc.is_private_site import is_private_site class TestIsPrivateSite(unittest.TestCase): + @pytest.mark.deprecated def test_is_private_site_true_case01(self): self.assertTrue(is_private_site('127.0.0.1')) + @pytest.mark.deprecated def test_is_private_site_true_case02(self): self.assertTrue(is_private_site('192.168.0.1')) diff --git a/w3af/core/controllers/misc/tests/test_make_leet.py b/w3af/core/controllers/misc/tests/test_make_leet.py index 21caacb150..bab73f5ee5 100644 --- a/w3af/core/controllers/misc/tests/test_make_leet.py +++ b/w3af/core/controllers/misc/tests/test_make_leet.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.misc.make_leet import make_leet diff --git a/w3af/core/controllers/misc/tests/test_which.py b/w3af/core/controllers/misc/tests/test_which.py index 4631fd7728..d489cc476b 100644 --- a/w3af/core/controllers/misc/tests/test_which.py +++ b/w3af/core/controllers/misc/tests/test_which.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.misc.which import which diff --git a/w3af/core/controllers/output_manager/tests/test_output_manager.py b/w3af/core/controllers/output_manager/tests/test_output_manager.py index 5ae0f4c1c6..07b0cf2e4d 100644 --- a/w3af/core/controllers/output_manager/tests/test_output_manager.py +++ b/w3af/core/controllers/output_manager/tests/test_output_manager.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import multiprocessing @@ -132,6 +133,7 @@ def test_ignore_plugins(self): plugin_action.assert_called_once_with(msg, False) + @pytest.mark.slow def test_error_handling(self): class InvalidPlugin(object): diff --git a/w3af/core/controllers/payload_transfer/tests/test_clientless_reverse_http.py b/w3af/core/controllers/payload_transfer/tests/test_clientless_reverse_http.py index c401a2c440..3e097e76cc 100644 --- a/w3af/core/controllers/payload_transfer/tests/test_clientless_reverse_http.py +++ b/w3af/core/controllers/payload_transfer/tests/test_clientless_reverse_http.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import commands import socket import tempfile diff --git a/w3af/core/controllers/payload_transfer/tests/test_echo_linux.py b/w3af/core/controllers/payload_transfer/tests/test_echo_linux.py index 7262c0d4c2..046449e9c5 100644 --- a/w3af/core/controllers/payload_transfer/tests/test_echo_linux.py +++ b/w3af/core/controllers/payload_transfer/tests/test_echo_linux.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import commands import unittest import tempfile diff --git a/w3af/core/controllers/plugins/tests/test_404_errors.py b/w3af/core/controllers/plugins/tests/test_404_errors.py index 2994746d64..c9055bf280 100644 --- a/w3af/core/controllers/plugins/tests/test_404_errors.py +++ b/w3af/core/controllers/plugins/tests/test_404_errors.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import patch, call @@ -41,6 +42,7 @@ def setUp(self): def tearDown(self): kb.kb.cleanup() + @pytest.mark.deprecated def test_handles_404_exception(self): body = '' url = URL('http://www.w3af.com/') @@ -61,6 +63,7 @@ def test_handles_404_exception(self): self.assertIn(ecall, om_mock.mock_calls) self.assertEqual(vulns, []) + @pytest.mark.deprecated def test_raises_other_exceptions(self): body = '' url = URL('http://www.w3af.com/') diff --git a/w3af/core/controllers/plugins/tests/test_audit_plugin.py b/w3af/core/controllers/plugins/tests/test_audit_plugin.py index 167fc289c9..7a9756918d 100644 --- a/w3af/core/controllers/plugins/tests/test_audit_plugin.py +++ b/w3af/core/controllers/plugins/tests/test_audit_plugin.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr @@ -43,6 +44,7 @@ def tearDown(self): self.w3af.quit() kb.cleanup() + @pytest.mark.deprecated def test_audit_return_vulns(self): plugin_inst = self.w3af.plugins.get_plugin_inst('audit', 'sqli') @@ -61,6 +63,7 @@ def test_audit_return_vulns(self): self.assertEqual(plugin_inst._store_kb_vulns, False) + @pytest.mark.deprecated def test_http_timeout_with_plugin(self): """ This is very related with the tests at: diff --git a/w3af/core/controllers/plugins/tests/test_plugin.py b/w3af/core/controllers/plugins/tests/test_plugin.py index 477d51c246..d04c95be3a 100644 --- a/w3af/core/controllers/plugins/tests/test_plugin.py +++ b/w3af/core/controllers/plugins/tests/test_plugin.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.plugins.plugin import Plugin diff --git a/w3af/core/controllers/profiling/tests/test_thread_time.py b/w3af/core/controllers/profiling/tests/test_thread_time.py index bf10c58688..ec1e2e832b 100644 --- a/w3af/core/controllers/profiling/tests/test_thread_time.py +++ b/w3af/core/controllers/profiling/tests/test_thread_time.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import time import hashlib diff --git a/w3af/core/controllers/profiling/tests/test_took_helper.py b/w3af/core/controllers/profiling/tests/test_took_helper.py index bb9e0abe5c..c9dd9660c5 100644 --- a/w3af/core/controllers/profiling/tests/test_took_helper.py +++ b/w3af/core/controllers/profiling/tests/test_took_helper.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import patch @@ -27,6 +28,7 @@ class TestTookHelper(unittest.TestCase): + @pytest.mark.deprecated def test_took_simple(self): w3af_core = w3afCore() @@ -46,6 +48,7 @@ def test_took_simple(self): 'plugin_name.method_name\(test="yes",did="ML7aEYsa"\)' ' took .*? seconds to run \(.*? seconds / .*?% consuming CPU cycles\)') + @pytest.mark.deprecated def test_took_with_rtt(self): debugging_id = 'ML7aEYsa' diff --git a/w3af/core/controllers/sca/tests/test_sca.py b/w3af/core/controllers/sca/tests/test_sca.py index 902d824658..fc518eeac4 100644 --- a/w3af/core/controllers/sca/tests/test_sca.py +++ b/w3af/core/controllers/sca/tests/test_sca.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest diff --git a/w3af/core/controllers/tests/core_test_suite/test_core_exceptions.py b/w3af/core/controllers/tests/core_test_suite/test_core_exceptions.py index 24fed97b94..06b4c79846 100644 --- a/w3af/core/controllers/tests/core_test_suite/test_core_exceptions.py +++ b/w3af/core/controllers/tests/core_test_suite/test_core_exceptions.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import patch, call @@ -69,6 +70,7 @@ def setUp(self): def tearDown(self): self.w3afcore.quit() + @pytest.mark.deprecated def test_stop_on_must_stop_exception(self): """ Verify that the ScanMustStopException stops the scan. @@ -82,6 +84,7 @@ def test_stop_on_must_stop_exception(self): ' resolved:\nTest exception.\n') self.assertIn(call.error(error), om_mock.mock_calls) + @pytest.mark.deprecated def test_stop_unknown_exception(self): """ Verify that the ScanMustStopByUnknownReasonExc stops the scan. @@ -89,6 +92,7 @@ def test_stop_unknown_exception(self): self.exception_plugin.exception_to_raise = ScanMustStopByUnknownReasonExc self.assertRaises(ScanMustStopByUnknownReasonExc, self.w3afcore.start) + @pytest.mark.deprecated def test_stop_by_user_request(self): """ Verify that the ScanMustStopByUserRequest stops the scan. diff --git a/w3af/core/controllers/tests/core_test_suite/test_exception_handler.py b/w3af/core/controllers/tests/core_test_suite/test_exception_handler.py index cb5031009d..54c2d9bd0a 100644 --- a/w3af/core/controllers/tests/core_test_suite/test_exception_handler.py +++ b/w3af/core/controllers/tests/core_test_suite/test_exception_handler.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.tests.core_test_suite.test_pause_stop import CountTestMixin diff --git a/w3af/core/controllers/tests/core_test_suite/test_history_access.py b/w3af/core/controllers/tests/core_test_suite/test_history_access.py index 7a11a72df2..cfdd2ac679 100644 --- a/w3af/core/controllers/tests/core_test_suite/test_history_access.py +++ b/w3af/core/controllers/tests/core_test_suite/test_history_access.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.core.controllers.tests.core_test_suite.test_pause_stop import CountTestMixin from w3af.core.data.db.history import HistoryItem @@ -30,6 +31,7 @@ class TestHistoryAccess(CountTestMixin): @see: Inherit from TestW3afCorePause to get the nice setUp(). """ + @pytest.mark.deprecated def test_history_access(self): self.count_plugin.loops = 1 self.w3afcore.start() diff --git a/w3af/core/controllers/tests/core_test_suite/test_multiple_instances.py b/w3af/core/controllers/tests/core_test_suite/test_multiple_instances.py index 846022100d..ffe1351dcb 100644 --- a/w3af/core/controllers/tests/core_test_suite/test_multiple_instances.py +++ b/w3af/core/controllers/tests/core_test_suite/test_multiple_instances.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import threading diff --git a/w3af/core/controllers/tests/core_test_suite/test_pause_stop.py b/w3af/core/controllers/tests/core_test_suite/test_pause_stop.py index 24443bf947..990ba8e1ea 100644 --- a/w3af/core/controllers/tests/core_test_suite/test_pause_stop.py +++ b/w3af/core/controllers/tests/core_test_suite/test_pause_stop.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import time import pprint @@ -67,6 +68,7 @@ def tearDown(self): class TestW3afCorePause(CountTestMixin): @attr('ci_fails') + @pytest.mark.deprecated def test_pause_unpause(self): """ Verify that the pause method actually works. In this case, working @@ -100,6 +102,7 @@ def test_pause_unpause(self): self.assertEqual(self.count_plugin.count, self.count_plugin.loops) @attr('ci_fails') + @pytest.mark.deprecated def test_pause_stop(self): """ Verify that the pause method actually works. In this case, working @@ -138,6 +141,7 @@ def test_pause_stop(self): self.assertEqual(self.count_plugin.count, count_after_sleep) @attr('ci_fails') + @pytest.mark.deprecated def test_stop(self): """ Verify that the stop method actually works. In this case, working diff --git a/w3af/core/controllers/tests/test_misc_settings.py b/w3af/core/controllers/tests/test_misc_settings.py index 13dffccccd..af7d60f604 100644 --- a/w3af/core/controllers/tests/test_misc_settings.py +++ b/w3af/core/controllers/tests/test_misc_settings.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr diff --git a/w3af/core/controllers/tests/test_pylint.py b/w3af/core/controllers/tests/test_pylint.py index 31d46095c6..1e0e3e4cc3 100644 --- a/w3af/core/controllers/tests/test_pylint.py +++ b/w3af/core/controllers/tests/test_pylint.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest @@ -55,21 +56,25 @@ def run_pylint(self, directory): lint.Run(pylint_args, reporter=TextReporter(pylint_output), exit=False) return pylint_output + @pytest.mark.slow def test_pylint_plugins(self): pylint_output = self.run_pylint('%s/plugins/' % ROOT_PATH) output = pylint_output.read() self.assertEqual(output, [], '\n'.join(output)) + @pytest.mark.slow def test_pylint_core_controllers(self): pylint_output = self.run_pylint('%s/core/controllers/' % ROOT_PATH) output = pylint_output.read() self.assertEqual(output, [], '\n'.join(output)) + @pytest.mark.slow def test_pylint_core_data(self): pylint_output = self.run_pylint('%s/core/data/' % ROOT_PATH) output = pylint_output.read() self.assertEqual(output, [], '\n'.join(output)) + @pytest.mark.slow def test_pylint_core_ui(self): pylint_output = self.run_pylint('%s/core/ui/' % ROOT_PATH) output = pylint_output.read() diff --git a/w3af/core/controllers/tests/test_special_chars.py b/w3af/core/controllers/tests/test_special_chars.py index 4b7f2b6fa9..25f516a323 100644 --- a/w3af/core/controllers/tests/test_special_chars.py +++ b/w3af/core/controllers/tests/test_special_chars.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -56,6 +57,7 @@ class TestSpecialChars(PluginTest): } } + @pytest.mark.deprecated def test_special_chars(self): cfg = self._run_configs['cfg'] diff --git a/w3af/core/controllers/tests/test_w3af_gui.py b/w3af/core/controllers/tests/test_w3af_gui.py index 8091730944..2f93e4a298 100644 --- a/w3af/core/controllers/tests/test_w3af_gui.py +++ b/w3af/core/controllers/tests/test_w3af_gui.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import compiler diff --git a/w3af/core/controllers/threads/tests/test_is_main_process.py b/w3af/core/controllers/threads/tests/test_is_main_process.py index bfa44b9ae2..8784ed12f1 100644 --- a/w3af/core/controllers/threads/tests/test_is_main_process.py +++ b/w3af/core/controllers/threads/tests/test_is_main_process.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.threads.is_main_process import is_main_process diff --git a/w3af/core/controllers/threads/tests/test_is_main_thread.py b/w3af/core/controllers/threads/tests/test_is_main_thread.py index 456e362909..0d6781dd19 100644 --- a/w3af/core/controllers/threads/tests/test_is_main_thread.py +++ b/w3af/core/controllers/threads/tests/test_is_main_thread.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import threading import Queue diff --git a/w3af/core/controllers/threads/tests/test_pebble_limit_memory_usage.py b/w3af/core/controllers/threads/tests/test_pebble_limit_memory_usage.py index 6ff3986a48..5baaac49ff 100644 --- a/w3af/core/controllers/threads/tests/test_pebble_limit_memory_usage.py +++ b/w3af/core/controllers/threads/tests/test_pebble_limit_memory_usage.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import time @@ -84,6 +85,7 @@ def test_sub_process_with_high_memory_usage_but_not_so_much_is_not_killed(self): self.assertEqual(future.result(), usage) self.assertEqual(workers_before_test, pool._pool_manager.worker_manager.workers.keys()[:]) + @pytest.mark.slow def test_effective_kill_limit(self): # # This started as a tool to let me know when the process is killed. @@ -111,6 +113,7 @@ def test_effective_kill_limit(self): #self.assertGreaterEqual(self.MEMORY_LIMIT * 1.2, current_len) #self.assertLessEqual(self.MEMORY_LIMIT * 0.8, current_len) + @pytest.mark.deprecated def test_sub_process_with_high_memory_usage_is_killed(self): # # Run a task that requires a lot of memory. Confirm that the process @@ -144,6 +147,7 @@ def test_sub_process_with_high_memory_usage_is_killed(self): self.assertEqual(workers_before_test, pool._pool_manager.worker_manager.workers.keys()[:]) + @pytest.mark.slow def test_main_process_high_memory_usage_after_starting_nothing_killed(self): # # Run a task that sleeps for a while and start consuming a lot of @@ -165,6 +169,7 @@ def test_main_process_high_memory_usage_after_starting_nothing_killed(self): for future in results: self.assertEqual(future.result(), secs) + @pytest.mark.slow def test_main_process_high_memory_usage_before_starting_nothing_killed(self): # # Consume a lot of memory in the MAIN process, and then run a task in diff --git a/w3af/core/controllers/threads/tests/test_return_args.py b/w3af/core/controllers/threads/tests/test_return_args.py index f4ce5796dc..796c43df5f 100644 --- a/w3af/core/controllers/threads/tests/test_return_args.py +++ b/w3af/core/controllers/threads/tests/test_return_args.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.threads.threadpool import return_args diff --git a/w3af/core/controllers/threads/tests/test_threadpool.py b/w3af/core/controllers/threads/tests/test_threadpool.py index abb9ad44f4..7c32ef41f4 100644 --- a/w3af/core/controllers/threads/tests/test_threadpool.py +++ b/w3af/core/controllers/threads/tests/test_threadpool.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import time import unittest @@ -53,6 +54,7 @@ def raise_on_1(foo): # pylint: disable=E1101 self.assertIn("raise TypeError('%s Boom!' % foo)", te.original_traceback_string) + @pytest.mark.deprecated def test_terminate_join_after_tasks(self): worker_pool = Pool(processes=4, worker_names='WorkerThread', @@ -78,6 +80,7 @@ def test_get_pool_queue_sizes(self): worker_pool.terminate_join() + @pytest.mark.deprecated def test_output_pool_size(self): worker_pool = Pool(processes=4, worker_names='WorkerThread', @@ -178,6 +181,7 @@ def test_worker_stats_idle(self): self.assertIsNone(func_args) self.assertTrue(worker_pool._pool[0].worker.is_idle()) + @pytest.mark.deprecated def test_worker_stats_not_idle(self): worker_pool = Pool(processes=1, worker_names='WorkerThread') @@ -222,6 +226,7 @@ def sleep(sleep_time, **kwargs): self.assertEqual(worker_state['kwargs'], kwds) self.assertEqual(worker_state['idle'], False) + @pytest.mark.slow def test_max_queued_tasks(self): worker_pool = Pool(processes=1, max_queued_tasks=2) diff --git a/w3af/core/data/bloomfilter/tests/generic_filter_test.py b/w3af/core/data/bloomfilter/tests/generic_filter_test.py index 8222ec98a0..d426b0d1db 100644 --- a/w3af/core/data/bloomfilter/tests/generic_filter_test.py +++ b/w3af/core/data/bloomfilter/tests/generic_filter_test.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import random import string diff --git a/w3af/core/data/bloomfilter/tests/test_bloomfilter_impl_selection.py b/w3af/core/data/bloomfilter/tests/test_bloomfilter_impl_selection.py index b16dfb1a65..95305b12cc 100644 --- a/w3af/core/data/bloomfilter/tests/test_bloomfilter_impl_selection.py +++ b/w3af/core/data/bloomfilter/tests/test_bloomfilter_impl_selection.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.bloomfilter.bloomfilter import BloomFilter diff --git a/w3af/core/data/bloomfilter/tests/test_cmmap_bloom.py b/w3af/core/data/bloomfilter/tests/test_cmmap_bloom.py index 042ad97dca..e5be876c74 100644 --- a/w3af/core/data/bloomfilter/tests/test_cmmap_bloom.py +++ b/w3af/core/data/bloomfilter/tests/test_cmmap_bloom.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from pybloomfilter import BloomFilter as CMmapFilter @@ -26,6 +27,7 @@ from w3af.core.data.bloomfilter.wrappers import GenericBloomFilter +@pytest.mark.deprecated class TestCMmapBloomfilterLarge(GenericFilterTest): CAPACITY = 20000 diff --git a/w3af/core/data/bloomfilter/tests/test_scalable_performance.py b/w3af/core/data/bloomfilter/tests/test_scalable_performance.py index 30f958b89e..f1218e50cb 100644 --- a/w3af/core/data/bloomfilter/tests/test_scalable_performance.py +++ b/w3af/core/data/bloomfilter/tests/test_scalable_performance.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.bloomfilter.scalable_bloom import ScalableBloomFilter diff --git a/w3af/core/data/constants/file_templates/tests/test_file_templates.py b/w3af/core/data/constants/file_templates/tests/test_file_templates.py index 73f0f588b5..d66317cff3 100644 --- a/w3af/core/data/constants/file_templates/tests/test_file_templates.py +++ b/w3af/core/data/constants/file_templates/tests/test_file_templates.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.constants.file_templates.file_templates import get_file_from_template diff --git a/w3af/core/data/constants/tests/test_all.py b/w3af/core/data/constants/tests/test_all.py index 9a5b863b23..2f0b18554c 100644 --- a/w3af/core/data/constants/tests/test_all.py +++ b/w3af/core/data/constants/tests/test_all.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.constants.browsers import INTERNET_EXPLORER_7 diff --git a/w3af/core/data/constants/tests/test_common_directories.py b/w3af/core/data/constants/tests/test_common_directories.py index 994fdaa7fe..70aa12107d 100644 --- a/w3af/core/data/constants/tests/test_common_directories.py +++ b/w3af/core/data/constants/tests/test_common_directories.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.constants.common_directories import get_common_directories diff --git a/w3af/core/data/constants/tests/test_vulns.py b/w3af/core/data/constants/tests/test_vulns.py index 28dc71c493..ba3a54827d 100644 --- a/w3af/core/data/constants/tests/test_vulns.py +++ b/w3af/core/data/constants/tests/test_vulns.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import re import unittest @@ -108,6 +109,7 @@ def get_all_plugins_source(self): return all_plugin_sources + @pytest.mark.deprecated def test_all_vulnerability_names_from_db_are_used(self): vuln_names = VULNS.keys() all_plugin_sources = self.get_all_plugins_source() @@ -122,6 +124,7 @@ def test_all_vulnerability_names_from_db_are_used(self): msg = '"%s" not in plugin sources' % vuln_name self.assertIn(vuln_name, all_plugin_sources, msg) + @pytest.mark.deprecated def test_all_vulnerability_names_from_source_in_db(self): vuln_names = VULNS.keys() vuln_names_re = ' (Info|Vuln)\\(["\'](.*?)["\'] ?,.*?\\)' diff --git a/w3af/core/data/context/tests/test_css.py b/w3af/core/data/context/tests/test_css.py index 56834e4b4c..32363554a4 100644 --- a/w3af/core/data/context/tests/test_css.py +++ b/w3af/core/data/context/tests/test_css.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.data.context.tests.context_test import ContextTest from w3af.core.data.context.context.css import get_css_context from w3af.core.data.context.context.css import (GenericStyleContext, diff --git a/w3af/core/data/context/tests/test_html.py b/w3af/core/data/context/tests/test_html.py index 24d7afe6be..95fc035301 100644 --- a/w3af/core/data/context/tests/test_html.py +++ b/w3af/core/data/context/tests/test_html.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.data.context.tests.context_test import ContextTest diff --git a/w3af/core/data/context/tests/test_html_css.py b/w3af/core/data/context/tests/test_html_css.py index b42c7881b1..0d510349fd 100644 --- a/w3af/core/data/context/tests/test_html_css.py +++ b/w3af/core/data/context/tests/test_html_css.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.context.context.main import get_context diff --git a/w3af/core/data/context/tests/test_html_javascript.py b/w3af/core/data/context/tests/test_html_javascript.py index 6b97220e10..7871c0f103 100644 --- a/w3af/core/data/context/tests/test_html_javascript.py +++ b/w3af/core/data/context/tests/test_html_javascript.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.context.context.main import get_context @@ -104,6 +105,7 @@ def test_payload_javascript_href_start_with_space(self): self.assertIsInstance(context, HtmlAttrDoubleQuote) self.assertTrue(context.is_executable()) + @pytest.mark.deprecated def test_payload_href_append_no_exec(self): html = """ diff --git a/w3af/core/data/context/tests/test_javascript.py b/w3af/core/data/context/tests/test_javascript.py index 821f393fdd..cb462af101 100644 --- a/w3af/core/data/context/tests/test_javascript.py +++ b/w3af/core/data/context/tests/test_javascript.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.data.context.tests.context_test import ContextTest from w3af.core.data.context.context.javascript import get_js_context from w3af.core.data.context.context.javascript import (ScriptExecutableContext, diff --git a/w3af/core/data/db/tests/test_cached_disk_dict.py b/w3af/core/data/db/tests/test_cached_disk_dict.py index 4584345a66..142c0b0315 100644 --- a/w3af/core/data/db/tests/test_cached_disk_dict.py +++ b/w3af/core/data/db/tests/test_cached_disk_dict.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.db.cached_disk_dict import CachedDiskDict diff --git a/w3af/core/data/db/tests/test_dbms.py b/w3af/core/data/db/tests/test_dbms.py index 315d601297..e5cb93c72c 100644 --- a/w3af/core/data/db/tests/test_dbms.py +++ b/w3af/core/data/db/tests/test_dbms.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import string import time diff --git a/w3af/core/data/db/tests/test_disk_deque.py b/w3af/core/data/db/tests/test_disk_deque.py index b286aa2688..2ee137dfe4 100644 --- a/w3af/core/data/db/tests/test_disk_deque.py +++ b/w3af/core/data/db/tests/test_disk_deque.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr diff --git a/w3af/core/data/db/tests/test_disk_dict.py b/w3af/core/data/db/tests/test_disk_dict.py index 78c59d0b34..c5712f6eeb 100644 --- a/w3af/core/data/db/tests/test_disk_dict.py +++ b/w3af/core/data/db/tests/test_disk_dict.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import time import unittest @@ -89,6 +90,7 @@ def test_len(self): self.assertEqual(len(disk_dict), 1) + @pytest.mark.slow def test_len_performance(self): disk_dict = DiskDict() diff --git a/w3af/core/data/db/tests/test_disk_list.py b/w3af/core/data/db/tests/test_disk_list.py index a55f55717f..d1ddb44caa 100644 --- a/w3af/core/data/db/tests/test_disk_list.py +++ b/w3af/core/data/db/tests/test_disk_list.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import random import string import unittest @@ -43,6 +44,7 @@ def setUp(self): create_temp_dir() @attr('smoke') + @pytest.mark.slow def test_int(self): dl = DiskList() @@ -66,6 +68,7 @@ def test_to_unicode(self): self.assertEqual(unicode(dl), u'') @attr('smoke') + @pytest.mark.slow def test_string(self): dl = DiskList() @@ -237,6 +240,7 @@ def test_reverse_iteration(self): self.assertEqual(reverse_iter_res, [3, 2, 1]) + @pytest.mark.slow def test_thread_safe(self): dl = DiskList() @@ -350,6 +354,7 @@ def test_slice_first_N(self): self.assertNotIn('2', dl_copy) self.assertNotIn('3', dl_copy) + @pytest.mark.slow def test_no_specific_serializer_with_string(self): # # This test runs in ~5.1 seconds on my workstation @@ -366,6 +371,7 @@ def test_no_specific_serializer_with_string(self): # This tests the deserialization _ = dl[i] + @pytest.mark.slow def test_specific_serializer_with_string(self): # # This test runs in ~5.0 seconds on my workstation @@ -386,6 +392,7 @@ def test_specific_serializer_with_string(self): # This tests the deserialization _ = dl[i] + @pytest.mark.slow def test_no_specific_serializer_with_http_response(self): # # This test runs in 28.14 seconds on my workstation @@ -405,6 +412,7 @@ def test_no_specific_serializer_with_http_response(self): # This tests the deserialization _ = dl[i] + @pytest.mark.slow def test_specific_serializer_with_http_response(self): # # This test runs in 26.42 seconds on my workstation diff --git a/w3af/core/data/db/tests/test_disk_set.py b/w3af/core/data/db/tests/test_disk_set.py index 1e138011e2..a2d8d6e32c 100644 --- a/w3af/core/data/db/tests/test_disk_set.py +++ b/w3af/core/data/db/tests/test_disk_set.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import threading diff --git a/w3af/core/data/db/tests/test_history.py b/w3af/core/data/db/tests/test_history.py index ca945cad8d..fa4e50ff50 100644 --- a/w3af/core/data/db/tests/test_history.py +++ b/w3af/core/data/db/tests/test_history.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import zipfile import random import unittest @@ -52,11 +53,13 @@ def tearDown(self): HistoryItem().clear() kb.kb.cleanup() + @pytest.mark.deprecated def test_single_db(self): h1 = HistoryItem() h2 = HistoryItem() self.assertEqual(h1._db, h2._db) + @pytest.mark.deprecated def test_find(self): find_id = random.randint(1, 499) url = URL('http://w3af.org/a/b/foobar.php?foo=123') @@ -92,6 +95,7 @@ def test_find(self): ('id', find_id - 1, ">")] self.assertEqual(len(h2.find(search_data)), 1) + @pytest.mark.deprecated def test_mark(self): mark_id = 3 url = URL('http://w3af.org/a/b/c.php') @@ -116,6 +120,7 @@ def test_mark(self): h3.load(mark_id-1) self.assertFalse(h3.mark) + @pytest.mark.deprecated def test_save_load(self): i = random.randint(1, 499) url = URL('http://w3af.com/a/b/c.php') @@ -136,10 +141,12 @@ def test_save_load(self): self.assertEqual(h1.request.to_dict(), h2.request.to_dict()) self.assertEqual(h1.response.body, h2.response.body) + @pytest.mark.deprecated def test_load_not_exists(self): h = HistoryItem() self.assertRaises(DBException, h.load, 1) + @pytest.mark.deprecated def test_save_load_compressed(self): force_compression_count = HistoryItem._UNCOMPRESSED_FILES + HistoryItem._COMPRESSED_FILE_BATCH force_compression_count += 150 @@ -178,6 +185,7 @@ def test_save_load_compressed(self): self.assertEqual(h.response.get_headers(), headers) self.assertEqual(h.response.get_body(), body) + @pytest.mark.deprecated def test_delete(self): i = random.randint(1, 499) @@ -200,6 +208,7 @@ def test_delete(self): self.assertRaises(DBException, h1.read, i) self.assertFalse(os.path.exists(fname)) + @pytest.mark.deprecated def test_clear(self): url = URL('http://w3af.com/a/b/c.php') request = HTTPRequest(url, data='a=1') @@ -227,6 +236,7 @@ def test_clear(self): # all rows from the table, not the table itself self.assertTrue(db.table_exists(table_name)) + @pytest.mark.deprecated def test_clear_clear(self): url = URL('http://w3af.com/a/b/c.php') request = HTTPRequest(url, data='a=1') @@ -242,11 +252,13 @@ def test_clear_clear(self): h1.clear() h1.clear() + @pytest.mark.deprecated def test_init_init(self): # No exceptions should be raised HistoryItem().init() HistoryItem().init() + @pytest.mark.deprecated def test_tag(self): tag_id = random.randint(501, 999) tag_value = rand_alnum(10) @@ -268,6 +280,7 @@ def test_tag(self): h2.load(tag_id) self.assertEqual(h2.tag, tag_value) + @pytest.mark.deprecated def test_save_load_unicode_decode_error(self): url = URL('http://w3af.com/a/b/é.php?x=á') request = HTTPRequest(url, data='a=1') diff --git a/w3af/core/data/db/tests/test_startup_cfg.py b/w3af/core/data/db/tests/test_startup_cfg.py index e85636ead4..d3dc37043c 100644 --- a/w3af/core/data/db/tests/test_startup_cfg.py +++ b/w3af/core/data/db/tests/test_startup_cfg.py @@ -17,6 +17,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest diff --git a/w3af/core/data/db/tests/test_url_tree.py b/w3af/core/data/db/tests/test_url_tree.py index 2a5c6b16eb..78bdb58a0c 100644 --- a/w3af/core/data/db/tests/test_url_tree.py +++ b/w3af/core/data/db/tests/test_url_tree.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.db.url_tree import URLTree, URLNode, url_tree_factory diff --git a/w3af/core/data/db/tests/test_variant_db.py b/w3af/core/data/db/tests/test_variant_db.py index f9f8670e28..90f6c4f799 100644 --- a/w3af/core/data/db/tests/test_variant_db.py +++ b/w3af/core/data/db/tests/test_variant_db.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.misc_settings import MiscSettings @@ -124,6 +125,7 @@ def test_clean_fuzzable_request_file(self): e = u'(GET)-http://w3af.org/%s.php' % FILENAME_TOKEN self.assertEqual(s, e) + @pytest.mark.deprecated def test_clean_fuzzable_request_directory_file(self): u = 'http://w3af.org/foo/index.php' s = clean_fuzzable_request(fr(URL(u))) diff --git a/w3af/core/data/dc/generic/tests/test_data_container.py b/w3af/core/data/dc/generic/tests/test_data_container.py index 411a861fa2..18fc822c64 100644 --- a/w3af/core/data/dc/generic/tests/test_data_container.py +++ b/w3af/core/data/dc/generic/tests/test_data_container.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.dc.generic.data_container import DataContainer diff --git a/w3af/core/data/dc/generic/tests/test_form.py b/w3af/core/data/dc/generic/tests/test_form.py index 3bb93496c4..5ad39608c3 100644 --- a/w3af/core/data/dc/generic/tests/test_form.py +++ b/w3af/core/data/dc/generic/tests/test_form.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import cPickle import copy diff --git a/w3af/core/data/dc/generic/tests/test_kv_container.py b/w3af/core/data/dc/generic/tests/test_kv_container.py index aea0da7f08..f28dcf1ab2 100644 --- a/w3af/core/data/dc/generic/tests/test_kv_container.py +++ b/w3af/core/data/dc/generic/tests/test_kv_container.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import urllib import copy @@ -196,6 +197,7 @@ def test_get_short_printable_repr(self): self.assertEqual(dc.get_short_printable_repr(), 'a=1&b=2&b=3') + @pytest.mark.deprecated def test_get_short_printable_repr_token_obj_reduce_printable(self): dc = KeyValueContainer([(u'a', ['1']), (u'b', ['2', '3'])]) dc.MAX_PRINTABLE = 5 diff --git a/w3af/core/data/dc/generic/tests/test_nr_kv_container.py b/w3af/core/data/dc/generic/tests/test_nr_kv_container.py index e8ed497a74..54531c1d66 100644 --- a/w3af/core/data/dc/generic/tests/test_nr_kv_container.py +++ b/w3af/core/data/dc/generic/tests/test_nr_kv_container.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import urllib import copy @@ -66,6 +67,7 @@ def test_iter_tokens(self): token_data = [(t.get_name(), t.get_value()) for t in tokens] self.assertEqual(EXPECTED_TOKENS, token_data) + @pytest.mark.deprecated def test_iter_bound_tokens(self): dc = NonRepeatKeyValueContainer([(u'a', u'1'), (u'b', u'2')]) dcc_tokens = [(dcc, t) for dcc, t in dc.iter_bound_tokens()] diff --git a/w3af/core/data/dc/generic/tests/test_plain.py b/w3af/core/data/dc/generic/tests/test_plain.py index b92b202fe2..ad529f0374 100644 --- a/w3af/core/data/dc/generic/tests/test_plain.py +++ b/w3af/core/data/dc/generic/tests/test_plain.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.dc.generic.plain import PlainContainer diff --git a/w3af/core/data/dc/tests/test_cookie.py b/w3af/core/data/dc/tests/test_cookie.py index 804ff9e86c..ddc8a487dd 100644 --- a/w3af/core/data/dc/tests/test_cookie.py +++ b/w3af/core/data/dc/tests/test_cookie.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import copy diff --git a/w3af/core/data/dc/tests/test_data_container_subclasses.py b/w3af/core/data/dc/tests/test_data_container_subclasses.py index 4a6534a93e..d91ba7a00d 100644 --- a/w3af/core/data/dc/tests/test_data_container_subclasses.py +++ b/w3af/core/data/dc/tests/test_data_container_subclasses.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.dc.cookie import Cookie diff --git a/w3af/core/data/dc/tests/test_factory.py b/w3af/core/data/dc/tests/test_factory.py index 53b57b7514..0b5f6a0cd0 100644 --- a/w3af/core/data/dc/tests/test_factory.py +++ b/w3af/core/data/dc/tests/test_factory.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import json diff --git a/w3af/core/data/dc/tests/test_headers.py b/w3af/core/data/dc/tests/test_headers.py index 1780c8c5e8..d80c8bb0f1 100644 --- a/w3af/core/data/dc/tests/test_headers.py +++ b/w3af/core/data/dc/tests/test_headers.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import copy diff --git a/w3af/core/data/dc/tests/test_json_container.py b/w3af/core/data/dc/tests/test_json_container.py index 0298357d27..fa7413e61e 100644 --- a/w3af/core/data/dc/tests/test_json_container.py +++ b/w3af/core/data/dc/tests/test_json_container.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import pickle import unittest import copy diff --git a/w3af/core/data/dc/tests/test_multipart.py b/w3af/core/data/dc/tests/test_multipart.py index 99da6a17db..dba3512c42 100644 --- a/w3af/core/data/dc/tests/test_multipart.py +++ b/w3af/core/data/dc/tests/test_multipart.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import copy import os diff --git a/w3af/core/data/dc/tests/test_query_string.py b/w3af/core/data/dc/tests/test_query_string.py index 0c2b3aa60c..a68f1abc09 100644 --- a/w3af/core/data/dc/tests/test_query_string.py +++ b/w3af/core/data/dc/tests/test_query_string.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import copy import cPickle diff --git a/w3af/core/data/dc/tests/test_urlencoded_form.py b/w3af/core/data/dc/tests/test_urlencoded_form.py index fe6fd303d5..374f3b2853 100644 --- a/w3af/core/data/dc/tests/test_urlencoded_form.py +++ b/w3af/core/data/dc/tests/test_urlencoded_form.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import urllib import copy diff --git a/w3af/core/data/dc/tests/test_xmlrpc.py b/w3af/core/data/dc/tests/test_xmlrpc.py index e20a330ada..ab617974fb 100644 --- a/w3af/core/data/dc/tests/test_xmlrpc.py +++ b/w3af/core/data/dc/tests/test_xmlrpc.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import copy diff --git a/w3af/core/data/dc/utils/tests/test_json_iter_setters.py b/w3af/core/data/dc/utils/tests/test_json_iter_setters.py index ef0f8ff83e..677693ba5a 100644 --- a/w3af/core/data/dc/utils/tests/test_json_iter_setters.py +++ b/w3af/core/data/dc/utils/tests/test_json_iter_setters.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import json diff --git a/w3af/core/data/dc/utils/tests/test_multipart.py b/w3af/core/data/dc/utils/tests/test_multipart.py index 4f7d3f5940..93661b40c0 100644 --- a/w3af/core/data/dc/utils/tests/test_multipart.py +++ b/w3af/core/data/dc/utils/tests/test_multipart.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.dc.utils.multipart import multipart_encode diff --git a/w3af/core/data/dc/utils/tests/test_token.py b/w3af/core/data/dc/utils/tests/test_token.py index 2a91942f6e..5cbe9a63b9 100644 --- a/w3af/core/data/dc/utils/tests/test_token.py +++ b/w3af/core/data/dc/utils/tests/test_token.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import copy diff --git a/w3af/core/data/export/tests/test_ajax_export.py b/w3af/core/data/export/tests/test_ajax_export.py index 7599a47c02..488bea73da 100644 --- a/w3af/core/data/export/tests/test_ajax_export.py +++ b/w3af/core/data/export/tests/test_ajax_export.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.export.ajax_export import ajax_export diff --git a/w3af/core/data/export/tests/test_html_export.py b/w3af/core/data/export/tests/test_html_export.py index 86c3adc7db..7c7c9ff4ec 100644 --- a/w3af/core/data/export/tests/test_html_export.py +++ b/w3af/core/data/export/tests/test_html_export.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.export.html_export import html_export diff --git a/w3af/core/data/export/tests/test_python_export.py b/w3af/core/data/export/tests/test_python_export.py index d1541a8527..b275a6101d 100644 --- a/w3af/core/data/export/tests/test_python_export.py +++ b/w3af/core/data/export/tests/test_python_export.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import compiler diff --git a/w3af/core/data/export/tests/test_ruby_export.py b/w3af/core/data/export/tests/test_ruby_export.py index a1a19864ba..204ffcc529 100644 --- a/w3af/core/data/export/tests/test_ruby_export.py +++ b/w3af/core/data/export/tests/test_ruby_export.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.export.ruby_export import ruby_export diff --git a/w3af/core/data/fuzzer/mutants/tests/test_cookie_mutant.py b/w3af/core/data/fuzzer/mutants/tests/test_cookie_mutant.py index 1194a5ae77..f244b32813 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_cookie_mutant.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_cookie_mutant.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.fuzzer.mutants.cookie_mutant import CookieMutant diff --git a/w3af/core/data/fuzzer/mutants/tests/test_empty_mutant.py b/w3af/core/data/fuzzer/mutants/tests/test_empty_mutant.py index a8f40c27d5..a9f308df0b 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_empty_mutant.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_empty_mutant.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.fuzzer.mutants.empty_mutant import EmptyMutant diff --git a/w3af/core/data/fuzzer/mutants/tests/test_filecontent_mutant.py b/w3af/core/data/fuzzer/mutants/tests/test_filecontent_mutant.py index 8e0a03f9d3..6d9ab6864e 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_filecontent_mutant.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_filecontent_mutant.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import copy diff --git a/w3af/core/data/fuzzer/mutants/tests/test_filename_mutant.py b/w3af/core/data/fuzzer/mutants/tests/test_filename_mutant.py index 779fa7d9f7..0d422bdf7e 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_filename_mutant.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_filename_mutant.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.doc.url import URL diff --git a/w3af/core/data/fuzzer/mutants/tests/test_headers_mutants.py b/w3af/core/data/fuzzer/mutants/tests/test_headers_mutants.py index 477a57455f..9542efa48a 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_headers_mutants.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_headers_mutants.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.doc.url import URL diff --git a/w3af/core/data/fuzzer/mutants/tests/test_json_mutant.py b/w3af/core/data/fuzzer/mutants/tests/test_json_mutant.py index 86987e65f0..4dbf0bdcf9 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_json_mutant.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_json_mutant.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import json import copy diff --git a/w3af/core/data/fuzzer/mutants/tests/test_mutant.py b/w3af/core/data/fuzzer/mutants/tests/test_mutant.py index 666bd149a0..e51121fc3c 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_mutant.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_mutant.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import copy diff --git a/w3af/core/data/fuzzer/mutants/tests/test_postdata_mutant.py b/w3af/core/data/fuzzer/mutants/tests/test_postdata_mutant.py index c4f6e729c0..93fa50ff40 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_postdata_mutant.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_postdata_mutant.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.doc.url import URL diff --git a/w3af/core/data/fuzzer/mutants/tests/test_querystring_mutant.py b/w3af/core/data/fuzzer/mutants/tests/test_querystring_mutant.py index 67df240cac..9536b44e95 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_querystring_mutant.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_querystring_mutant.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.doc.url import URL diff --git a/w3af/core/data/fuzzer/mutants/tests/test_urlparts_mutant.py b/w3af/core/data/fuzzer/mutants/tests/test_urlparts_mutant.py index 22f6ba17c3..e9d2de06de 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_urlparts_mutant.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_urlparts_mutant.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import cPickle @@ -51,6 +52,7 @@ def test_basics(self): self.assertEqual(generated_found_at, expected_found_at) + @pytest.mark.deprecated def test_pickle(self): divided_path = URLPartsContainer('/', 'ping!', '/bar') loaded_dp = cPickle.loads(cPickle.dumps(divided_path)) diff --git a/w3af/core/data/fuzzer/mutants/tests/test_xmlrpc_mutant.py b/w3af/core/data/fuzzer/mutants/tests/test_xmlrpc_mutant.py index b56908d49e..51e145d83a 100644 --- a/w3af/core/data/fuzzer/mutants/tests/test_xmlrpc_mutant.py +++ b/w3af/core/data/fuzzer/mutants/tests/test_xmlrpc_mutant.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.doc.url import URL diff --git a/w3af/core/data/fuzzer/tests/test_form_filler.py b/w3af/core/data/fuzzer/tests/test_form_filler.py index 269c76cc0e..00d51b7194 100644 --- a/w3af/core/data/fuzzer/tests/test_form_filler.py +++ b/w3af/core/data/fuzzer/tests/test_form_filler.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr diff --git a/w3af/core/data/fuzzer/tests/test_fuzzer.py b/w3af/core/data/fuzzer/tests/test_fuzzer.py index 17637d0e54..47b3270d5d 100644 --- a/w3af/core/data/fuzzer/tests/test_fuzzer.py +++ b/w3af/core/data/fuzzer/tests/test_fuzzer.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.kb.config import Config @@ -123,6 +124,7 @@ def test_special_url_characters(self): self.assertAllInstance(generated_mutants, QSMutant) self.assertAllHaveTokens(generated_mutants) + @pytest.mark.deprecated def test_fuzz_headers_no_headers_in_request(self): cf_singleton.save('fuzzable_headers', ['Referer']) # This one changed cf_singleton.save('fuzz_cookies', False) @@ -370,6 +372,7 @@ def test_urlparts_no_path(self): self.assertEqual(generated_mutants, []) + @pytest.mark.deprecated def test_urlparts_filename_path_qs(self): cf_singleton.save('fuzzable_headers', []) cf_singleton.save('fuzz_cookies', False) diff --git a/w3af/core/data/fuzzer/tests/test_fuzzer_utils.py b/w3af/core/data/fuzzer/tests/test_fuzzer_utils.py index 0df5bc6cff..25712b0736 100644 --- a/w3af/core/data/fuzzer/tests/test_fuzzer_utils.py +++ b/w3af/core/data/fuzzer/tests/test_fuzzer_utils.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.fuzzer.utils import rand_alpha, rand_alnum, rand_number diff --git a/w3af/core/data/kb/tests/test_exec_shell.py b/w3af/core/data/kb/tests/test_exec_shell.py index 84b5894869..51a55e1273 100644 --- a/w3af/core/data/kb/tests/test_exec_shell.py +++ b/w3af/core/data/kb/tests/test_exec_shell.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.kb.exec_shell import ExecShell diff --git a/w3af/core/data/kb/tests/test_info.py b/w3af/core/data/kb/tests/test_info.py index 2ae65c72f5..06633037e0 100644 --- a/w3af/core/data/kb/tests/test_info.py +++ b/w3af/core/data/kb/tests/test_info.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json import copy import cPickle @@ -123,6 +124,7 @@ def test_set_desc(self): i.set_desc(desc) self.assertTrue(i.get_desc().startswith(desc)) + @pytest.mark.deprecated def test_get_desc_new_line(self): """ https://github.com/andresriancho/w3af/issues/12220 diff --git a/w3af/core/data/kb/tests/test_info_set.py b/w3af/core/data/kb/tests/test_info_set.py index 4274ce6975..46267d816a 100644 --- a/w3af/core/data/kb/tests/test_info_set.py +++ b/w3af/core/data/kb/tests/test_info_set.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import copy import json import unittest diff --git a/w3af/core/data/kb/tests/test_knowledge_base.py b/w3af/core/data/kb/tests/test_knowledge_base.py index 1536d50400..8f3af13518 100644 --- a/w3af/core/data/kb/tests/test_knowledge_base.py +++ b/w3af/core/data/kb/tests/test_knowledge_base.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import copy import uuid import unittest @@ -57,27 +58,33 @@ class TestKnowledgeBase(unittest.TestCase): def setUp(self): kb.cleanup() + @pytest.mark.deprecated def test_basic(self): kb.raw_write('a', 'b', 'c') data = kb.raw_read('a', 'b') self.assertEqual(data, 'c') + @pytest.mark.deprecated def test_default_get(self): self.assertEqual(kb.get('a', 'b'), []) + @pytest.mark.deprecated def test_default_raw_read(self): self.assertEqual(kb.raw_read('a', 'b'), []) + @pytest.mark.deprecated def test_raw_read_error(self): kb.append('a', 'b', MockInfo()) kb.append('a', 'b', MockInfo()) self.assertRaises(RuntimeError, kb.raw_read,'a', 'b') + @pytest.mark.deprecated def test_default_first_saved(self): kb.raw_write('a', 'b', 'c') self.assertEqual(kb.get('a', 'not-exist'), []) self.assertEqual(kb.raw_read('a', 'not-exist'), []) + @pytest.mark.deprecated def test_return_all_for_plugin(self): i1 = MockInfo() i2 = MockInfo() @@ -89,6 +96,7 @@ def test_return_all_for_plugin(self): self.assertEqual(kb.get('a', 'b'), [i1, i2, i3]) + @pytest.mark.deprecated def test_append(self): i1 = MockInfo() i2 = MockInfo() @@ -102,6 +110,7 @@ def test_append(self): self.assertEqual(kb.get('a', 'b'), [i1, i1, i1, i2, i3]) + @pytest.mark.deprecated def test_append_uniq_var_default(self): i1 = MockInfo() i1.set_uri(URL('http://moth/abc.html?id=1')) @@ -117,6 +126,7 @@ def test_append_uniq_var_default(self): kb.append_uniq('a', 'b', i2) self.assertEqual(kb.get('a', 'b'), [i1, ]) + @pytest.mark.deprecated def test_append_uniq_var_specific(self): i1 = MockInfo() i1.set_uri(URL('http://moth/abc.html?id=1')) @@ -132,6 +142,7 @@ def test_append_uniq_var_specific(self): kb.append_uniq('a', 'b', i2, filter_by='VAR') self.assertEqual(kb.get('a', 'b'), [i1, ]) + @pytest.mark.deprecated def test_append_uniq_var_bug_10Dec2012(self): i1 = MockInfo() i1.set_uri(URL('http://moth/abc.html?id=1')) @@ -147,6 +158,7 @@ def test_append_uniq_var_bug_10Dec2012(self): kb.append_uniq('a', 'b', i2) self.assertEqual(kb.get('a', 'b'), [i1, ]) + @pytest.mark.deprecated def test_append_uniq_var_not_uniq_diff_url(self): i1 = MockInfo() i1.set_uri(URL('http://moth/abc.html?id=1')) @@ -162,6 +174,7 @@ def test_append_uniq_var_not_uniq_diff_url(self): kb.append_uniq('a', 'b', i2) self.assertEqual(kb.get('a', 'b'), [i1, i2]) + @pytest.mark.deprecated def test_append_uniq_var_not_uniq_diff_token_name(self): i1 = MockInfo() i1.set_uri(URL('http://moth/abc.html?id=1&foo=bar')) @@ -179,6 +192,7 @@ def test_append_uniq_var_not_uniq_diff_token_name(self): kb.append_uniq('a', 'b', i2) self.assertEqual(kb.get('a', 'b'), [i1, i2]) + @pytest.mark.deprecated def test_append_uniq_var_not_uniq_diff_token_name_three(self): i1 = MockInfo() i1.set_uri(URL('http://moth/abc.html?id=1&foo=bar')) @@ -204,6 +218,7 @@ def test_append_uniq_var_not_uniq_diff_token_name_three(self): kb.append_uniq('a', 'b', i3) self.assertEqual(kb.get('a', 'b'), [i1, i2]) + @pytest.mark.deprecated def test_append_uniq_var_diff_params(self): i1 = MockInfo() i1.set_uri(URL('http://moth/abc.html?id=1')) @@ -219,6 +234,7 @@ def test_append_uniq_var_diff_params(self): kb.append_uniq('a', 'b', i2) self.assertEqual(kb.get('a', 'b'), [i1]) + @pytest.mark.deprecated def test_append_uniq_url_uniq(self): i1 = MockInfo() i1.set_uri(URL('http://moth/abc.html?id=1')) @@ -234,6 +250,7 @@ def test_append_uniq_url_uniq(self): kb.append_uniq('a', 'b', i2, filter_by='URL') self.assertEqual(kb.get('a', 'b'), [i1]) + @pytest.mark.deprecated def test_append_uniq_url_different(self): i1 = MockInfo() i1.set_uri(URL('http://moth/abc.html?id=1')) @@ -249,6 +266,7 @@ def test_append_uniq_url_different(self): kb.append_uniq('a', 'b', i2, filter_by='URL') self.assertEqual(kb.get('a', 'b'), [i1, i2]) + @pytest.mark.deprecated def test_append_save(self): i1 = MockInfo() @@ -257,6 +275,7 @@ def test_append_save(self): self.assertEqual(kb.raw_read('a', 'b'), 3) + @pytest.mark.deprecated def test_save_append(self): """ Although calling raw_write and then append is highly discouraged, @@ -272,14 +291,17 @@ def test_save_append(self): self.assertEqual(kb.get('a', 'b'), [i1, i2]) + @pytest.mark.deprecated def test_all_of_klass(self): kb.raw_write('a', 'b', 1) self.assertEqual(kb.get_all_entries_of_class(int), [1]) + @pytest.mark.deprecated def test_all_of_klass_str(self): kb.raw_write('a', 'b', 'abc') self.assertEqual(kb.get_all_entries_of_class(str), ['abc']) + @pytest.mark.deprecated def test_get_all_uniq_ids_iter(self): i1 = MockInfo() kb.append('a', 'b', i1) @@ -288,6 +310,7 @@ def test_get_all_uniq_ids_iter(self): self.assertEqual(uniq_ids, [i1.get_uniq_id()]) + @pytest.mark.deprecated def test_get_all_uniq_ids_iter_include_ids(self): i1 = MockInfo() kb.append('a', 'b', i1) @@ -296,6 +319,7 @@ def test_get_all_uniq_ids_iter_include_ids(self): self.assertEqual(uniq_ids, [i1.get_uniq_id()]) + @pytest.mark.deprecated def test_get_all_uniq_ids_iter_include_ids_false(self): i1 = MockInfo() kb.append('a', 'b', i1) @@ -304,6 +328,7 @@ def test_get_all_uniq_ids_iter_include_ids_false(self): self.assertEqual(uniq_ids, []) + @pytest.mark.deprecated def test_all_of_info_vuln(self): i1 = MockInfo() i2 = MockInfo() @@ -323,6 +348,7 @@ def test_all_of_info_vuln(self): self.assertEqual(kb.get_all_infos(), [i1, iset]) self.assertEqual(kb.get_all_findings(), [i1, iset, v1, vset]) + @pytest.mark.deprecated def test_all_of_info_exclude_ids(self): i1 = MockInfo() i2 = MockInfo() @@ -346,14 +372,17 @@ def test_all_of_info_exclude_ids(self): self.assertEqual(all_findings_except_v1, [i1, iset, vset]) self.assertEqual(all_findings_except_v1_v2, [i1, iset]) + @pytest.mark.deprecated def test_dump_empty(self): empty = kb.dump() self.assertEqual(empty, {}) + @pytest.mark.deprecated def test_dump(self): kb.raw_write('a', 'b', 1) self.assertEqual(kb.dump(), {'a': {'b': [1]}}) + @pytest.mark.deprecated def test_clear(self): kb.raw_write('a', 'b', 'abc') kb.raw_write('a', 'c', 'abc') @@ -361,15 +390,18 @@ def test_clear(self): self.assertEqual(kb.raw_read('a', 'b'), []) self.assertEqual(kb.raw_read('a', 'c'), 'abc') + @pytest.mark.deprecated def test_overwrite(self): kb.raw_write('a', 'b', 'abc') kb.raw_write('a', 'b', 'def') self.assertEqual(kb.raw_read('a', 'b'), 'def') + @pytest.mark.deprecated def test_raw_write_dict(self): kb.raw_write('a', 'b', {}) self.assertEqual(kb.raw_read('a', 'b'), {}) + @pytest.mark.deprecated def test_drop_table(self): kb = DBKnowledgeBase() kb.setup() @@ -383,6 +415,7 @@ def test_drop_table(self): self.assertFalse(db.table_exists(table_name)) + @pytest.mark.deprecated def test_observer_append(self): observer1 = Mock() info = MockInfo() @@ -393,6 +426,7 @@ def test_observer_append(self): observer1.append.assert_called_once_with('a', 'b', info, ignore_type=False) + @pytest.mark.deprecated def test_observer_update(self): observer1 = Mock() info = MockInfo() @@ -405,6 +439,7 @@ def test_observer_update(self): observer1.update.assert_called_once_with(old_info, info) + @pytest.mark.deprecated def test_observer_add_url(self): observer1 = Mock() url = URL('http://www.w3af.org/') @@ -414,6 +449,7 @@ def test_observer_add_url(self): observer1.add_url.assert_called_once_with(url) + @pytest.mark.deprecated def test_observer_multiple_observers(self): observer1 = Mock() observer2 = Mock() @@ -425,6 +461,7 @@ def test_observer_multiple_observers(self): observer1.append.assert_called_once_with('a', 'b', 1, ignore_type=True) observer2.append.assert_called_once_with('a', 'b', 1, ignore_type=True) + @pytest.mark.deprecated def test_pickleable_info(self): original_info = MockInfo() @@ -433,6 +470,7 @@ def test_pickleable_info(self): self.assertEqual(original_info, unpickled_info) + @pytest.mark.deprecated def test_pickleable_vuln(self): original_vuln = MockVuln() @@ -441,6 +479,7 @@ def test_pickleable_vuln(self): self.assertEqual(original_vuln, unpickled_vuln) + @pytest.mark.deprecated def test_pickleable_shells(self): pool = Pool(1) xurllib = ExtendedUrllib() @@ -458,6 +497,7 @@ def test_pickleable_shells(self): pool.join() xurllib.end() + @pytest.mark.deprecated def test_pickleable_shells_get_all(self): class FakeCore(object): worker_pool = Pool(1) @@ -477,6 +517,7 @@ class FakeCore(object): core.worker_pool.join() core.uri_opener.end() + @pytest.mark.deprecated def test_get_by_uniq_id(self): i1 = MockInfo() kb.append('a', 'b', i1) @@ -484,9 +525,11 @@ def test_get_by_uniq_id(self): i1_copy = kb.get_by_uniq_id(i1.get_uniq_id()) self.assertEqual(i1_copy, i1) + @pytest.mark.deprecated def test_get_by_uniq_id_not_exists(self): self.assertIs(kb.get_by_uniq_id(hash('foo')), None) + @pytest.mark.deprecated def test_get_by_uniq_id_duplicated_ignores_second(self): """ TODO: Analyze this case, i1 and i2 have both the same ID because they @@ -503,6 +546,7 @@ def test_get_by_uniq_id_duplicated_ignores_second(self): i1_copy = kb.get_by_uniq_id(i1.get_uniq_id()) self.assertEqual(i1_copy, i1) + @pytest.mark.deprecated def test_raw_write_list(self): """ Test for _get_uniq_id which needs to be able to hash any object type. @@ -510,9 +554,11 @@ def test_raw_write_list(self): kb.raw_write('a', 'b', [1, 2, 3]) self.assertEqual(kb.raw_read('a', 'b'), [1, 2, 3]) + @pytest.mark.deprecated def test_kb_list_shells_empty(self): self.assertEqual(kb.get_all_shells(), []) + @pytest.mark.deprecated def test_kb_list_shells_sqlmap_2181(self): """ Also very related with test_pickleable_shells @@ -538,6 +584,7 @@ def test_kb_list_shells_sqlmap_2181(self): w3af_core.quit() + @pytest.mark.deprecated def test_kb_list_shells_dav_2181(self): """ :see: https://github.com/andresriancho/w3af/issues/2181 @@ -560,6 +607,7 @@ def test_kb_list_shells_dav_2181(self): w3af_core.quit() + @pytest.mark.deprecated def test_kb_list_shells_eval_2181(self): """ :see: https://github.com/andresriancho/w3af/issues/2181 @@ -585,6 +633,7 @@ def test_kb_list_shells_eval_2181(self): w3af_core.quit() + @pytest.mark.deprecated def test_kb_list_shells_file_upload_2181(self): """ :see: https://github.com/andresriancho/w3af/issues/2181 @@ -607,6 +656,7 @@ def test_kb_list_shells_file_upload_2181(self): w3af_core.quit() + @pytest.mark.deprecated def test_kb_list_shells_file_read_2181(self): """ :see: https://github.com/andresriancho/w3af/issues/2181 @@ -632,6 +682,7 @@ def test_kb_list_shells_file_read_2181(self): w3af_core.quit() + @pytest.mark.deprecated def test_kb_list_shells_os_commanding_2181(self): """ :see: https://github.com/andresriancho/w3af/issues/2181 @@ -657,6 +708,7 @@ def test_kb_list_shells_os_commanding_2181(self): w3af_core.quit() + @pytest.mark.deprecated def test_kb_list_shells_rfi_2181(self): """ :see: https://github.com/andresriancho/w3af/issues/2181 @@ -683,6 +735,7 @@ def test_kb_list_shells_rfi_2181(self): w3af_core.quit() + @pytest.mark.deprecated def test_kb_list_shells_rfi_port_scan_2181(self): """ :see: https://github.com/andresriancho/w3af/issues/2181 @@ -709,6 +762,7 @@ def test_kb_list_shells_rfi_port_scan_2181(self): w3af_core.quit() + @pytest.mark.deprecated def test_kb_list_shells_xpath_2181(self): """ :see: https://github.com/andresriancho/w3af/issues/2181 @@ -742,6 +796,7 @@ def test_kb_list_shells_xpath_2181(self): w3af_core.quit() + @pytest.mark.deprecated def test_update_info(self): info = MockInfo() kb.append('a', 'b', info) @@ -753,6 +808,7 @@ def test_update_info(self): self.assertNotEqual(update_info, info) self.assertEqual(update_info, kb.get_by_uniq_id(update_uniq_id)) + @pytest.mark.deprecated def test_update_vuln(self): vuln = MockVuln() kb.append('a', 'b', vuln) @@ -764,6 +820,7 @@ def test_update_vuln(self): self.assertNotEqual(update_vuln, vuln) self.assertEqual(update_vuln, kb.get_by_uniq_id(update_uniq_id)) + @pytest.mark.deprecated def test_update_exception(self): vuln = MockVuln() kb.append('a', 'b', vuln) @@ -777,6 +834,7 @@ def test_update_exception(self): self.assertNotEqual(original_id, modified_id) self.assertRaises(DBException, kb.update, vuln, update_vuln) + @pytest.mark.deprecated def test_get_one(self): vuln = MockVuln() kb.append('a', 'b', vuln) @@ -787,16 +845,19 @@ def test_get_one(self): self.assertEqual(kb_vuln, vuln) #pylint: enable=E1103 + @pytest.mark.deprecated def test_get_one_none_found(self): empty_list = kb.get_one('a', 'b') self.assertEqual(empty_list, []) + @pytest.mark.deprecated def test_get_one_more_than_one_found(self): vuln = MockVuln() kb.append('a', 'b', vuln) kb.append('a', 'b', vuln) self.assertRaises(RuntimeError, kb.get_one, 'a', 'b') + @pytest.mark.deprecated def test_append_uniq_group_empty_address(self): vuln = MockVuln() info_set, created = kb.append_uniq_group('a', 'b', vuln) @@ -808,6 +869,7 @@ def test_append_uniq_group_empty_address(self): self.assertEqual(info_set.get_id(), vuln.get_id()) self.assertEqual(info_set.get_plugin_name(), vuln.get_plugin_name()) + @pytest.mark.deprecated def test_append_uniq_group_match_filter_func(self): vuln = MockVuln() kb.append_uniq_group('a', 'b', vuln, group_klass=MockInfoSetTrue) @@ -818,6 +880,7 @@ def test_append_uniq_group_match_filter_func(self): self.assertIsInstance(info_set, InfoSet) self.assertEqual(len(info_set.infos), 2) + @pytest.mark.deprecated def test_multiple_append_uniq_group(self): def multi_append(): for i in xrange(InfoSet.MAX_INFO_INSTANCES * 2): @@ -845,6 +908,7 @@ def multi_append(): pool.terminate() pool.join() + @pytest.mark.deprecated def test_info_set_keep_uniq_id(self): # # Create a new InfoSet, load it from the KB, confirm that it has @@ -877,6 +941,8 @@ def test_info_set_keep_uniq_id(self): self.assertNotEqual(info_set_a.get_uniq_id(), info_set_b.get_uniq_id()) + @pytest.mark.deprecated + @pytest.mark.slow def test_info_set_keep_uniq_id_after_max_info_instances(self): # # Create one InfoSet, add MAX_INFO_INSTANCES, assert that the ID is not @@ -897,6 +963,7 @@ def test_info_set_keep_uniq_id_after_max_info_instances(self): self.assertEqual(info_set_before.get_uniq_id(), info_set_after.get_uniq_id()) + @pytest.mark.deprecated def test_append_uniq_group_no_match_filter_func(self): vuln1 = MockVuln(name='Foos') vuln2 = MockVuln(name='Bars') @@ -916,6 +983,7 @@ def test_append_uniq_group_no_match_filter_func(self): self.assertEqual(raw_data[0].first_info.get_name(), 'Foos') self.assertEqual(raw_data[1].first_info.get_name(), 'Bars') + @pytest.mark.deprecated def test_append_uniq_group_filter_func_specific(self): vuln1 = MockVuln(name='Foos') vuln2 = MockVuln(name='Bars') @@ -934,6 +1002,7 @@ def test_append_uniq_group_filter_func_specific(self): self.assertEqual(raw_data[0].infos[1].get_id(), [42]) self.assertEqual(raw_data[1].first_info.get_name(), 'Bars') + @pytest.mark.deprecated def test_append_uniq_group_filter_func_attribute_match(self): vuln1 = MockVuln(name='Foos', _id=47) vuln1['tag'] = 'foo' diff --git a/w3af/core/data/kb/tests/test_read_shell.py b/w3af/core/data/kb/tests/test_read_shell.py index 50944c283d..12032a994e 100644 --- a/w3af/core/data/kb/tests/test_read_shell.py +++ b/w3af/core/data/kb/tests/test_read_shell.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.kb.read_shell import ReadShell diff --git a/w3af/core/data/kb/tests/test_update_urls_in_kb.py b/w3af/core/data/kb/tests/test_update_urls_in_kb.py index f0da1ea8ee..ca29b7fc25 100644 --- a/w3af/core/data/kb/tests/test_update_urls_in_kb.py +++ b/w3af/core/data/kb/tests/test_update_urls_in_kb.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -31,6 +32,7 @@ class TestUpdateURLs(unittest.TestCase): def setUp(self): kb.kb.cleanup() + @pytest.mark.deprecated def test_basic(self): u1 = URL('http://w3af.org/') r1 = FuzzableRequest(u1, method='GET') diff --git a/w3af/core/data/kb/tests/test_vuln.py b/w3af/core/data/kb/tests/test_vuln.py index 0e7d559556..9c769564dd 100644 --- a/w3af/core/data/kb/tests/test_vuln.py +++ b/w3af/core/data/kb/tests/test_vuln.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr diff --git a/w3af/core/data/kb/vuln_templates/tests/test_base_template.py b/w3af/core/data/kb/vuln_templates/tests/test_base_template.py index cbe3c0cbf6..6de1054633 100644 --- a/w3af/core/data/kb/vuln_templates/tests/test_base_template.py +++ b/w3af/core/data/kb/vuln_templates/tests/test_base_template.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import Mock diff --git a/w3af/core/data/kb/vuln_templates/tests/test_dav_template.py b/w3af/core/data/kb/vuln_templates/tests/test_dav_template.py index 38a7efb363..ceba5090f6 100644 --- a/w3af/core/data/kb/vuln_templates/tests/test_dav_template.py +++ b/w3af/core/data/kb/vuln_templates/tests/test_dav_template.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.kb.vuln_templates.dav_template import DAVTemplate @@ -26,6 +27,7 @@ class DAVTemplateTest(unittest.TestCase): + @pytest.mark.deprecated def test_store_in_kb(self): dt = DAVTemplate() dt.store_in_kb() diff --git a/w3af/core/data/kb/vuln_templates/tests/test_template_utils.py b/w3af/core/data/kb/vuln_templates/tests/test_template_utils.py index 90533de5bb..e15ccfd3ee 100644 --- a/w3af/core/data/kb/vuln_templates/tests/test_template_utils.py +++ b/w3af/core/data/kb/vuln_templates/tests/test_template_utils.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.kb.vuln_templates.utils import (get_all_templates, diff --git a/w3af/core/data/misc/tests/test_cached_queue.py b/w3af/core/data/misc/tests/test_cached_queue.py index b70a6073e5..efc408e5bd 100644 --- a/w3af/core/data/misc/tests/test_cached_queue.py +++ b/w3af/core/data/misc/tests/test_cached_queue.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import threading import time @@ -93,6 +94,7 @@ def test_exceptions_no_fail_sync_pointer(self): q.put(1) self.assertEquals(q.get(), 1) + @pytest.mark.slow def test_simple_rpm_speed(self): q = CachedQueue() diff --git a/w3af/core/data/misc/tests/test_encoding.py b/w3af/core/data/misc/tests/test_encoding.py index b4cf4dfe57..ccbc261ed1 100644 --- a/w3af/core/data/misc/tests/test_encoding.py +++ b/w3af/core/data/misc/tests/test_encoding.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.misc.encoding import is_known_encoding, ESCAPED_CHAR, HTML_ENCODE diff --git a/w3af/core/data/misc/tests/test_file_utils.py b/w3af/core/data/misc/tests/test_file_utils.py index 9e3747b088..5ed11d2b8c 100644 --- a/w3af/core/data/misc/tests/test_file_utils.py +++ b/w3af/core/data/misc/tests/test_file_utils.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os diff --git a/w3af/core/data/misc/tests/test_mask_password.py b/w3af/core/data/misc/tests/test_mask_password.py index a86efadd61..ae7c7e01ca 100644 --- a/w3af/core/data/misc/tests/test_mask_password.py +++ b/w3af/core/data/misc/tests/test_mask_password.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.misc.mask_password import mask_password_string diff --git a/w3af/core/data/misc/tests/test_ordered_cached_queue.py b/w3af/core/data/misc/tests/test_ordered_cached_queue.py index 9ae39224dd..5f88d4fc5f 100644 --- a/w3af/core/data/misc/tests/test_ordered_cached_queue.py +++ b/w3af/core/data/misc/tests/test_ordered_cached_queue.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import time import unittest import threading @@ -147,6 +148,7 @@ def test_exceptions_no_fail_sync_pointer(self): q.put(create_simple_fuzzable_request(1)) self.assertEquals(read_fuzzable_request_parameter(q.get()), 1) + @pytest.mark.slow def test_simple_rpm_speed(self): q = OrderedCachedQueue() diff --git a/w3af/core/data/misc/tests/test_smart_queue.py b/w3af/core/data/misc/tests/test_smart_queue.py index d74cf66a71..9d1aa58b3b 100644 --- a/w3af/core/data/misc/tests/test_smart_queue.py +++ b/w3af/core/data/misc/tests/test_smart_queue.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import time import Queue @@ -28,6 +29,7 @@ class TestSmarterQueue(unittest.TestCase): + @pytest.mark.slow def test_simple(self): q = SmartQueue() @@ -60,6 +62,7 @@ def test_no_data(self): self.assertEqual(0.0, q.get_input_rpm()) self.assertEqual(0.0, q.get_output_rpm()) + @pytest.mark.slow def test_many_items(self): q = SmartQueue() @@ -76,6 +79,7 @@ def test_many_items(self): self.assertEqual(len(q._output_timestamps), q.MAX_SIZE - 1) + @pytest.mark.slow def test_exceptions(self): q = SmartQueue(4) diff --git a/w3af/core/data/misc/tests/test_xml_bones.py b/w3af/core/data/misc/tests/test_xml_bones.py index b9819830e2..784c874036 100644 --- a/w3af/core/data/misc/tests/test_xml_bones.py +++ b/w3af/core/data/misc/tests/test_xml_bones.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.misc.xml_bones import get_xml_bones diff --git a/w3af/core/data/nltk_wrapper/tests/test_nltk_wrapper.py b/w3af/core/data/nltk_wrapper/tests/test_nltk_wrapper.py index ce9417de16..ad28b7dcf5 100644 --- a/w3af/core/data/nltk_wrapper/tests/test_nltk_wrapper.py +++ b/w3af/core/data/nltk_wrapper/tests/test_nltk_wrapper.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.nltk_wrapper.nltk_wrapper import wn diff --git a/w3af/core/data/options/tests/test_form_id_list_option.py b/w3af/core/data/options/tests/test_form_id_list_option.py index b4ab6415b4..82ba1c4f1a 100644 --- a/w3af/core/data/options/tests/test_form_id_list_option.py +++ b/w3af/core/data/options/tests/test_form_id_list_option.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest diff --git a/w3af/core/data/options/tests/test_header_option.py b/w3af/core/data/options/tests/test_header_option.py index e56d6a261e..bcd5c58ac3 100644 --- a/w3af/core/data/options/tests/test_header_option.py +++ b/w3af/core/data/options/tests/test_header_option.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.options.opt_factory import opt_factory diff --git a/w3af/core/data/options/tests/test_input_file_option.py b/w3af/core/data/options/tests/test_input_file_option.py index 8fb3a2f439..6d857a5a09 100644 --- a/w3af/core/data/options/tests/test_input_file_option.py +++ b/w3af/core/data/options/tests/test_input_file_option.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest diff --git a/w3af/core/data/options/tests/test_opt_factory.py b/w3af/core/data/options/tests/test_opt_factory.py index cdcdb21740..5b22f46838 100644 --- a/w3af/core/data/options/tests/test_opt_factory.py +++ b/w3af/core/data/options/tests/test_opt_factory.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest @@ -83,6 +84,7 @@ def test_factory_unknown_type(self): self.assertRaises(KeyError, opt_factory, 'name', 'value', 'desc', 'unknown_type') + @pytest.mark.deprecated def test_invalid_data(self): input_file = os.path.join(ROOT_PATH, 'core', 'data', 'foobar', 'does-not-exist.txt') diff --git a/w3af/core/data/options/tests/test_query_string_option.py b/w3af/core/data/options/tests/test_query_string_option.py index a302651b82..9bd3c88ab7 100644 --- a/w3af/core/data/options/tests/test_query_string_option.py +++ b/w3af/core/data/options/tests/test_query_string_option.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.exceptions import BaseFrameworkException diff --git a/w3af/core/data/parsers/doc/open_api/tests/test_fuzzing.py b/w3af/core/data/parsers/doc/open_api/tests/test_fuzzing.py index d44003bd03..3b9b3cc305 100644 --- a/w3af/core/data/parsers/doc/open_api/tests/test_fuzzing.py +++ b/w3af/core/data/parsers/doc/open_api/tests/test_fuzzing.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest diff --git a/w3af/core/data/parsers/doc/open_api/tests/test_main.py b/w3af/core/data/parsers/doc/open_api/tests/test_main.py index 041b6e57c8..f4800c321a 100644 --- a/w3af/core/data/parsers/doc/open_api/tests/test_main.py +++ b/w3af/core/data/parsers/doc/open_api/tests/test_main.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest diff --git a/w3af/core/data/parsers/doc/open_api/tests/test_requests.py b/w3af/core/data/parsers/doc/open_api/tests/test_requests.py index 45027e6090..2baece0a88 100644 --- a/w3af/core/data/parsers/doc/open_api/tests/test_requests.py +++ b/w3af/core/data/parsers/doc/open_api/tests/test_requests.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.doc.url import URL diff --git a/w3af/core/data/parsers/doc/open_api/tests/test_specification.py b/w3af/core/data/parsers/doc/open_api/tests/test_specification.py index e6e96efb6a..554dd3004c 100644 --- a/w3af/core/data/parsers/doc/open_api/tests/test_specification.py +++ b/w3af/core/data/parsers/doc/open_api/tests/test_specification.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import datetime diff --git a/w3af/core/data/parsers/doc/tests/test_baseparser.py b/w3af/core/data/parsers/doc/tests/test_baseparser.py index 07c84ba50b..e16d20f12c 100644 --- a/w3af/core/data/parsers/doc/tests/test_baseparser.py +++ b/w3af/core/data/parsers/doc/tests/test_baseparser.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.doc.url import URL diff --git a/w3af/core/data/parsers/doc/tests/test_complex_html_form.py b/w3af/core/data/parsers/doc/tests/test_complex_html_form.py index cc8e318a4c..39e9cd40ff 100644 --- a/w3af/core/data/parsers/doc/tests/test_complex_html_form.py +++ b/w3af/core/data/parsers/doc/tests/test_complex_html_form.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest diff --git a/w3af/core/data/parsers/doc/tests/test_cookie_parser.py b/w3af/core/data/parsers/doc/tests/test_cookie_parser.py index d51aef98c0..6dbbb111ad 100644 --- a/w3af/core/data/parsers/doc/tests/test_cookie_parser.py +++ b/w3af/core/data/parsers/doc/tests/test_cookie_parser.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.doc.cookie_parser import parse_cookie diff --git a/w3af/core/data/parsers/doc/tests/test_html.py b/w3af/core/data/parsers/doc/tests/test_html.py index 5d849dc4cc..403c342d34 100644 --- a/w3af/core/data/parsers/doc/tests/test_html.py +++ b/w3af/core/data/parsers/doc/tests/test_html.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os diff --git a/w3af/core/data/parsers/doc/tests/test_htmlparser_performance.py b/w3af/core/data/parsers/doc/tests/test_htmlparser_performance.py index 0d546648cf..ed91d11880 100644 --- a/w3af/core/data/parsers/doc/tests/test_htmlparser_performance.py +++ b/w3af/core/data/parsers/doc/tests/test_htmlparser_performance.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import resource import time @@ -44,6 +45,7 @@ class TestHTMLParserPerformance(unittest.TestCase): 'samples', 'django-500.html') @attr('ci_ignore') + @pytest.mark.slow def test_parse_html_performance(self): headers = Headers() headers['content-type'] = 'text/html' diff --git a/w3af/core/data/parsers/doc/tests/test_http_request_parser.py b/w3af/core/data/parsers/doc/tests/test_http_request_parser.py index 6f43f9ef1c..e9caf08240 100644 --- a/w3af/core/data/parsers/doc/tests/test_http_request_parser.py +++ b/w3af/core/data/parsers/doc/tests/test_http_request_parser.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.controllers.exceptions import BaseFrameworkException diff --git a/w3af/core/data/parsers/doc/tests/test_javascript.py b/w3af/core/data/parsers/doc/tests/test_javascript.py index ab4b707ea8..bc6a056e01 100644 --- a/w3af/core/data/parsers/doc/tests/test_javascript.py +++ b/w3af/core/data/parsers/doc/tests/test_javascript.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os @@ -46,6 +47,8 @@ def parse(self, filename): parser.parse() return parser + @pytest.mark.deprecated + @pytest.mark.slow def test_false_positives(self): for filename in ('jquery.js', 'angular.js', 'test_1.js', 'test_2.js', 'test_3.js'): diff --git a/w3af/core/data/parsers/doc/tests/test_pdf.py b/w3af/core/data/parsers/doc/tests/test_pdf.py index 090b6ec02b..dc7172c005 100644 --- a/w3af/core/data/parsers/doc/tests/test_pdf.py +++ b/w3af/core/data/parsers/doc/tests/test_pdf.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os diff --git a/w3af/core/data/parsers/doc/tests/test_sgml.py b/w3af/core/data/parsers/doc/tests/test_sgml.py index 176e005aa2..949e11df10 100644 --- a/w3af/core/data/parsers/doc/tests/test_sgml.py +++ b/w3af/core/data/parsers/doc/tests/test_sgml.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest from functools import partial diff --git a/w3af/core/data/parsers/doc/tests/test_swf.py b/w3af/core/data/parsers/doc/tests/test_swf.py index d60e2c15a8..3d8d3845eb 100644 --- a/w3af/core/data/parsers/doc/tests/test_swf.py +++ b/w3af/core/data/parsers/doc/tests/test_swf.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os @@ -74,6 +75,7 @@ def test_swf_parser_subscribe(self): self.assertEqual(parsed, []) self.assertEqual(set(re_refs), expected) + @pytest.mark.deprecated def test_swf_parser_domain_encoding_1(self): """ :see: https://github.com/andresriancho/w3af/issues/5682 diff --git a/w3af/core/data/parsers/doc/tests/test_url.py b/w3af/core/data/parsers/doc/tests/test_url.py index 84ad7332a4..165eef27cb 100644 --- a/w3af/core/data/parsers/doc/tests/test_url.py +++ b/w3af/core/data/parsers/doc/tests/test_url.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import urllib2 import cPickle import warnings @@ -576,6 +577,7 @@ def test_from_parts(self): # # get_domain_path # + @pytest.mark.deprecated def test_get_domain_path(self): self.assertEqual(URL('http://w3af.com/def/jkl/').get_domain_path().url_string, u'http://w3af.com/def/jkl/') @@ -639,6 +641,7 @@ def test_get_path(self): # # get_params_string # + @pytest.mark.deprecated def test_get_params_string(self): self.assertEqual(URL(u'http://w3af.com/').get_params_string(), u'') diff --git a/w3af/core/data/parsers/doc/tests/test_wml_parser.py b/w3af/core/data/parsers/doc/tests/test_wml_parser.py index 3cf46a6767..b602c41969 100644 --- a/w3af/core/data/parsers/doc/tests/test_wml_parser.py +++ b/w3af/core/data/parsers/doc/tests/test_wml_parser.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.doc.wml_parser import WMLParser diff --git a/w3af/core/data/parsers/doc/tests/test_xmlrpc.py b/w3af/core/data/parsers/doc/tests/test_xmlrpc.py index ccb884435d..2f36cbaf45 100644 --- a/w3af/core/data/parsers/doc/tests/test_xmlrpc.py +++ b/w3af/core/data/parsers/doc/tests/test_xmlrpc.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import xml.sax import cgi diff --git a/w3af/core/data/parsers/pynarcissus/tests/test_link_extractor.py b/w3af/core/data/parsers/pynarcissus/tests/test_link_extractor.py index 93b6f7b3a9..5d3721151c 100644 --- a/w3af/core/data/parsers/pynarcissus/tests/test_link_extractor.py +++ b/w3af/core/data/parsers/pynarcissus/tests/test_link_extractor.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.utils.url_regex import URL_RE diff --git a/w3af/core/data/parsers/pynarcissus/tests/test_string_extractor.py b/w3af/core/data/parsers/pynarcissus/tests/test_string_extractor.py index 2a23148648..2a04456460 100644 --- a/w3af/core/data/parsers/pynarcissus/tests/test_string_extractor.py +++ b/w3af/core/data/parsers/pynarcissus/tests/test_string_extractor.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os diff --git a/w3af/core/data/parsers/tests/test_document_parser.py b/w3af/core/data/parsers/tests/test_document_parser.py index c1fe9f2aab..ac3ffef559 100644 --- a/w3af/core/data/parsers/tests/test_document_parser.py +++ b/w3af/core/data/parsers/tests/test_document_parser.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import time import os diff --git a/w3af/core/data/parsers/tests/test_mp_document_parser.py b/w3af/core/data/parsers/tests/test_mp_document_parser.py index 717fa339eb..c7c593a206 100644 --- a/w3af/core/data/parsers/tests/test_mp_document_parser.py +++ b/w3af/core/data/parsers/tests/test_mp_document_parser.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import time import random @@ -49,6 +50,7 @@ def setUp(self): def tearDown(self): self.mpdoc.stop_workers() + @pytest.mark.deprecated def test_basic(self): resp = HTTPResponse(200, 'hello', self.headers, self.url, self.url) @@ -58,6 +60,7 @@ def test_basic(self): parsed_refs, _ = parser.get_references() self.assertEqual([URL('http://w3af.com/abc')], parsed_refs) + @pytest.mark.deprecated def test_no_parser_for_images(self): body = '' url = URL('http://w3af.com/foo.jpg') @@ -71,6 +74,7 @@ def test_no_parser_for_images(self): else: self.assertTrue(False, 'Expected exception!') + @pytest.mark.deprecated def test_parser_timeout(self): """ Test to verify fix for https://github.com/andresriancho/w3af/issues/6723 @@ -114,6 +118,7 @@ def test_parser_timeout(self): doc_parser = self.mpdoc.get_document_parser_for(http_resp) self.assertIsInstance(doc_parser._parser, HTMLParser) + @pytest.mark.slow def test_many_parsers_timing_out(self): """ Received more reports of parsers timing out, and after that @@ -251,6 +256,7 @@ def test_parser_with_large_attr_killed_when_sending_to_queue(self): parser = self.mpdoc.get_document_parser_for(http_resp) self.assertIsInstance(parser._parser, HTMLParser) + @pytest.mark.deprecated def test_parser_memory_usage_exceeded(self): """ This makes sure that we stop parsing a document that exceeds our memory @@ -340,6 +346,7 @@ def test_non_daemon_child_ok(self): self.assertTrue(False, 'daemonic processes are not allowed' ' to have children') + @pytest.mark.deprecated def test_dictproxy_pickle_8748(self): """ MaybeEncodingError - PicklingError: Can't pickle dictproxy #8748 @@ -354,6 +361,7 @@ def test_dictproxy_pickle_8748(self): parser = self.mpdoc.get_document_parser_for(resp) self.assertIsInstance(parser._parser, HTMLParser) + @pytest.mark.deprecated def test_get_tags_by_filter(self): body = 'foobar' url = URL('http://www.w3af.com/') @@ -366,6 +374,7 @@ def test_get_tags_by_filter(self): self.assertEqual([Tag('a', {'href': '/abc'}, 'foo'), Tag('b', {}, 'bar')], tags) + @pytest.mark.deprecated def test_get_tags_by_filter_empty_tag(self): body = '' url = URL('http://www.w3af.com/') diff --git a/w3af/core/data/parsers/tests/test_parser_cache.py b/w3af/core/data/parsers/tests/test_parser_cache.py index af202fc5e6..bab506a95a 100644 --- a/w3af/core/data/parsers/tests/test_parser_cache.py +++ b/w3af/core/data/parsers/tests/test_parser_cache.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import patch, PropertyMock @@ -44,6 +45,7 @@ def setUp(self): def tearDown(self): self.dpc.clear() + @pytest.mark.deprecated def test_basic(self): resp1 = HTTPResponse(200, 'abc', self.headers, self.url, self.url) resp2 = HTTPResponse(200, 'abc', self.headers, self.url, self.url) @@ -53,6 +55,7 @@ def test_basic(self): self.assertEqual(id(parser1), id(parser2)) + @pytest.mark.deprecated def test_bug_13_Dec_2012(self): url1 = URL('http://w3af.com/foo/') url2 = URL('http://w3af.com/bar/') @@ -70,12 +73,14 @@ def test_bug_13_Dec_2012(self): self.assertEqual(parsed_refs_1, parsed_refs_2) + @pytest.mark.deprecated def test_issue_188_invalid_url(self): # https://github.com/andresriancho/w3af/issues/188 all_chars = ''.join([chr(i) for i in xrange(0, 255)]) response = HTTPResponse(200, all_chars, self.headers, self.url, self.url) self.dpc.get_document_parser_for(response) + @pytest.mark.deprecated def test_cache_blacklist_after_timeout(self): # # If the cache tries to parse an HTTP response, that process fails, then we blacklist @@ -124,6 +129,7 @@ def _is_timeout_exception_message(self, toe, http_resp): msg = 'Reached timeout parsing "http://w3af.com/".' self.assertEquals(str(toe), msg) + @pytest.mark.deprecated def test_get_tags_by_filter_simple(self): html = 'abc' resp1 = HTTPResponse(200, html, self.headers, self.url, self.url) @@ -134,6 +140,7 @@ def test_get_tags_by_filter_simple(self): self.assertEqual(id(parser1), id(parser2)) + @pytest.mark.deprecated def test_get_tags_by_filter_different_tags(self): html = 'abchello' resp1 = HTTPResponse(200, html, self.headers, self.url, self.url) diff --git a/w3af/core/data/parsers/utils/tests/test_encode_decode.py b/w3af/core/data/parsers/utils/tests/test_encode_decode.py index fbb7a2f2d2..ddc28160ce 100644 --- a/w3af/core/data/parsers/utils/tests/test_encode_decode.py +++ b/w3af/core/data/parsers/utils/tests/test_encode_decode.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from urlparse import parse_qs diff --git a/w3af/core/data/parsers/utils/tests/test_form_id.py b/w3af/core/data/parsers/utils/tests/test_form_id.py index d22850ea3a..390198e6a9 100644 --- a/w3af/core/data/parsers/utils/tests/test_form_id.py +++ b/w3af/core/data/parsers/utils/tests/test_form_id.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json import unittest diff --git a/w3af/core/data/parsers/utils/tests/test_form_id_matcher.py b/w3af/core/data/parsers/utils/tests/test_form_id_matcher.py index bc24759ea8..9d5c59cfda 100644 --- a/w3af/core/data/parsers/utils/tests/test_form_id_matcher.py +++ b/w3af/core/data/parsers/utils/tests/test_form_id_matcher.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import json import unittest diff --git a/w3af/core/data/parsers/utils/tests/test_form_params.py b/w3af/core/data/parsers/utils/tests/test_form_params.py index 1de12771de..c4967ab68b 100644 --- a/w3af/core/data/parsers/utils/tests/test_form_params.py +++ b/w3af/core/data/parsers/utils/tests/test_form_params.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import cPickle import copy @@ -154,6 +155,7 @@ def filter_tmb(values): # Variants shouldn't appear duplicated self.assertEquals(len(variants_set), total_variants) + @pytest.mark.deprecated def test_tmb_variants_large(self): """ Note that this test has several changes from test_tmb_variants: @@ -214,6 +216,7 @@ def test_tmb_variants_large(self): # Variants shouldn't appear duplicated self.assertEquals(len(variants_set), f.TOP_VARIANTS) + @pytest.mark.deprecated def test_all_variants(self): # 'all' mode variants bigform_data = form_with_radio + form_select_misc diff --git a/w3af/core/data/parsers/utils/tests/test_header_link_extract.py b/w3af/core/data/parsers/utils/tests/test_header_link_extract.py index 6088bafa3b..a21aa73904 100644 --- a/w3af/core/data/parsers/utils/tests/test_header_link_extract.py +++ b/w3af/core/data/parsers/utils/tests/test_header_link_extract.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.utils.header_link_extract import headers_url_generator diff --git a/w3af/core/data/parsers/utils/tests/test_re_extract.py b/w3af/core/data/parsers/utils/tests/test_re_extract.py index e039de8ee4..0dbb8d79c8 100644 --- a/w3af/core/data/parsers/utils/tests/test_re_extract.py +++ b/w3af/core/data/parsers/utils/tests/test_re_extract.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.utils.re_extract import ReExtract diff --git a/w3af/core/data/parsers/utils/tests/test_url_regex.py b/w3af/core/data/parsers/utils/tests/test_url_regex.py index c62c8de06c..c0f2e11958 100644 --- a/w3af/core/data/parsers/utils/tests/test_url_regex.py +++ b/w3af/core/data/parsers/utils/tests/test_url_regex.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest diff --git a/w3af/core/data/profile/tests/test_profile.py b/w3af/core/data/profile/tests/test_profile.py index a139dcd64a..2d3ba802f0 100644 --- a/w3af/core/data/profile/tests/test_profile.py +++ b/w3af/core/data/profile/tests/test_profile.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import shutil import os diff --git a/w3af/core/data/quick_match/tests/test_multi_in.py b/w3af/core/data/quick_match/tests/test_multi_in.py index f439ec28ae..4843e0298d 100644 --- a/w3af/core/data/quick_match/tests/test_multi_in.py +++ b/w3af/core/data/quick_match/tests/test_multi_in.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import types import unittest import itertools diff --git a/w3af/core/data/quick_match/tests/test_multire.py b/w3af/core/data/quick_match/tests/test_multire.py index c3adc2e93c..33088f06d8 100644 --- a/w3af/core/data/quick_match/tests/test_multire.py +++ b/w3af/core/data/quick_match/tests/test_multire.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import unittest diff --git a/w3af/core/data/request/tests/test_create_fuzzable_request.py b/w3af/core/data/request/tests/test_create_fuzzable_request.py index fcd812b10f..9df15135dc 100644 --- a/w3af/core/data/request/tests/test_create_fuzzable_request.py +++ b/w3af/core/data/request/tests/test_create_fuzzable_request.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr diff --git a/w3af/core/data/request/tests/test_empty_request.py b/w3af/core/data/request/tests/test_empty_request.py index bfdb0e1a02..62cd791a61 100644 --- a/w3af/core/data/request/tests/test_empty_request.py +++ b/w3af/core/data/request/tests/test_empty_request.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.request.empty_request import EmptyFuzzableRequest diff --git a/w3af/core/data/request/tests/test_fuzzable_request.py b/w3af/core/data/request/tests/test_fuzzable_request.py index 7256647bfe..29d272a724 100644 --- a/w3af/core/data/request/tests/test_fuzzable_request.py +++ b/w3af/core/data/request/tests/test_fuzzable_request.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import cPickle import copy @@ -176,6 +177,7 @@ def test_repr(self): self.assertEqual(repr(fr), '' % url) + @pytest.mark.deprecated def test_sent_url_unicode_decode_1(self): f = FuzzableRequest(URL('http://example.com/a%c3%83b')) self.assertTrue(f.sent('aÃb')) diff --git a/w3af/core/data/request/tests/test_variant_identification.py b/w3af/core/data/request/tests/test_variant_identification.py index 4b44091ad8..be3ade3bcb 100644 --- a/w3af/core/data/request/tests/test_variant_identification.py +++ b/w3af/core/data/request/tests/test_variant_identification.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.request.variant_identification import are_variants diff --git a/w3af/core/data/search_engines/tests/test_bing.py b/w3af/core/data/search_engines/tests/test_bing.py index 3b020e91fc..514f251f69 100644 --- a/w3af/core/data/search_engines/tests/test_bing.py +++ b/w3af/core/data/search_engines/tests/test_bing.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr @@ -33,10 +34,12 @@ class test_bing(unittest.TestCase): def setUp(self): self.bing_se = bing(ExtendedUrllib()) + @pytest.mark.slow def test_get_links_results_few(self): self.query, self.limit = ('two and half man', 60) self.get_links_results() + @pytest.mark.slow def test_get_links_results_many(self): self.query, self.limit = ('big bang theory', 200) self.get_links_results() diff --git a/w3af/core/data/search_engines/tests/test_google.py b/w3af/core/data/search_engines/tests/test_google.py index b04734fc0a..8a71c9377b 100644 --- a/w3af/core/data/search_engines/tests/test_google.py +++ b/w3af/core/data/search_engines/tests/test_google.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import random import re import unittest @@ -58,6 +59,7 @@ def setUp(self): opener = ExtendedUrllib() self.gse = google(opener) + @pytest.mark.slow def test_get_links_results_len(self): results = self.gse.get_n_results(self.query, self.limit) @@ -71,6 +73,7 @@ def test_get_links_results_len(self): # URLs should be unique self.assertTrue(len(results) == len(set([r.URL for r in results]))) + @pytest.mark.slow def test_page_body(self): responses = self.gse.get_n_result_pages(self.query, self.limit) @@ -107,6 +110,7 @@ def tearDown(self): self.opener.end() @attr('fails') + @pytest.mark.deprecated def test_len_link_results(self): if self.GoogleApiSearcher is None: return @@ -148,6 +152,7 @@ def test_len_link_results(self): self.assertTrue(related > 5, related) @attr('fails') + @pytest.mark.deprecated def test_links_results_domain(self): if self.GoogleApiSearcher is None: return @@ -179,6 +184,7 @@ def test_links_results_domain(self): @attr('internet') @attr('fails') +@pytest.mark.deprecated class TestGAjaxSearch(BaseGoogleAPISearch): GoogleApiSearcher = GAjaxSearch diff --git a/w3af/core/data/statistics/tests/test_utils.py b/w3af/core/data/statistics/tests/test_utils.py index 3502e64ec9..6b70733256 100644 --- a/w3af/core/data/statistics/tests/test_utils.py +++ b/w3af/core/data/statistics/tests/test_utils.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.statistics.utils import drop_outliers, outliers_modified_z_score diff --git a/w3af/core/data/url/handlers/tests/test_errors.py b/w3af/core/data/url/handlers/tests/test_errors.py index 6a0c2ee65a..ea1b214e4c 100644 --- a/w3af/core/data/url/handlers/tests/test_errors.py +++ b/w3af/core/data/url/handlers/tests/test_errors.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import urllib2 @@ -38,6 +39,7 @@ def setUp(self): consecutive_number_generator.reset() @attr('moth') + @pytest.mark.deprecated def test_error_handler_id(self): """ Verify that the error handler works as expected, in other words, do NOT diff --git a/w3af/core/data/url/handlers/tests/test_keepalive.py b/w3af/core/data/url/handlers/tests/test_keepalive.py index ff159a9c7f..91825e51dc 100644 --- a/w3af/core/data/url/handlers/tests/test_keepalive.py +++ b/w3af/core/data/url/handlers/tests/test_keepalive.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import socket import unittest import time @@ -155,9 +156,11 @@ def test_single_conn_mgr(self): self.assertIsNot(conn_mgr_http, conn_mgr_https) + @pytest.mark.deprecated def test_close_all_established_sockets(self): self.close_all_sockets(0) + @pytest.mark.deprecated def test_close_all_close_wait_sockets(self): # Give the socket time to move to close_wait self.close_all_sockets(20) diff --git a/w3af/core/data/url/handlers/tests/test_mangle.py b/w3af/core/data/url/handlers/tests/test_mangle.py index bed0ff5fba..4c8b1ce17d 100644 --- a/w3af/core/data/url/handlers/tests/test_mangle.py +++ b/w3af/core/data/url/handlers/tests/test_mangle.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr @@ -30,6 +31,7 @@ class TestMangleHandler(unittest.TestCase): @attr('moth') + @pytest.mark.deprecated def test_mangle_handler_raw_request_1326(self): """ Reproduces [0] to make sure we don't make that mistake again. diff --git a/w3af/core/data/url/handlers/tests/test_multipart.py b/w3af/core/data/url/handlers/tests/test_multipart.py index 55037924da..3da08371c1 100644 --- a/w3af/core/data/url/handlers/tests/test_multipart.py +++ b/w3af/core/data/url/handlers/tests/test_multipart.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import tempfile import unittest @@ -58,6 +59,7 @@ def setUp(self): def tearDown(self): self.opener.end() + @pytest.mark.deprecated def test_multipart_without_file(self): form_params = FormParameters() form_params.add_field_by_attr_items([('name', 'uploadedfile')]) @@ -73,6 +75,7 @@ def test_multipart_without_file(self): self.assertNotIn('was successfully uploaded', resp.get_body()) + @pytest.mark.deprecated def test_file_upload(self): temp = tempfile.mkstemp(suffix=".tmp") os.write(temp[0], 'file content') @@ -80,6 +83,7 @@ def test_file_upload(self): _file = open(temp[1], "rb") self.upload_file(_file) + @pytest.mark.deprecated def test_stringio_upload(self): _file = NamedStringIO('file content', name='test.txt') self.upload_file(_file) @@ -99,6 +103,7 @@ def upload_file(self, _file): self.assertIn('was successfully uploaded', resp.get_body()) + @pytest.mark.deprecated def test_upload_file_using_fuzzable_request(self): form_params = FormParameters() form_params.add_field_by_attr_items([('name', 'uploadedfile')]) diff --git a/w3af/core/data/url/handlers/tests/test_ntlm_auth.py b/w3af/core/data/url/handlers/tests/test_ntlm_auth.py index 70d717b498..af354b737b 100644 --- a/w3af/core/data/url/handlers/tests/test_ntlm_auth.py +++ b/w3af/core/data/url/handlers/tests/test_ntlm_auth.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import urllib2 @@ -30,6 +31,7 @@ class TestNTLMHandler(unittest.TestCase): @attr('ci_fails') + @pytest.mark.deprecated def test_auth_valid_creds(self): url = "http://moth/w3af/core/ntlm_auth/ntlm_v1/" user = u'moth\\admin' diff --git a/w3af/core/data/url/handlers/tests/test_redirect.py b/w3af/core/data/url/handlers/tests/test_redirect.py index 217a5b8d61..919dcc79e7 100644 --- a/w3af/core/data/url/handlers/tests/test_redirect.py +++ b/w3af/core/data/url/handlers/tests/test_redirect.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import urllib2 import unittest import httpretty diff --git a/w3af/core/data/url/handlers/tests/test_url_parameter.py b/w3af/core/data/url/handlers/tests/test_url_parameter.py index e147b13675..0f7bfe10f5 100644 --- a/w3af/core/data/url/handlers/tests/test_url_parameter.py +++ b/w3af/core/data/url/handlers/tests/test_url_parameter.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import httpretty @@ -30,6 +31,7 @@ class TestURLParameterHandler(unittest.TestCase): @httpretty.activate + @pytest.mark.deprecated def test_handler_integration(self): """ Integration test with w3af's URL opener. diff --git a/w3af/core/data/url/openssl_wrapper/tests/test_ssl_wrapper.py b/w3af/core/data/url/openssl_wrapper/tests/test_ssl_wrapper.py index 763872d120..8fafc3920b 100644 --- a/w3af/core/data/url/openssl_wrapper/tests/test_ssl_wrapper.py +++ b/w3af/core/data/url/openssl_wrapper/tests/test_ssl_wrapper.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import OpenSSL import ssl @@ -34,12 +35,14 @@ def test_str_8663_1(self): e = Exception('Message') self.assertEqual(str(OpenSSLReformattedError(e)), 'Message') + @pytest.mark.deprecated def test_str_8663_2(self): e = OpenSSL.SSL.Error('OpenSSL.SSL.Error Message') se = ssl.SSLError('ssl.SSLError Message', OpenSSLReformattedError(e)) self.assertEqual(str(se), '[Errno ssl.SSLError Message] ' 'OpenSSL.SSL.Error Message') + @pytest.mark.deprecated def test_str_8663_3(self): e = OpenSSL.SSL.Error('OpenSSL.SSL.Error Message') se = ssl.SSLError('ssl.SSLError Message', e) diff --git a/w3af/core/data/url/tests/helpers/tests/test_http_daemon.py b/w3af/core/data/url/tests/helpers/tests/test_http_daemon.py index 7b8e147e90..dfdc85f80f 100644 --- a/w3af/core/data/url/tests/helpers/tests/test_http_daemon.py +++ b/w3af/core/data/url/tests/helpers/tests/test_http_daemon.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import urllib2 diff --git a/w3af/core/data/url/tests/helpers/tests/test_ssl_daemon.py b/w3af/core/data/url/tests/helpers/tests/test_ssl_daemon.py index 8d0a101950..a205e81aca 100644 --- a/w3af/core/data/url/tests/helpers/tests/test_ssl_daemon.py +++ b/w3af/core/data/url/tests/helpers/tests/test_ssl_daemon.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import socket import ssl diff --git a/w3af/core/data/url/tests/helpers/tests/test_upper_daemon.py b/w3af/core/data/url/tests/helpers/tests/test_upper_daemon.py index e777103d53..e4d1f68ad5 100644 --- a/w3af/core/data/url/tests/helpers/tests/test_upper_daemon.py +++ b/w3af/core/data/url/tests/helpers/tests/test_upper_daemon.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import socket diff --git a/w3af/core/data/url/tests/test_HTTPRequest.py b/w3af/core/data/url/tests/test_HTTPRequest.py index a5619d6dfe..ed7355cfe5 100644 --- a/w3af/core/data/url/tests/test_HTTPRequest.py +++ b/w3af/core/data/url/tests/test_HTTPRequest.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import msgpack @@ -42,6 +43,7 @@ def test_basic(self): self.assertEqual(req.get_full_url(), 'http://www.w3af.com/') self.assertEqual(req.get_uri().url_string, 'http://www.w3af.com/') + @pytest.mark.deprecated def test_to_from_dict(self): headers = Headers([('Host', 'www.w3af.com')]) req = HTTPRequest(URL("http://www.w3af.com/"), data='spameggs', diff --git a/w3af/core/data/url/tests/test_HTTPResponse.py b/w3af/core/data/url/tests/test_HTTPResponse.py index 374e31d697..d5fc5c3aa9 100644 --- a/w3af/core/data/url/tests/test_HTTPResponse.py +++ b/w3af/core/data/url/tests/test_HTTPResponse.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import cPickle import os diff --git a/w3af/core/data/url/tests/test_get_average_rtt.py b/w3af/core/data/url/tests/test_get_average_rtt.py index ff8eaff95b..a5460b49bf 100644 --- a/w3af/core/data/url/tests/test_get_average_rtt.py +++ b/w3af/core/data/url/tests/test_get_average_rtt.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import time import random import unittest @@ -52,6 +53,7 @@ def request_callback_05(request, uri, headers): return 200, headers, body @httpretty.activate + @pytest.mark.deprecated def test_get_average_rtt_for_mutant_all_equal(self): httpretty.register_uri(httpretty.GET, self.MOCK_URL, @@ -105,6 +107,7 @@ def test_get_average_rtt_for_mutant_one_off(self): self.assertGreater(0.90, average_rtt) @httpretty.activate + @pytest.mark.deprecated def test_get_average_rtt_for_mutant_with_threads(self): httpretty.register_uri(httpretty.GET, self.MOCK_URL, diff --git a/w3af/core/data/url/tests/test_get_clean_body.py b/w3af/core/data/url/tests/test_get_clean_body.py index 8c1c180377..4d2fdbe23e 100644 --- a/w3af/core/data/url/tests/test_get_clean_body.py +++ b/w3af/core/data/url/tests/test_get_clean_body.py @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import urllib diff --git a/w3af/core/data/url/tests/test_opener_settings.py b/w3af/core/data/url/tests/test_opener_settings.py index abca5f7747..f808bee009 100644 --- a/w3af/core/data/url/tests/test_opener_settings.py +++ b/w3af/core/data/url/tests/test_opener_settings.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.url.opener_settings import OpenerSettings @@ -35,6 +36,7 @@ class TestOpenerSettings(unittest.TestCase): def setUp(self): self.os = OpenerSettings() + @pytest.mark.deprecated def test_options(self): opt_lst = self.os.get_options() self.os.set_options(opt_lst) diff --git a/w3af/core/data/url/tests/test_xurllib.py b/w3af/core/data/url/tests/test_xurllib.py index e4817a6c4e..2e90191643 100644 --- a/w3af/core/data/url/tests/test_xurllib.py +++ b/w3af/core/data/url/tests/test_xurllib.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import ssl import time @@ -63,6 +64,7 @@ def tearDown(self): self.uri_opener.end() httpretty.reset() + @pytest.mark.deprecated def test_basic(self): url = URL(get_moth_http()) http_response = self.uri_opener.GET(url, cache=False) @@ -72,6 +74,7 @@ def test_basic(self): self.assertGreaterEqual(http_response.id, 1) self.assertNotEqual(http_response.id, None) + @pytest.mark.deprecated def test_basic_ssl(self): url = URL(get_moth_https()) http_response = self.uri_opener.GET(url, cache=False) @@ -91,6 +94,7 @@ def test_github_ssl(self): self.assertGreaterEqual(http_response.id, 1) self.assertNotEqual(http_response.id, None) + @pytest.mark.deprecated def test_cache(self): url = URL(get_moth_http()) http_response = self.uri_opener.GET(url) @@ -100,6 +104,7 @@ def test_cache(self): http_response = self.uri_opener.GET(url) self.assertIn(self.MOTH_MESSAGE, http_response.body) + @pytest.mark.deprecated def test_qs_params(self): url = URL(get_moth_http('/audit/xss/simple_xss.py?text=123456abc')) http_response = self.uri_opener.GET(url, cache=False) @@ -156,6 +161,7 @@ def test_GET_with_post_data_and_qs(self): self.assertEqual(httpretty.last_request().body, data) self.assertEqual(httpretty.last_request().path, '/' + qs) + @pytest.mark.deprecated def test_post(self): url = URL(get_moth_http('/audit/xss/simple_xss_form.py')) @@ -165,6 +171,7 @@ def test_post(self): http_response = self.uri_opener.POST(url, data, cache=False) self.assertIn('123456abc', http_response.body) + @pytest.mark.deprecated def test_post_special_chars(self): url = URL(get_moth_http('/audit/xss/simple_xss_form.py')) test_data = u'abc"-á-' @@ -188,6 +195,7 @@ def test_url_port_closed(self): url = URL('http://127.0.0.1:2312/') self.assertRaises(HTTPRequestException, self.uri_opener.GET, url) + @pytest.mark.deprecated def test_url_port_not_http(self): upper_daemon = UpperDaemon(EmptyTCPHandler) upper_daemon.start() @@ -232,6 +240,7 @@ def test_url_port_not_http_many(self): self.assertEqual(scan_must_stop_e, 1) self.assertEqual(http_request_e, 9) + @pytest.mark.deprecated def test_get_wait_time(self): """ Asserts that all the responses coming out of the extended urllib have a @@ -289,6 +298,7 @@ def test_ssl_v3(self): @attr('internet') @attr('ci_fails') + @pytest.mark.deprecated def test_ssl_sni(self): """ Test is our HTTP client supports SSL SNI @@ -359,6 +369,7 @@ def send(uri_opener, output): self.assertRaises(Queue.Empty, output.get, True, 2) + @pytest.mark.deprecated def test_pause_unpause(self): output = Queue.Queue() self.uri_opener.pause(True) @@ -388,6 +399,7 @@ def send(uri_opener, output): self.assertEqual(http_response.get_code(), 200) self.assertIn(self.MOTH_MESSAGE, http_response.body) + @pytest.mark.deprecated def test_removes_cache(self): url = URL(get_moth_http()) self.uri_opener.GET(url, cache=False) @@ -406,6 +418,7 @@ def test_removes_cache(self): self.assertFalse(os.path.exists(test_db_path), test_db_path) self.assertFalse(os.path.exists(test_trace_path), test_trace_path) + @pytest.mark.deprecated def test_special_char_header(self): url = URL(get_moth_http('/core/headers/echo-headers.py')) header_content = u'name=ábc' @@ -413,6 +426,7 @@ def test_special_char_header(self): http_response = self.uri_opener.GET(url, cache=False, headers=headers) self.assertIn(header_content, http_response.body) + @pytest.mark.deprecated def test_bad_file_descriptor_8125_local(self): """ 8125 is basically an issue with the way HTTP SSL connections handle the diff --git a/w3af/core/data/url/tests/test_xurllib_error_handling.py b/w3af/core/data/url/tests/test_xurllib_error_handling.py index e67c82e682..db460d052b 100644 --- a/w3af/core/data/url/tests/test_xurllib_error_handling.py +++ b/w3af/core/data/url/tests/test_xurllib_error_handling.py @@ -19,10 +19,12 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import time import unittest import SocketServer +import pytest from mock import Mock, patch, call from nose.plugins.attrib import attr @@ -51,6 +53,7 @@ def setUp(self): def tearDown(self): self.uri_opener.end() + @pytest.mark.deprecated def test_increasing_delay_on_errors(self): expected_log = {0: False, 70: False, 40: False, 10: False, 80: False, 50: False, 20: False, 90: False, 60: False, 30: False, @@ -209,6 +212,7 @@ class TestXUrllibErrorHandling(PluginTest): } } + @pytest.mark.deprecated def test_do_not_reach_must_stop_exception(self): # Configure low timeout to have faster test self.w3afcore.uri_opener.settings.set_configured_timeout(TIMEOUT_SECS) diff --git a/w3af/core/data/url/tests/test_xurllib_integration.py b/w3af/core/data/url/tests/test_xurllib_integration.py index 7745971455..fa89164e4e 100644 --- a/w3af/core/data/url/tests/test_xurllib_integration.py +++ b/w3af/core/data/url/tests/test_xurllib_integration.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import httpretty @@ -41,6 +42,7 @@ def setUp(self): self.uri_opener = ExtendedUrllib() @attr('ci_fails') + @pytest.mark.deprecated def test_ntlm_auth_not_configured(self): self.uri_opener = ExtendedUrllib() url = URL("http://moth/w3af/core/ntlm_auth/ntlm_v1/") @@ -48,6 +50,7 @@ def test_ntlm_auth_not_configured(self): self.assertIn('Must authenticate.', http_response.body) @attr('ci_fails') + @pytest.mark.deprecated def test_ntlm_auth_valid_creds(self): self.uri_opener = ExtendedUrllib() @@ -71,6 +74,7 @@ def test_ntlm_auth_valid_creds(self): http_response = self.uri_opener.GET(url, cache=False) self.assertIn('You are admin from MOTH/', http_response.body) + @pytest.mark.deprecated def test_gzip(self): url = URL(get_moth_http('/core/gzip/gzip.html')) res = self.uri_opener.GET(url, cache=False) @@ -82,6 +86,7 @@ def test_gzip(self): self.assertTrue(test_res, content_encoding) self.assertIn('View HTTP response headers.', res.get_body()) + @pytest.mark.deprecated def test_deflate(self): url = URL(get_moth_http('/core/deflate/deflate.html')) res = self.uri_opener.GET(url, cache=False) @@ -91,6 +96,7 @@ def test_deflate(self): self.assertIn('deflate', content_encoding) self.assertIn('View HTTP response headers.', res.get_body()) + @pytest.mark.deprecated def test_get_cookies(self): self.assertEqual(len([c for c in self.uri_opener.get_cookies()]), 0) diff --git a/w3af/core/data/url/tests/test_xurllib_proxy.py b/w3af/core/data/url/tests/test_xurllib_proxy.py index 01ebf6c886..6a44eec740 100644 --- a/w3af/core/data/url/tests/test_xurllib_proxy.py +++ b/w3af/core/data/url/tests/test_xurllib_proxy.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr @@ -65,6 +66,7 @@ def test_http_default_port_via_proxy(self): # TODO: Write this test pass + @pytest.mark.deprecated def test_http_port_specification_via_proxy(self): self.assertEqual(self._proxy.total_handled_requests, 0) @@ -74,6 +76,7 @@ def test_http_port_specification_via_proxy(self): self.assertIn(self.MOTH_MESSAGE, http_response.body) self.assertEqual(self._proxy.total_handled_requests, 1) + @pytest.mark.deprecated def test_https_via_proxy(self): self.assertEqual(self._proxy.total_handled_requests, 0) diff --git a/w3af/core/data/url/tests/test_xurllib_timeout.py b/w3af/core/data/url/tests/test_xurllib_timeout.py index f291d0e8a4..6397344859 100644 --- a/w3af/core/data/url/tests/test_xurllib_timeout.py +++ b/w3af/core/data/url/tests/test_xurllib_timeout.py @@ -23,6 +23,7 @@ import unittest import SocketServer +import pytest from nose.plugins.attrib import attr from mock import Mock @@ -107,6 +108,7 @@ def test_timeout_ssl(self): # the headers self.assertLess(end-start, 80) + @pytest.mark.slow def test_timeout_many(self): upper_daemon = UpperDaemon(TimeoutTCPHandler) upper_daemon.start() @@ -145,6 +147,7 @@ def test_timeout_many(self): self.assertEqual(http_request_e, 4) self.assertEqual(scan_stop_e, 1) + @pytest.mark.deprecated def test_timeout_auto_adjust(self): upper_daemon = UpperDaemon(Ok200SmallDelayHandler) upper_daemon.start() diff --git a/w3af/core/data/user_agent/tests/test_random_user_agent.py b/w3af/core/data/user_agent/tests/test_random_user_agent.py index 1a240030a5..a7edefbc45 100644 --- a/w3af/core/data/user_agent/tests/test_random_user_agent.py +++ b/w3af/core/data/user_agent/tests/test_random_user_agent.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.user_agent.random_user_agent import get_random_user_agent diff --git a/w3af/core/data/visualization/tests/test_string_representation.py b/w3af/core/data/visualization/tests/test_string_representation.py index 2f4dcd5334..4279ff6a1a 100644 --- a/w3af/core/data/visualization/tests/test_string_representation.py +++ b/w3af/core/data/visualization/tests/test_string_representation.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.visualization.string_representation import StringRepresentation diff --git a/w3af/core/ui/api/tests/test_auth.py b/w3af/core/ui/api/tests/test_auth.py index 891a94c022..33f5bfd403 100644 --- a/w3af/core/ui/api/tests/test_auth.py +++ b/w3af/core/ui/api/tests/test_auth.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json from w3af.core.ui.api.tests.utils.api_unittest import APIUnitTest diff --git a/w3af/core/ui/api/tests/test_exceptions.py b/w3af/core/ui/api/tests/test_exceptions.py index 931ce251d6..fd7bf11791 100644 --- a/w3af/core/ui/api/tests/test_exceptions.py +++ b/w3af/core/ui/api/tests/test_exceptions.py @@ -21,12 +21,14 @@ """ import json +import pytest + from w3af.core.ui.api.tests.utils.api_unittest import APIUnitTest from w3af.core.ui.api.tests.utils.test_profile import get_test_profile class ScanExceptionResourceTest(APIUnitTest): - + @pytest.mark.deprecated def test_query_exceptions(self): profile, target_url = get_test_profile() data = {'scan_profile': profile, @@ -69,4 +71,4 @@ def test_query_exceptions(self): response = self.app.get('/scans/%s/exceptions/0' % scan_id, headers=self.HEADERS) - self.assertIn('traceback', json.loads(response.data)) \ No newline at end of file + self.assertIn('traceback', json.loads(response.data)) diff --git a/w3af/core/ui/api/tests/test_fuzzable_requests.py b/w3af/core/ui/api/tests/test_fuzzable_requests.py index 044aadf8eb..15c4399ef8 100644 --- a/w3af/core/ui/api/tests/test_fuzzable_requests.py +++ b/w3af/core/ui/api/tests/test_fuzzable_requests.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json import base64 @@ -37,6 +38,7 @@ class FuzzableRequestsTest(APIUnitTest): + @pytest.mark.deprecated def test_fuzzable_request_list(self): profile, target_url = get_test_profile() data = {'scan_profile': profile, diff --git a/w3af/core/ui/api/tests/test_integration_scan.py b/w3af/core/ui/api/tests/test_integration_scan.py index 94ac2246f1..1c23a97551 100644 --- a/w3af/core/ui/api/tests/test_integration_scan.py +++ b/w3af/core/ui/api/tests/test_integration_scan.py @@ -19,9 +19,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json import base64 +import pytest import requests # pylint: disable=E0401 @@ -39,6 +41,7 @@ class APIScanTest(IntegrationTest): + @pytest.mark.deprecated def test_start_simple_scan(self): profile, target_url = get_test_profile() data = {'scan_profile': profile, @@ -161,6 +164,7 @@ def test_start_simple_scan(self): return scan_id + @pytest.mark.deprecated def test_stop(self): profile, target_url = get_test_profile() data = {'scan_profile': profile, @@ -205,6 +209,8 @@ def test_stop(self): else: self.assertTrue(False, 'Stop not found in log') + @pytest.mark.slow + @pytest.mark.deprecated def test_two_scans(self): scan_id_0 = self.test_start_simple_scan() scan_id_1 = self.test_start_simple_scan() diff --git a/w3af/core/ui/api/tests/test_kb.py b/w3af/core/ui/api/tests/test_kb.py index 989e766989..be4e85c61a 100644 --- a/w3af/core/ui/api/tests/test_kb.py +++ b/w3af/core/ui/api/tests/test_kb.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json from w3af.core.ui.api.tests.utils.api_unittest import APIUnitTest @@ -27,6 +28,7 @@ class KBApiTest(APIUnitTest): + @pytest.mark.deprecated def test_kb_filters(self): profile, target_url = get_test_profile() data = {'scan_profile': profile, diff --git a/w3af/core/ui/api/tests/test_log.py b/w3af/core/ui/api/tests/test_log.py index c2fcb3ff0b..bdbe6c15b3 100644 --- a/w3af/core/ui/api/tests/test_log.py +++ b/w3af/core/ui/api/tests/test_log.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json from w3af.core.ui.api.tests.utils.api_unittest import APIUnitTest @@ -28,6 +29,7 @@ class ApiScanLogTest(APIUnitTest): + @pytest.mark.deprecated def test_scan_log(self): profile, target_url = get_test_profile(SLOW_TEST_PROFILE) data = {'scan_profile': profile, diff --git a/w3af/core/ui/api/tests/test_require_json.py b/w3af/core/ui/api/tests/test_require_json.py index 8b6ba3cbd4..8fcbc25ec4 100644 --- a/w3af/core/ui/api/tests/test_require_json.py +++ b/w3af/core/ui/api/tests/test_require_json.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json from w3af.core.ui.api.middlewares.require_json import NO_HEADER, INVALID_JSON @@ -28,6 +29,7 @@ class RequireJSONTest(APIUnitTest): + @pytest.mark.deprecated def test_require_json_header(self): profile, target_url = get_test_profile() data = {'scan_profile': profile, @@ -46,6 +48,7 @@ def test_require_json_header(self): self.assertEqual(error['message'], NO_HEADER) self.assertEqual(response.status_code, 400) + @pytest.mark.deprecated def test_require_json_data(self): response = self.app.post('/scans/', data='{3,.-1!}--', diff --git a/w3af/core/ui/api/tests/test_urls.py b/w3af/core/ui/api/tests/test_urls.py index 50dce4538f..1d380e6108 100644 --- a/w3af/core/ui/api/tests/test_urls.py +++ b/w3af/core/ui/api/tests/test_urls.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json from w3af.core.ui.api.tests.utils.api_unittest import APIUnitTest @@ -27,6 +28,7 @@ class URLTest(APIUnitTest): + @pytest.mark.deprecated def test_url_list(self): profile, target_url = get_test_profile() data = {'scan_profile': profile, diff --git a/w3af/core/ui/api/tests/test_version.py b/w3af/core/ui/api/tests/test_version.py index 94156e18d2..d51fc6ddd3 100644 --- a/w3af/core/ui/api/tests/test_version.py +++ b/w3af/core/ui/api/tests/test_version.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json from w3af.core.ui.api.tests.utils.api_unittest import APIUnitTest @@ -26,6 +27,7 @@ class VersionTest(APIUnitTest): + @pytest.mark.deprecated def test_get_version(self): # # Name filter diff --git a/w3af/core/ui/console/tests/test_basic.py b/w3af/core/ui/console/tests/test_basic.py index 7e0a098f32..a00d38dc78 100644 --- a/w3af/core/ui/console/tests/test_basic.py +++ b/w3af/core/ui/console/tests/test_basic.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.core.ui.console.console_ui import ConsoleUI @@ -29,6 +30,7 @@ class TestBasicConsoleUI(ConsoleTestHelper): """ Basic test for the console UI. """ + @pytest.mark.deprecated def test_menu_browse_misc(self): commands_to_run = ['misc-settings', 'back', 'exit'] @@ -39,6 +41,7 @@ def test_menu_browse_misc(self): assert_result, msg = self.all_expected_in_output(expected) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_menu_browse_http(self): commands_to_run = ['http-settings', 'back', 'exit'] @@ -49,6 +52,7 @@ def test_menu_browse_http(self): assert_result, msg = self.all_expected_in_output(expected) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_menu_browse_target(self): commands_to_run = ['target', 'back', 'exit'] @@ -59,6 +63,7 @@ def test_menu_browse_target(self): assert_result, msg = self.all_expected_in_output(expected) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_menu_plugin_desc(self): commands_to_run = ['plugins', 'infrastructure desc zone_h', @@ -75,6 +80,7 @@ def test_menu_plugin_desc(self): assert_result, msg = self.startswith_expected_in_output(expected) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_menu_set_option_case01(self): commands_to_run = ['target', 'set target http://moth/', 'save', 'view', 'back', 'exit'] @@ -91,6 +97,7 @@ def test_menu_set_option_case01(self): assert_result, msg = self.all_expected_substring_in_output(expected_start_with) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_menu_set_option_manual_save(self): commands_to_run = ['target set target http://moth/', 'target view', @@ -105,6 +112,7 @@ def test_menu_set_option_manual_save(self): assert_result, msg = self.startswith_expected_in_output(expected_start_with) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_menu_set_option_auto_save(self): commands_to_run = ['target set target http://moth/', 'target view', @@ -118,6 +126,7 @@ def test_menu_set_option_auto_save(self): assert_result, msg = self.startswith_expected_in_output(expected_start_with) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_menu_set_option_invalid_case01(self): # Invalid port commands_to_run = ['target', 'set target http://moth:301801/', 'view', diff --git a/w3af/core/ui/console/tests/test_bug_report.py b/w3af/core/ui/console/tests/test_bug_report.py index 40a4780b22..1151eca5ae 100644 --- a/w3af/core/ui/console/tests/test_bug_report.py +++ b/w3af/core/ui/console/tests/test_bug_report.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import re import shutil @@ -76,6 +77,7 @@ def tearDown(self): super(TestConsoleBugReport, self).tearDown() + @pytest.mark.deprecated def test_buggy_scan(self): target = get_moth_http('/grep/csp/') commands_to_run = ['plugins', diff --git a/w3af/core/ui/console/tests/test_ctrl_c.py b/w3af/core/ui/console/tests/test_ctrl_c.py index 80fcb37966..ca153ebafd 100644 --- a/w3af/core/ui/console/tests/test_ctrl_c.py +++ b/w3af/core/ui/console/tests/test_ctrl_c.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import signal import subprocess @@ -46,6 +47,8 @@ def prepare_script(self): fhandler.close() return fhandler.name + @pytest.mark.deprecated + @pytest.mark.slow def test_scan_ctrl_c(self): script = self.prepare_script() cmd = ['python', 'w3af_console', '-s', script] diff --git a/w3af/core/ui/console/tests/test_exploit.py b/w3af/core/ui/console/tests/test_exploit.py index 23bd5a62cc..1da98be68b 100644 --- a/w3af/core/ui/console/tests/test_exploit.py +++ b/w3af/core/ui/console/tests/test_exploit.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.core.controllers.ci.moth import get_moth_http @@ -32,6 +33,7 @@ class TestExploitConsoleUI(ConsoleTestHelper): Run scan and exploit vulnerabilities from the console UI. """ + @pytest.mark.deprecated def test_OS_commanding_exploit(self): target = get_moth_http('/audit/os_commanding/trivial_osc.py') qs = '?cmd=foobar' diff --git a/w3af/core/ui/console/tests/test_kb_add.py b/w3af/core/ui/console/tests/test_kb_add.py index b14e2ad9c6..6c6466808f 100644 --- a/w3af/core/ui/console/tests/test_kb_add.py +++ b/w3af/core/ui/console/tests/test_kb_add.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.core.ui.console.console_ui import ConsoleUI @@ -29,6 +30,7 @@ class TestKBAdd(ConsoleTestHelper): """ Basic test for the console UI. """ + @pytest.mark.deprecated def test_kb_add(self): commands_to_run = ['kb', 'add dav', @@ -50,6 +52,7 @@ def test_kb_add(self): assert_result, msg = self.startswith_expected_in_output(expected) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_kb_add_with_errors(self): commands_to_run = ['kb', 'add', @@ -70,6 +73,7 @@ def test_kb_add_with_errors(self): assert_result, msg = self.startswith_expected_in_output(expected) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_kb_add_back_without_config(self): commands_to_run = ['kb', 'add', diff --git a/w3af/core/ui/console/tests/test_profiles.py b/w3af/core/ui/console/tests/test_profiles.py index e37374ab4e..44ea50607b 100644 --- a/w3af/core/ui/console/tests/test_profiles.py +++ b/w3af/core/ui/console/tests/test_profiles.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import sys import tempfile @@ -71,6 +72,7 @@ def _assert_equal(self, profile_name_a, profile_name_b): assertProfilesEqual(p1.profile_file_name, p2.profile_file_name) + @pytest.mark.deprecated def test_load_profile_exists(self): commands_to_run = ['profiles', 'help', @@ -88,6 +90,7 @@ def test_load_profile_exists(self): assert_result, msg = self.all_expected_substring_in_output(expected) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_load_profile_by_filepath(self): tmp_profile = tempfile.NamedTemporaryFile(suffix='.pw3af') commands_to_run = ['profiles', @@ -106,6 +109,7 @@ def test_load_profile_by_filepath(self): assert_result, msg = self.all_expected_substring_in_output(expected) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_load_profile_not_exists(self): commands_to_run = ['profiles', 'help', @@ -120,6 +124,7 @@ def test_load_profile_not_exists(self): assert_result, msg = self.startswith_expected_in_output(expected) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_save_as_profile(self): commands_to_run = ['profiles', 'use OWASP_TOP10', @@ -137,6 +142,7 @@ def test_save_as_profile(self): self._assert_exists(self.get_profile_name()) self._assert_equal(self.get_profile_name(), 'OWASP_TOP10') + @pytest.mark.deprecated def test_save_as_self_contained_profile(self): commands_to_run = ['profiles', 'use OWASP_TOP10', @@ -161,6 +167,7 @@ def test_save_as_self_contained_profile(self): self.assertIn('caFileName = %ROOT_PATH%', file(p.profile_file_name).read()) + @pytest.mark.deprecated def test_use_self_contained_profile(self): """ Makes sure that we're able to use a self-contained profile and that @@ -199,6 +206,7 @@ def test_use_self_contained_profile(self): else: self.assertTrue(False, 'No self contained file found') + @pytest.mark.deprecated def test_set_save_use(self): """ This is a unittest for the bug reported by a user where his settings @@ -265,6 +273,7 @@ def test_set_save_use(self): msg = msg % (expected_output, stdout, python_executable) self.assertIn(expected_output, stdout, msg) + @pytest.mark.deprecated def test_save_as_profile_no_param(self): commands_to_run = ['profiles', 'use OWASP_TOP10', @@ -279,6 +288,7 @@ def test_save_as_profile_no_param(self): assert_result, msg = self.startswith_expected_in_output(expected) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_save_load_misc_settings(self): # Save the settings commands_to_run = ['misc-settings set msf_location /etc/', diff --git a/w3af/core/ui/console/tests/test_save.py b/w3af/core/ui/console/tests/test_save.py index c671af17ba..9b00288c4f 100644 --- a/w3af/core/ui/console/tests/test_save.py +++ b/w3af/core/ui/console/tests/test_save.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.core.ui.console.console_ui import ConsoleUI @@ -29,6 +30,7 @@ class TestSaveConsoleUI(ConsoleTestHelper): """ Save test for the console UI. """ + @pytest.mark.deprecated def test_menu_simple_save(self): commands_to_run = ['plugins crawl config dir_file_bruter', 'set file_wordlist /etc/passwd', @@ -45,6 +47,7 @@ def test_menu_simple_save(self): assert_result, msg = self.all_expected_substring_in_output(expected_start_with) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_menu_save_with_dependencies_error(self): commands_to_run = ['plugins audit config rfi', 'set use_w3af_site false', @@ -61,6 +64,7 @@ def test_menu_save_with_dependencies_error(self): assert_result, msg = self.startswith_expected_in_output(expected_start_with) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_menu_save_with_dependencies_success(self): commands_to_run = ['plugins audit config rfi', 'set use_w3af_site false', @@ -79,6 +83,7 @@ def test_menu_save_with_dependencies_success(self): assert_result, msg = self.all_expected_substring_in_output(expected_start_with) self.assertTrue(assert_result, msg) + @pytest.mark.deprecated def test_menu_simple_save_with_view(self): """ Reproduces the issue at https://github.com/andresriancho/w3af/issues/474 diff --git a/w3af/core/ui/console/tests/test_scan_run.py b/w3af/core/ui/console/tests/test_scan_run.py index 07b8aeb15a..253e78f5a7 100644 --- a/w3af/core/ui/console/tests/test_scan_run.py +++ b/w3af/core/ui/console/tests/test_scan_run.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.core.controllers.ci.moth import get_moth_http @@ -31,6 +32,7 @@ class TestScanRunConsoleUI(ConsoleTestHelper): Run scans from the console UI. """ + @pytest.mark.deprecated def test_SQL_scan(self): target = get_moth_http('/audit/sql_injection/where_string_single_qs.py') qs = '?uname=pablo' @@ -71,6 +73,7 @@ def test_SQL_scan(self): @attr('smoke') @attr('ci_fails') + @pytest.mark.deprecated def test_two_scans(self): target_1 = get_moth_http('/audit/sql_injection/where_string_single_qs.py') qs_1 = '?uname=pablo' diff --git a/w3af/core/ui/console/tests/test_w3af_console.py b/w3af/core/ui/console/tests/test_w3af_console.py index 1baf6c7a04..9ed68e3435 100644 --- a/w3af/core/ui/console/tests/test_w3af_console.py +++ b/w3af/core/ui/console/tests/test_w3af_console.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import compiler import subprocess diff --git a/w3af/core/ui/console/tests/test_wrapped_w3af.py b/w3af/core/ui/console/tests/test_wrapped_w3af.py index 9a0a0e3c0f..2a2b939909 100644 --- a/w3af/core/ui/console/tests/test_wrapped_w3af.py +++ b/w3af/core/ui/console/tests/test_wrapped_w3af.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import subprocess import sys diff --git a/w3af/core/ui/gui/tests/test_history.py b/w3af/core/ui/gui/tests/test_history.py index b66d99e4d7..1f06882c93 100644 --- a/w3af/core/ui/gui/tests/test_history.py +++ b/w3af/core/ui/gui/tests/test_history.py @@ -24,6 +24,8 @@ import time import os +import pytest + from w3af.core.ui.gui.history import HistorySuggestion @@ -41,6 +43,7 @@ def tearDown(self): setUp = tearDown + @pytest.mark.deprecated def test_basic(self): # Testing History with QUANT elements his = HistorySuggestion(self.TEST_FILE) @@ -59,4 +62,3 @@ def test_basic(self): self.assertIn(texts[-1], his_loaded.get_texts()) self.assertIn(texts[0], his_loaded.get_texts()) - \ No newline at end of file diff --git a/w3af/core/ui/tests/gui/auto_update/test_auto_update.py b/w3af/core/ui/tests/gui/auto_update/test_auto_update.py index af014c4d26..4751fffaf2 100644 --- a/w3af/core/ui/tests/gui/auto_update/test_auto_update.py +++ b/w3af/core/ui/tests/gui/auto_update/test_auto_update.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import subprocess import datetime @@ -50,6 +51,7 @@ def tearDown(self): startup_cfg.last_upd = datetime.date.today() startup_cfg.save() + @pytest.mark.deprecated def test_disclaimer_shown_accept(self): startup_cfg = StartUpConfig() startup_cfg.last_upd = datetime.date.today() - datetime.timedelta(days=3) diff --git a/w3af/core/ui/tests/gui/disclaimer_accept/test_disclaimer_accept.py b/w3af/core/ui/tests/gui/disclaimer_accept/test_disclaimer_accept.py index 6442e62007..f72cc6dd83 100644 --- a/w3af/core/ui/tests/gui/disclaimer_accept/test_disclaimer_accept.py +++ b/w3af/core/ui/tests/gui/disclaimer_accept/test_disclaimer_accept.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import subprocess @@ -48,6 +49,7 @@ def tearDown(self): startup_cfg.accepted_disclaimer = True startup_cfg.save() + @pytest.mark.deprecated def test_disclaimer_shown_accept(self): startup_cfg = StartUpConfig() startup_cfg.accepted_disclaimer = False @@ -58,6 +60,7 @@ def test_disclaimer_shown_accept(self): self.find('owasp_top_10_profile') + @pytest.mark.deprecated def test_disclaimer_shown_not_accept(self): startup_cfg = StartUpConfig() startup_cfg.accepted_disclaimer = False @@ -68,6 +71,7 @@ def test_disclaimer_shown_not_accept(self): self.not_find('owasp_top_10_profile') + @pytest.mark.deprecated def test_disclaimer_not_shown(self): startup_cfg = StartUpConfig() startup_cfg.accepted_disclaimer = True diff --git a/w3af/core/ui/tests/gui/encode_decode/test_encode_decode.py b/w3af/core/ui/tests/gui/encode_decode/test_encode_decode.py index bfa3daa364..4381259b79 100644 --- a/w3af/core/ui/tests/gui/encode_decode/test_encode_decode.py +++ b/w3af/core/ui/tests/gui/encode_decode/test_encode_decode.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -33,6 +34,7 @@ def setUp(self): super(TestEncodeDecode, self).setUp() self.xp.load_images(self.EXTRA_IMAGES) + @pytest.mark.deprecated def test_encode_url_default(self): self.find('all-menu') self.click('encode-decode-icon') @@ -45,6 +47,7 @@ def test_encode_url_default(self): self.click('close-with-cross') + @pytest.mark.deprecated def test_encode_md5(self): self.find('all-menu') self.click('encode-decode-icon') @@ -60,6 +63,7 @@ def test_encode_md5(self): self.click('close-with-cross') + @pytest.mark.deprecated def test_decode_url(self): self.find('all-menu') self.click('encode-decode-icon') diff --git a/w3af/core/ui/tests/gui/exploit/test_exploit.py b/w3af/core/ui/tests/gui/exploit/test_exploit.py index 708d40cfbf..ab23edd731 100644 --- a/w3af/core/ui/tests/gui/exploit/test_exploit.py +++ b/w3af/core/ui/tests/gui/exploit/test_exploit.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -32,6 +33,7 @@ class TestExploit(XpresserUnittest): def setUp(self): super(TestExploit, self).setUp() + @pytest.mark.deprecated def test_scan_exploit(self): # Enable all audit plugins self.click('audit_plugin_checkbox') diff --git a/w3af/core/ui/tests/gui/exploit_from_template/test_exploit_from_template.py b/w3af/core/ui/tests/gui/exploit_from_template/test_exploit_from_template.py index fc165ec1ef..bda76f9d61 100644 --- a/w3af/core/ui/tests/gui/exploit_from_template/test_exploit_from_template.py +++ b/w3af/core/ui/tests/gui/exploit_from_template/test_exploit_from_template.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -35,6 +36,7 @@ class TestExploitFromTemplate(XpresserUnittest): def setUp(self): super(TestExploitFromTemplate, self).setUp() + @pytest.mark.deprecated def test_exploit(self): self.click('exploit_tab') diff --git a/w3af/core/ui/tests/gui/export_request/test_export_request.py b/w3af/core/ui/tests/gui/export_request/test_export_request.py index 969b8a9a22..4196185b97 100644 --- a/w3af/core/ui/tests/gui/export_request/test_export_request.py +++ b/w3af/core/ui/tests/gui/export_request/test_export_request.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -29,6 +30,7 @@ class TestExportRequest(XpresserUnittest): IMAGES = os.path.join(GUI_TEST_ROOT_PATH, 'export_request', 'images') EXTRA_IMAGES = os.path.join(GUI_TEST_ROOT_PATH, 'tools_menu', 'images') + @pytest.mark.deprecated def test_export_request_python(self): self.find('all-menu') self.click('export-http-icon') diff --git a/w3af/core/ui/tests/gui/fuzzy_request_editor/test_fuzzy_request_editor.py b/w3af/core/ui/tests/gui/fuzzy_request_editor/test_fuzzy_request_editor.py index 5dccd7f5e6..cc9e9f4da2 100644 --- a/w3af/core/ui/tests/gui/fuzzy_request_editor/test_fuzzy_request_editor.py +++ b/w3af/core/ui/tests/gui/fuzzy_request_editor/test_fuzzy_request_editor.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.data.parsers.doc.http_request_parser import http_request_parser @@ -57,6 +58,7 @@ def tearDown(self): self.click('close-with-cross') XpresserUnittest.tearDown(self) + @pytest.mark.deprecated def test_offline_url(self): self.double_click('localhost') self.type('moth:8081', False) @@ -68,6 +70,7 @@ def test_offline_url(self): self.type(['',], False) + @pytest.mark.deprecated def test_invalid_request(self): self.double_click('localhost') self.type('moth:8081', False) @@ -94,6 +97,7 @@ def test_invalid_request(self): self.type(['',], False) + @pytest.mark.deprecated def test_GET_request(self): self.http_daemon = HTTPDaemon() self.http_daemon.start() @@ -133,6 +137,7 @@ def test_GET_request(self): self.http_daemon.shutdown() + @pytest.mark.deprecated def test_POST_request(self): self.http_daemon = HTTPDaemon() self.http_daemon.start() diff --git a/w3af/core/ui/tests/gui/invalid_target_url/test_invalid_url.py b/w3af/core/ui/tests/gui/invalid_target_url/test_invalid_url.py index 39b04d0ef6..7fee9a1772 100644 --- a/w3af/core/ui/tests/gui/invalid_target_url/test_invalid_url.py +++ b/w3af/core/ui/tests/gui/invalid_target_url/test_invalid_url.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -28,6 +29,7 @@ class TestInvalidURL(XpresserUnittest): IMAGES = os.path.join(GUI_TEST_ROOT_PATH, 'invalid_target_url', 'images') + @pytest.mark.deprecated def test_invalid_url(self): self.click('insert_target_url_here') self.type('http:', False) @@ -39,6 +41,7 @@ def test_invalid_url(self): self.find('invalid_url') self.click('ok') + @pytest.mark.deprecated def test_invalid_url_correct_mistake(self): first = 'http:' second = '//moth/w3af/audit/xss/simple_xss.php?text=1' diff --git a/w3af/core/ui/tests/gui/main_window/test_main_window.py b/w3af/core/ui/tests/gui/main_window/test_main_window.py index 49f615d8df..c91bb2f988 100644 --- a/w3af/core/ui/tests/gui/main_window/test_main_window.py +++ b/w3af/core/ui/tests/gui/main_window/test_main_window.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -28,13 +29,16 @@ class TestMainWindow(XpresserUnittest): IMAGES = os.path.join(GUI_TEST_ROOT_PATH, 'main_window', 'images') + @pytest.mark.deprecated def test_main_menu(self): self.hover('main-window-title') self.find('main-window-menu') + @pytest.mark.deprecated def test_profiles_loaded(self): self.find('owasp_top_10_profile') + @pytest.mark.deprecated def test_plugins_loaded(self): self.find('audit_plugin_type') self.double_click('audit_plugin_type_text') @@ -43,6 +47,7 @@ def test_plugins_loaded(self): self.double_click('output_plugin_type_text') self.find('output_plugin_list') + @pytest.mark.deprecated def test_tab_navigation(self): self.sleep(1) self.click('log_tab') diff --git a/w3af/core/ui/tests/gui/manual_requests/test_manual_requests.py b/w3af/core/ui/tests/gui/manual_requests/test_manual_requests.py index 7806117aff..f51ef82ea8 100644 --- a/w3af/core/ui/tests/gui/manual_requests/test_manual_requests.py +++ b/w3af/core/ui/tests/gui/manual_requests/test_manual_requests.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.data.parsers.doc.http_request_parser import http_request_parser @@ -56,6 +57,7 @@ def tearDown(self): self.click('close-with-cross') XpresserUnittest.tearDown(self) + @pytest.mark.deprecated def test_offline_url(self): self.double_click('localhost') self.type('moth:8081', False) @@ -66,6 +68,7 @@ def test_offline_url(self): # Close the error dialog self.type(['',], False) + @pytest.mark.deprecated def test_invalid_request(self): self.double_click('localhost') self.type('moth:8081', False) @@ -91,6 +94,7 @@ def test_invalid_request(self): # Close the error dialog self.type(['',], False) + @pytest.mark.deprecated def test_GET_request(self): self.http_daemon = HTTPDaemon() self.http_daemon.start() @@ -129,6 +133,7 @@ def test_GET_request(self): self.http_daemon.shutdown() + @pytest.mark.deprecated def test_POST_request(self): self.http_daemon = HTTPDaemon() self.http_daemon.start() diff --git a/w3af/core/ui/tests/gui/new_profile/test_new_profile.py b/w3af/core/ui/tests/gui/new_profile/test_new_profile.py index 68031f975f..08ba1b0502 100644 --- a/w3af/core/ui/tests/gui/new_profile/test_new_profile.py +++ b/w3af/core/ui/tests/gui/new_profile/test_new_profile.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -34,6 +35,7 @@ def setUp(self): super(TestNewProfile, self).setUp() self.xp.load_images(self.EXTRA_IMAGES) + @pytest.mark.deprecated def test_new_profile(self): self.click('new_profile') diff --git a/w3af/core/ui/tests/gui/no_plugins_scan/test_no_plugins_scan.py b/w3af/core/ui/tests/gui/no_plugins_scan/test_no_plugins_scan.py index 96b40588d0..59f23db14c 100644 --- a/w3af/core/ui/tests/gui/no_plugins_scan/test_no_plugins_scan.py +++ b/w3af/core/ui/tests/gui/no_plugins_scan/test_no_plugins_scan.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -28,6 +29,7 @@ class TestNoPluginsScan(XpresserUnittest): IMAGES = os.path.join(GUI_TEST_ROOT_PATH, 'no_plugins_scan', 'images') + @pytest.mark.deprecated def test_no_plugins_enabled(self): self.click('insert_target_url_here') self.type('http://moth/', False) diff --git a/w3af/core/ui/tests/gui/profile_loading/test_profile_loading.py b/w3af/core/ui/tests/gui/profile_loading/test_profile_loading.py index 5fb3aa22fd..ddbf9d9670 100644 --- a/w3af/core/ui/tests/gui/profile_loading/test_profile_loading.py +++ b/w3af/core/ui/tests/gui/profile_loading/test_profile_loading.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -28,6 +29,7 @@ class TestProfileLoading(XpresserUnittest): IMAGES = os.path.join(GUI_TEST_ROOT_PATH, 'profile_loading', 'images') + @pytest.mark.deprecated def test_profile_loading(self): """ Tests that it is possible to change from one profile to the next diff --git a/w3af/core/ui/tests/gui/proxy/test_proxy.py b/w3af/core/ui/tests/gui/proxy/test_proxy.py index f5b559bd97..8ed7eddb71 100644 --- a/w3af/core/ui/tests/gui/proxy/test_proxy.py +++ b/w3af/core/ui/tests/gui/proxy/test_proxy.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import urllib2 import threading @@ -55,11 +56,13 @@ def tearDown(self): XpresserUnittest.tearDown(self) + @pytest.mark.deprecated def test_basic_forwarding(self): port = self.http_daemon.get_port() http_response = self.opener.open('http://127.0.0.1:%s/foo' % port).read() self.assertEqual('ABCDEF\n', http_response) + @pytest.mark.deprecated def test_intercept(self): self.click('intercept') diff --git a/w3af/core/ui/tests/gui/request_help/test_request_help.py b/w3af/core/ui/tests/gui/request_help/test_request_help.py index 595c511597..81de61fea2 100644 --- a/w3af/core/ui/tests/gui/request_help/test_request_help.py +++ b/w3af/core/ui/tests/gui/request_help/test_request_help.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -28,6 +29,7 @@ class TestRequestHelp(XpresserUnittest): IMAGES = os.path.join(GUI_TEST_ROOT_PATH, 'request_help', 'images') + @pytest.mark.deprecated def test_main_menu_help(self): # Make sure the focus is on the w3af_gui before we hit F1 self.click('insert_target_url_here') diff --git a/w3af/core/ui/tests/gui/scan_offline_url/test_scan_offline_url.py b/w3af/core/ui/tests/gui/scan_offline_url/test_scan_offline_url.py index e92d6baa83..c741c346ec 100644 --- a/w3af/core/ui/tests/gui/scan_offline_url/test_scan_offline_url.py +++ b/w3af/core/ui/tests/gui/scan_offline_url/test_scan_offline_url.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -28,6 +29,7 @@ class TestScanOfflineURL(XpresserUnittest): IMAGES = os.path.join(GUI_TEST_ROOT_PATH, 'scan_offline_url', 'images') + @pytest.mark.deprecated def test_scan_offline_url(self): self.click('owasp_top_10_profile') self.click('insert_target_url_here') diff --git a/w3af/core/ui/tests/gui/tools_menu/test_click_menu.py b/w3af/core/ui/tests/gui/tools_menu/test_click_menu.py index a5bd88daa1..33f601bff2 100644 --- a/w3af/core/ui/tests/gui/tools_menu/test_click_menu.py +++ b/w3af/core/ui/tests/gui/tools_menu/test_click_menu.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.core.ui.tests.gui import GUI_TEST_ROOT_PATH @@ -28,6 +29,7 @@ class ClickMenu(XpresserUnittest): IMAGES = os.path.join(GUI_TEST_ROOT_PATH, 'tools_menu', 'images') + @pytest.mark.deprecated def test_click_menu(self): self.find('all-menu') self.click('manual-request') diff --git a/w3af/core/ui/tests/gui/two_scans/test_two_scans.py b/w3af/core/ui/tests/gui/two_scans/test_two_scans.py index 95c303a625..b4c35c6380 100644 --- a/w3af/core/ui/tests/gui/two_scans/test_two_scans.py +++ b/w3af/core/ui/tests/gui/two_scans/test_two_scans.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from nose.plugins.skip import SkipTest @@ -42,6 +43,7 @@ def setUp(self): self.xp.load_images(self.SCAN_IMAGES_1) self.xp.load_images(self.SCAN_IMAGES_2) + @pytest.mark.deprecated def test_two_scans(self): raise SkipTest('See comment below in run_scan_2') diff --git a/w3af/core/ui/tests/test_fuzzygen.py b/w3af/core/ui/tests/test_fuzzygen.py index aa4f4381b3..2a95e68c21 100644 --- a/w3af/core/ui/tests/test_fuzzygen.py +++ b/w3af/core/ui/tests/test_fuzzygen.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.ui.gui.tools.helpers.fuzzygen import FuzzyGenerator, FuzzyError diff --git a/w3af/core/ui/tests/wrappers/tests/test_xvfb_server.py b/w3af/core/ui/tests/wrappers/tests/test_xvfb_server.py index 6c10ef708c..dd4e9e4d18 100644 --- a/w3af/core/ui/tests/wrappers/tests/test_xvfb_server.py +++ b/w3af/core/ui/tests/wrappers/tests/test_xvfb_server.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os import time @@ -43,39 +44,47 @@ def tearDown(self): self.xvfb_server.stop() @attr('ci_fails') + @pytest.mark.deprecated def test_verify_xvfb_installed_true(self): self.assertTrue(self.xvfb_server.is_installed()) @patch('commands.getstatusoutput', return_value=(1, '')) @attr('ci_fails') + @pytest.mark.deprecated def test_verify_xvfb_installed_false_1(self, *args): self.assertFalse(self.xvfb_server.is_installed()) @patch('commands.getstatusoutput', return_value=(256, '')) @attr('ci_fails') + @pytest.mark.deprecated def test_verify_xvfb_installed_false_2(self, *args): self.assertFalse(self.xvfb_server.is_installed()) @attr('ci_fails') + @pytest.mark.deprecated def test_stop_not_started(self): self.assertTrue(self.xvfb_server.stop()) @attr('ci_fails') + @pytest.mark.deprecated def test_not_running(self): self.assertFalse(self.xvfb_server.is_running()) @attr('ci_fails') + @pytest.mark.deprecated def test_start(self): self.xvfb_server.start_sync() self.assertTrue(self.xvfb_server.is_running()) @attr('ci_fails') + @pytest.mark.deprecated def test_start_start(self): self.xvfb_server.start_sync() self.assertRaises(RuntimeError, self.xvfb_server.start_sync) self.assertTrue(self.xvfb_server.is_running()) @attr('ci_fails') + @pytest.mark.deprecated def test_two_servers(self): xvfb_server_1 = XVFBServer() xvfb_server_2 = XVFBServer() @@ -89,11 +98,13 @@ def test_two_servers(self): xvfb_server_1.stop() @attr('ci_fails') + @pytest.mark.deprecated def test_get_screenshot_not_started(self): output_files = self.xvfb_server.get_screenshot() self.assertEqual(output_files, None) @attr('ci_fails') + @pytest.mark.deprecated def test_get_screenshot(self): self.xvfb_server.start_sync() self.assertTrue(self.xvfb_server.is_running(), @@ -111,11 +122,13 @@ def test_get_screenshot(self): os.remove(output_file) @attr('ci_fails') + @pytest.mark.deprecated def test_run_with_stopped_xvfb(self): run_result = self.xvfb_server.run_x_process(self.X_TEST_COMMAND) self.assertFalse(run_result) @attr('ci_fails') + @pytest.mark.deprecated def test_run_hello_world_in_xvfb(self): self.xvfb_server.start_sync() self.assertTrue(self.xvfb_server.is_running()) @@ -137,6 +150,7 @@ def test_run_hello_world_in_xvfb(self): self.assertFalse(is_black_image(Image.open(screen_0))) @attr('ci_fails') + @pytest.mark.deprecated def test_start_vnc_server(self): self.xvfb_server.start_sync() - self.xvfb_server.start_vnc_server() \ No newline at end of file + self.xvfb_server.start_vnc_server() diff --git a/w3af/plugins/attack/db/tests/test_sqlmap_update.py b/w3af/plugins/attack/db/tests/test_sqlmap_update.py index 735456fef2..3a8d883d46 100644 --- a/w3af/plugins/attack/db/tests/test_sqlmap_update.py +++ b/w3af/plugins/attack/db/tests/test_sqlmap_update.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.misc.file_utils import get_days_since_last_update @@ -27,6 +28,7 @@ class TestSQLMapUpdate(unittest.TestCase): """Verify that we have an updated version of sqlmap within w3af""" + @pytest.mark.deprecated def test_updated(self): days = get_days_since_last_update(SQLMapWrapper.SQLMAP_LOCATION) diff --git a/w3af/plugins/attack/db/tests/test_sqlmap_wrapper.py b/w3af/plugins/attack/db/tests/test_sqlmap_wrapper.py index 122fd2cf90..fbc1cb1f9e 100644 --- a/w3af/plugins/attack/db/tests/test_sqlmap_wrapper.py +++ b/w3af/plugins/attack/db/tests/test_sqlmap_wrapper.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import shutil import unittest @@ -69,10 +70,12 @@ def tearDownClass(cls): if os.path.exists(output_dir): shutil.rmtree(output_dir) + @pytest.mark.deprecated def test_verify_vulnerability(self): vulnerable = self.sqlmap.is_vulnerable() self.assertTrue(vulnerable) + @pytest.mark.deprecated def test_verify_vulnerability_ssl(self): uri = URL(self.SSL_SQLI_GET) target = Target(uri) @@ -94,6 +97,7 @@ def test_verify_vulnerability_false(self): vulnerable = self.sqlmap.is_vulnerable() self.assertFalse(vulnerable) + @pytest.mark.deprecated def test_verify_vulnerability_POST(self): target = Target(URL(self.SQLI_POST), self.DATA_POST) @@ -121,12 +125,14 @@ def test_stds(self): self.assertIn('sqlmap.py', cmd) + @pytest.mark.deprecated def test_target_basic(self): target = Target(URL(self.SQLI_GET)) params = target.to_params() self.assertEqual(params, ["--url=%s" % self.SQLI_GET]) + @pytest.mark.deprecated def test_target_post_data(self): target = Target(URL(self.SQLI_GET), self.DATA_POST) params = target.to_params() @@ -155,6 +161,7 @@ def test_enable_coloring(self): params = sqlmap.get_wrapper_params() self.assertNotIn('--disable-coloring', params) + @pytest.mark.deprecated def test_dbs(self): vulnerable = self.sqlmap.is_vulnerable() self.assertTrue(vulnerable) @@ -164,6 +171,7 @@ def test_dbs(self): self.assertIn('on SQLite it is not possible to enumerate databases', output) + @pytest.mark.deprecated def test_tables(self): vulnerable = self.sqlmap.is_vulnerable() self.assertTrue(vulnerable) @@ -175,6 +183,7 @@ def test_tables(self): self.assertIn('Database: SQLite_masterdb', output) self.assertIn('django_content_type', output) + @pytest.mark.deprecated def test_users(self): vulnerable = self.sqlmap.is_vulnerable() self.assertTrue(vulnerable) @@ -185,6 +194,7 @@ def test_users(self): self.assertIn('on SQLite it is not possible to enumerate the users', output) + @pytest.mark.deprecated def test_dump(self): vulnerable = self.sqlmap.is_vulnerable() self.assertTrue(vulnerable) @@ -195,6 +205,7 @@ def test_dump(self): self.assertIn('django_session', output) self.assertIn('auth_user_user_permissions', output) + @pytest.mark.deprecated def test_sqlmap(self): vulnerable = self.sqlmap.is_vulnerable() self.assertTrue(vulnerable, self.sqlmap.last_stdout) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_apache_config_directory.py b/w3af/plugins/attack/payloads/payloads/tests/test_apache_config_directory.py index 4443688595..5010b61154 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_apache_config_directory.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_apache_config_directory.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +27,7 @@ class TestApacheConfigDirectory(PayloadTestHelper): EXPECTED_RESULT = {'apache_directory': []} + @pytest.mark.deprecated def test_apache_config_directory(self): result = exec_payload(self.shell, 'apache_config_directory', diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_apache_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_apache_config_files.py index db016c17dc..61ba968807 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_apache_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_apache_config_files.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_apache_config_files.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -33,7 +36,8 @@ class test_apache_config_files(PayloadTestHelper): '/etc/apache2/sites-enabled/moth'] @attr('ci_fails') + @pytest.mark.deprecated def test_apache_config_files(self): result = exec_payload(self.shell, 'apache_config_files', use_api=True) self.assertEquals( - set(self.EXPECTED_RESULT), set(result['apache_config'].keys())) \ No newline at end of file + set(self.EXPECTED_RESULT), set(result['apache_config'].keys())) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_apache_htaccess.py b/w3af/plugins/attack/payloads/payloads/tests/test_apache_htaccess.py index cb245ec929..4df4860583 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_apache_htaccess.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_apache_htaccess.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_apache_htaccess.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -30,6 +33,7 @@ class test_apache_htaccess(PayloadTestHelper): } @attr('ci_fails') + @pytest.mark.deprecated def test_apache_htaccess(self): result = exec_payload(self.shell, 'apache_htaccess', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, result) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_apache_mod_security.py b/w3af/plugins/attack/payloads/payloads/tests/test_apache_mod_security.py index 17f0f8a91c..a3ed0dfc1a 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_apache_mod_security.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_apache_mod_security.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_apache_mod_security.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -30,8 +33,9 @@ class test_apache_mod_security(PayloadTestHelper): 'version': {u'2.6.3 ': 'Yes'}} maxDiff = None - + @attr('ci_fails') + @pytest.mark.deprecated def test_apache_mod_security(self): result = exec_payload(self.shell, 'apache_mod_security', use_api=True) @@ -39,4 +43,4 @@ def test_apache_mod_security(self): self.assertIn('/etc/apache2/mods-available/mod-security.conf', result['file']) file_content = result['file']['/etc/apache2/mods-available/mod-security.conf'] - self.assertIn('', file_content) \ No newline at end of file + self.assertIn('', file_content) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_apache_root_directory.py b/w3af/plugins/attack/payloads/payloads/tests/test_apache_root_directory.py index 600ead023c..4df034251e 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_apache_root_directory.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_apache_root_directory.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_apache_root_directory.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -29,7 +32,8 @@ class test_apache_root_directory(PayloadTestHelper): u'/var/www/moth/']} @attr('ci_fails') + @pytest.mark.deprecated def test_apache_root_directory(self): result = exec_payload( self.shell, 'apache_root_directory', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, result) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_apache_run_group.py b/w3af/plugins/attack/payloads/payloads/tests/test_apache_run_group.py index e8c0b05ed8..d1017eb6a9 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_apache_run_group.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_apache_run_group.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +27,7 @@ class TestApacheRunGroup(PayloadTestHelper): EXPECTED_RESULT = {'apache_run_group': []} + @pytest.mark.deprecated def test_apache_run_group(self): result = exec_payload(self.shell, 'apache_run_group', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_apache_run_user.py b/w3af/plugins/attack/payloads/payloads/tests/test_apache_run_user.py index 828a462c44..86065d5677 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_apache_run_user.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_apache_run_user.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +27,7 @@ class TestApacheRunUser(PayloadTestHelper): EXPECTED_RESULT = {'apache_run_user': []} + @pytest.mark.deprecated def test_apache_run_user(self): result = exec_payload(self.shell, 'apache_run_user', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_apache_ssl.py b/w3af/plugins/attack/payloads/payloads/tests/test_apache_ssl.py index ad9d778674..f3e5c9be6b 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_apache_ssl.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_apache_ssl.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_apache_ssl.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest @@ -30,10 +33,12 @@ class test_apache_ssl(PayloadTestHelper): EXPECTED_RESULT = {'apache_ssl_certificate': {}, 'apache_ssl_key': {}} @attr('ci_fails') + @pytest.mark.deprecated def test_apache_ssl(self): result = exec_payload(self.shell, 'apache_ssl', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) @attr('ci_fails') + @pytest.mark.deprecated def test_a_positive_test(self): - raise SkipTest('FIXME: I need a positive test where SSL cert and keys are found.') \ No newline at end of file + raise SkipTest('FIXME: I need a positive test where SSL cert and keys are found.') diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_apache_version.py b/w3af/plugins/attack/payloads/payloads/tests/test_apache_version.py index 0135d01150..0c634704fd 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_apache_version.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_apache_version.py @@ -1,4 +1,7 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated +@pytest.mark.deprecated test_apache_version.py Copyright 2012 Andres Riancho @@ -18,6 +21,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -28,6 +32,7 @@ class test_apache_version(PayloadTestHelper): EXPECTED_RESULT = {'version': [u'2.2.22']} @attr('ci_fails') + @pytest.mark.deprecated def test_apache_version(self): result = exec_payload(self.shell, 'apache_version', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, result) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_arp_cache.py b/w3af/plugins/attack/payloads/payloads/tests/test_arp_cache.py index 6b9993fca4..47aab61667 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_arp_cache.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_arp_cache.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_arp_cache.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper @@ -30,6 +33,7 @@ class test_arp_cache(PayloadTestHelper): # Not used because I want to be less specific in this case EXPECTED_RESULT = {u'192.168.56.1': (u'0a:00:27:00:00:00', u'eth1'), } + @pytest.mark.deprecated def test_arp_cache(self): result = exec_payload(self.shell, 'arp_cache', use_api=True) for ip_address, (mac, iface) in result.iteritems(): diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_cpu_info.py b/w3af/plugins/attack/payloads/payloads/tests/test_cpu_info.py index 6fd9d1d9ab..38f28cd73d 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_cpu_info.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_cpu_info.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_cpu_info.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper @@ -31,6 +34,7 @@ class test_cpu_info(PayloadTestHelper): 'cpu_info': u'AMD Phenom(tm) II X4 945 Processor'} @attr('ci_fails') + @pytest.mark.deprecated def test_cpu_info(self): result = exec_payload(self.shell, 'cpu_info', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, result) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_current_user.py b/w3af/plugins/attack/payloads/payloads/tests/test_current_user.py index b6830eb28b..b3ea609c43 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_current_user.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_current_user.py @@ -18,12 +18,14 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload class TestCurrentUser(PayloadTestHelper): + @pytest.mark.deprecated def test_current_user(self): result = exec_payload(self.shell, 'current_user', use_api=True) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_dhcp_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_dhcp_config_files.py index 43f569332a..cb1859b5c8 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_dhcp_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_dhcp_config_files.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_dhcp_config_files.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest @@ -29,10 +32,12 @@ class test_dhcp_config_files(PayloadTestHelper): EXPECTED_RESULT = {} + @pytest.mark.deprecated def test_dhcp_config_files(self): result = exec_payload(self.shell, 'dhcp_config_files', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) @attr('ci_fails') + @pytest.mark.deprecated def test_a_positive_test(self): - raise SkipTest('FIXME: I need a positive test.') \ No newline at end of file + raise SkipTest('FIXME: I need a positive test.') diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_dns_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_dns_config_files.py index fe4af4df1a..be28f4a787 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_dns_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_dns_config_files.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_dns_config_files.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest @@ -34,10 +37,12 @@ class test_dns_config_files(PayloadTestHelper): 'nameserver 10.0.2.2\n')} @attr('ci_fails') + @pytest.mark.deprecated def test_dns_config_files(self): result = exec_payload(self.shell, 'dns_config_files', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) @attr('ci_fails') + @pytest.mark.deprecated def test_a_positive_test(self): - raise SkipTest('FIXME: I need a positive test.') \ No newline at end of file + raise SkipTest('FIXME: I need a positive test.') diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_domainname.py b/w3af/plugins/attack/payloads/payloads/tests/test_domainname.py index 9ea9687401..051dd90da8 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_domainname.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_domainname.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_domainname.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -27,6 +30,7 @@ class test_domainname(PayloadTestHelper): # Note: the (none) is actually the expected result for this host EXPECTED_RESULT = {'domain_name': u'(none)'} + @pytest.mark.deprecated def test_domainname(self): result = exec_payload(self.shell, 'domainname', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_filesystem.py b/w3af/plugins/attack/payloads/payloads/tests/test_filesystem.py index a5c5c95a22..6510d21f9d 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_filesystem.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_filesystem.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_filesystem.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +29,7 @@ class test_filesystem(PayloadTestHelper): EXPECTED_RESULT = ['/etc/mtab', '/etc/fstab', '/proc/mounts'] + @pytest.mark.deprecated def test_filesystem(self): result = exec_payload(self.shell, 'filesystem', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result.keys()) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_firefox_stealer.py b/w3af/plugins/attack/payloads/payloads/tests/test_firefox_stealer.py index 927263637f..4541cfa607 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_firefox_stealer.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_firefox_stealer.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_firefox_stealer.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -36,6 +39,7 @@ class test_firefox_stealer(PayloadTestHelper): u'/home/moth/.mozilla/firefox/xmo3gf47.moth/signons.sqlite': 'Yes'} @attr('ci_fails') + @pytest.mark.deprecated def test_firefox_stealer(self): result = exec_payload(self.shell, 'firefox_stealer', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, result) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_ftp_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_ftp_config_files.py index a565dbc472..66d620a4ed 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_ftp_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_ftp_config_files.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_ftp_config_files.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest @@ -29,10 +32,12 @@ class test_ftp_config_files(PayloadTestHelper): EXPECTED_RESULT = {} + @pytest.mark.deprecated def test_ftp_config_files(self): result = exec_payload(self.shell, 'ftp_config_files', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) @attr('ci_fails') + @pytest.mark.deprecated def test_a_positive_test(self): - raise SkipTest('FIXME: I need a positive test.') \ No newline at end of file + raise SkipTest('FIXME: I need a positive test.') diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_gcc_version.py b/w3af/plugins/attack/payloads/payloads/tests/test_gcc_version.py index 669141a825..7a40303f98 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_gcc_version.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_gcc_version.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_gcc_version.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -28,6 +31,7 @@ class test_gcc_version(PayloadTestHelper): EXPECTED_RESULT = {'gcc_version': u'4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)'} @attr('ci_fails') + @pytest.mark.deprecated def test_gcc_version(self): result = exec_payload(self.shell, 'gcc_version', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, result) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_get_hashes.py b/w3af/plugins/attack/payloads/payloads/tests/test_get_hashes.py index 1679fad2b4..5c0c9961e4 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_get_hashes.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_get_hashes.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_get_hashes.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +29,7 @@ class test_get_hashes(PayloadTestHelper): EXPECTED_RESULT = {} + @pytest.mark.deprecated def test_get_hashes(self): result = exec_payload(self.shell, 'get_hashes', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_get_source_code.py b/w3af/plugins/attack/payloads/payloads/tests/test_get_source_code.py index 3406f32268..2e1e0ada92 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_get_source_code.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_get_source_code.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_get_source_code.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import tempfile import shutil @@ -37,6 +40,7 @@ class test_get_source_code(PayloadTestHelper): CONTENT = "echo file_get_contents( $_REQUEST['file'] );" @attr('ci_fails') + @pytest.mark.deprecated def test_get_source_code(self): temp_dir = tempfile.mkdtemp() result = exec_payload(self.shell, 'get_source_code', args=(temp_dir,), @@ -52,4 +56,4 @@ def test_get_source_code(self): downloaded_file_content = file(downloaded_file_path).read() self.assertTrue(self.CONTENT in downloaded_file_content) - shutil.rmtree(temp_dir) \ No newline at end of file + shutil.rmtree(temp_dir) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_hostname.py b/w3af/plugins/attack/payloads/payloads/tests/test_hostname.py index e6f5700c2a..2bb70ad569 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_hostname.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_hostname.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_hostname.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import socket from nose.plugins.attrib import attr @@ -30,6 +33,7 @@ class test_hostname(PayloadTestHelper): EXPECTED_RESULT = {'hostname': [socket.gethostname(),]} @attr('ci_fails') + @pytest.mark.deprecated def test_hostname(self): result = exec_payload(self.shell, 'hostname', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, result) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_hosts.py b/w3af/plugins/attack/payloads/payloads/tests/test_hosts.py index 6dab862fe8..b1b8b4fe6a 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_hosts.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_hosts.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +27,7 @@ class TestHosts(PayloadTestHelper): EXPECTED_RESULT = ['/etc/hosts'] + @pytest.mark.deprecated def test_hosts(self): result = exec_payload(self.shell, 'hosts', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result.keys()) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_iis_root_directory.py b/w3af/plugins/attack/payloads/payloads/tests/test_iis_root_directory.py index 4bbe65a5b8..dc8dc2790c 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_iis_root_directory.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_iis_root_directory.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_iis_root_directory.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest @@ -29,10 +32,12 @@ class test_iis_root_directory(PayloadTestHelper): EXPECTED_RESULT = {} + @pytest.mark.deprecated def test_iis_root_directory(self): result = exec_payload(self.shell, 'iis_root_directory', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) @attr('ci_fails') + @pytest.mark.deprecated def test_a_positive_test(self): - raise SkipTest('I need a positive test.') \ No newline at end of file + raise SkipTest('I need a positive test.') diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_interesting_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_interesting_files.py index e14760ccbd..85fc7e369e 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_interesting_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_interesting_files.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_interesting_files.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper @@ -29,6 +32,7 @@ class test_interesting_files(PayloadTestHelper): EXPECTED_RESULT = {u'/home/moth/keys.txt': None} + @pytest.mark.deprecated def test_interesting_files(self): result = exec_payload(self.shell, 'interesting_files', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_is_root.py b/w3af/plugins/attack/payloads/payloads/tests/test_is_root.py index 71d0df7e9d..2d11695174 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_is_root.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_is_root.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +27,7 @@ class TestIsRoot(PayloadTestHelper): EXPECTED_RESULT = True + @pytest.mark.deprecated def test_is_root(self): result = exec_payload(self.shell, 'is_root', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_kerberos_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_kerberos_config_files.py index 219f8ca4f6..1ce161bd71 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_kerberos_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_kerberos_config_files.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_kerberos_config_files.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest @@ -29,11 +32,13 @@ class test_kerberos_config_files(PayloadTestHelper): EXPECTED_RESULT = {} + @pytest.mark.deprecated def test_kerberos_config_files(self): result = exec_payload( self.shell, 'kerberos_config_files', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) @attr('ci_fails') + @pytest.mark.deprecated def test_a_positive_test(self): - raise SkipTest('FIXME: I need a positive test.') \ No newline at end of file + raise SkipTest('FIXME: I need a positive test.') diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_kernel_version.py b/w3af/plugins/attack/payloads/payloads/tests/test_kernel_version.py index ec883707a2..eddb415d42 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_kernel_version.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_kernel_version.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_kernel_version.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -29,9 +32,10 @@ class test_kernel_version(PayloadTestHelper): # stop working after the first kernel update EXPECTED_RESULT = {'kernel_version': u'3.2.0-27-generic (buildd@allspice)'} + @pytest.mark.deprecated @attr('ci_fails') def test_kernel_version(self): result = exec_payload(self.shell, 'kernel_version', use_api=True) self.assertTrue(result['kernel_version'].startswith('3.2.')) - self.assertTrue('buildd' in result['kernel_version']) \ No newline at end of file + self.assertTrue('buildd' in result['kernel_version']) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_ldap_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_ldap_config_files.py index 325ef919b1..b7693b495c 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_ldap_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_ldap_config_files.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest @@ -29,10 +30,12 @@ class TestLDAPConfigFiles(PayloadTestHelper): EXPECTED_RESULT = {} + @pytest.mark.deprecated def test_ldap_config_files(self): result = exec_payload(self.shell, 'ldap_config_files', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) @attr('ci_fails') + @pytest.mark.deprecated def test_a_positive_test(self): raise SkipTest('FIXME: I need a positive test.') \ No newline at end of file diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_list_kernel_modules.py b/w3af/plugins/attack/payloads/payloads/tests/test_list_kernel_modules.py index e88fd76171..817ad5be08 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_list_kernel_modules.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_list_kernel_modules.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_list_kernel_modules.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -28,7 +31,8 @@ class test_list_kernel_modules(PayloadTestHelper): EXPECTED_RESULT = set(['ext2', 'lp', 'snd', 'parport_pc', 'vesafb']) @attr('ci_fails') + @pytest.mark.deprecated def test_list_kernel_modules(self): result = exec_payload(self.shell, 'list_kernel_modules', use_api=True) self.assertTrue(set( - result.keys()).issuperset(self.EXPECTED_RESULT), result.keys()) \ No newline at end of file + result.keys()).issuperset(self.EXPECTED_RESULT), result.keys()) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_list_processes.py b/w3af/plugins/attack/payloads/payloads/tests/test_list_processes.py index ac02aa91aa..7ec6c6c222 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_list_processes.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_list_processes.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_list_processes.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper @@ -30,6 +33,7 @@ class test_list_processes(PayloadTestHelper): EXPECTED_RESULT = set(['/sbin/getty -8 38400 tty4', 'cron']) + @pytest.mark.deprecated def test_list_processes(self): result = exec_payload( self.shell, 'list_processes', args=(2000,), use_api=True) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_log_reader.py b/w3af/plugins/attack/payloads/payloads/tests/test_log_reader.py index fd6a54c987..e921449dd7 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_log_reader.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_log_reader.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_log_reader.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -33,7 +36,8 @@ class test_log_reader(PayloadTestHelper): '/var/log/faillog']) @attr('ci_fails') + @pytest.mark.deprecated def test_log_reader(self): result = exec_payload(self.shell, 'log_reader', use_api=True) logs = set(result.keys()) - self.assertTrue(self.EXPECTED_RESULT.issubset(logs), logs) \ No newline at end of file + self.assertTrue(self.EXPECTED_RESULT.issubset(logs), logs) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_mail_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_mail_config_files.py index 3d667d489c..babb1ad289 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_mail_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_mail_config_files.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_mail_config_files.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -28,6 +31,7 @@ class test_mail_config_files(PayloadTestHelper): EXPECTED_RESULT = set(['/etc/postfix/main.cf', '/etc/postfix/master.cf']) @attr('ci_fails') + @pytest.mark.deprecated def test_mail_config_files(self): result = exec_payload(self.shell, 'mail_config_files', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, set(result.keys())) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, set(result.keys())) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_mysql_config.py b/w3af/plugins/attack/payloads/payloads/tests/test_mysql_config.py index 71236a9193..0592cff23c 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_mysql_config.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_mysql_config.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +27,7 @@ class TestMySQLConfig(PayloadTestHelper): EXPECTED_RESULT = '/etc/mysql/my.cnf' + @pytest.mark.deprecated def test_mysql_config(self): result = exec_payload(self.shell, 'mysql_config', use_api=True) self.assertNotIn(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_mysql_config_directory.py b/w3af/plugins/attack/payloads/payloads/tests/test_mysql_config_directory.py index 5bc089337d..942a393bf4 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_mysql_config_directory.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_mysql_config_directory.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +27,7 @@ class TestMySQLConfigDirectory(PayloadTestHelper): EXPECTED_RESULT = {'directory': []} + @pytest.mark.deprecated def test_mysql_config_directory(self): result = exec_payload(self.shell, 'mysql_config_directory', diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_netcat_installed.py b/w3af/plugins/attack/payloads/payloads/tests/test_netcat_installed.py index 20b059447f..643c04c8dd 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_netcat_installed.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_netcat_installed.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_netcat_installed.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -32,6 +35,7 @@ class test_netcat_installed(PayloadTestHelper): 'path': None, 'supports_shell_bind': False} + @pytest.mark.deprecated def test_netcat_installed(self): result = exec_payload(self.shell, 'netcat_installed', use_api=True) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_os_fingerprint.py b/w3af/plugins/attack/payloads/payloads/tests/test_os_fingerprint.py index 762e035a15..3ca2023631 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_os_fingerprint.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_os_fingerprint.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_os_fingerprint.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +29,7 @@ class test_os_fingerprint(PayloadTestHelper): EXPECTED_RESULT = {'os': 'Linux'} + @pytest.mark.deprecated def test_os_fingerprint(self): result = exec_payload(self.shell, 'os_fingerprint', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_payload_handler.py b/w3af/plugins/attack/payloads/payloads/tests/test_payload_handler.py index bb4fb4d7cd..fc19ff7898 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_payload_handler.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_payload_handler.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import commands import unittest import os diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_php_sca.py b/w3af/plugins/attack/payloads/payloads/tests/test_php_sca.py index a02f90a44c..aa78a14c29 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_php_sca.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_php_sca.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_php_sca.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -28,6 +31,7 @@ class test_php_sca(PayloadTestHelper): EXPECTED_RESULT = 'XSS' @attr('ci_fails') + @pytest.mark.deprecated def test_php_sca(self): result = exec_payload(self.shell, 'php_sca', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, result.keys()[0]) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, result.keys()[0]) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_pixy.py b/w3af/plugins/attack/payloads/payloads/tests/test_pixy.py index c982a47d39..b783934a1c 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_pixy.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_pixy.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_pixy.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import tempfile from nose.plugins.attrib import attr @@ -31,6 +34,7 @@ class test_pixy(PayloadTestHelper): EXPECTED_RESULT = {} + @pytest.mark.deprecated def test_pixy(self): temp_dir = tempfile.mkdtemp() result = exec_payload( @@ -38,7 +42,8 @@ def test_pixy(self): self.assertEquals(self.EXPECTED_RESULT, result) @attr('ci_fails') + @pytest.mark.deprecated def test_a_positive_test(self): raise SkipTest('A positive test is needed here, BUT think twice about it' ' since pixy is not supported anymore, and PHP SCA is getting' - ' much better, so we might just deprecate all the pixy stuff.') \ No newline at end of file + ' much better, so we might just deprecate all the pixy stuff.') diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_portscan.py b/w3af/plugins/attack/payloads/payloads/tests/test_portscan.py index 826d7f925c..cfab818df5 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_portscan.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_portscan.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_portscan.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper_exec import PayloadTestHelperExec from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -29,6 +32,7 @@ class test_portscan(PayloadTestHelperExec): RESULT_23 = {'localhost': []} @attr('ci_fails') + @pytest.mark.deprecated def test_portscan(self): result = exec_payload(self.shell, 'portscan', args=('localhost', '22'), @@ -38,4 +42,4 @@ def test_portscan(self): result = exec_payload(self.shell, 'portscan', args=('localhost', '23'), use_api=True) - self.assertEquals(self.RESULT_23, result) \ No newline at end of file + self.assertEquals(self.RESULT_23, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_read_mail.py b/w3af/plugins/attack/payloads/payloads/tests/test_read_mail.py index ebb15eba66..d31c597468 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_read_mail.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_read_mail.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_read_mail.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -31,6 +34,7 @@ class test_read_mail(PayloadTestHelper): '/var/spool/mail/www-data': 'Yes'} @attr('ci_fails') + @pytest.mark.deprecated def test_read_mail(self): result = exec_payload(self.shell, 'read_mail', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, result) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_root_login_allowed.py b/w3af/plugins/attack/payloads/payloads/tests/test_root_login_allowed.py index 99d45a2611..f2bb6376ba 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_root_login_allowed.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_root_login_allowed.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_root_login_allowed.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -27,6 +30,7 @@ class test_root_login_allowed(PayloadTestHelper): EXPECTED_RESULT = {'securetty_root_login': False, 'ssh_root_bruteforce': 'unknown'} + @pytest.mark.deprecated def test_root_login_allowed(self): result = exec_payload(self.shell, 'root_login_allowed', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_rootkit_hunter.py b/w3af/plugins/attack/payloads/payloads/tests/test_rootkit_hunter.py index e908caf10f..97337e99dc 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_rootkit_hunter.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_rootkit_hunter.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_rootkit_hunter.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -29,6 +32,7 @@ class test_rootkit_hunter(PayloadTestHelper): 'bad_kernel_modules': []} @attr('ci_fails') + @pytest.mark.deprecated def test_rootkit_hunter(self): result = exec_payload(self.shell, 'rootkit_hunter', use_api=True) - self.assertEquals(self.EXPECTED_RESULT, result) \ No newline at end of file + self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_route.py b/w3af/plugins/attack/payloads/payloads/tests/test_route.py index de0774ec0f..1d313c3c32 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_route.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_route.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_route.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -39,6 +42,7 @@ class test_route(PayloadTestHelper): 'Iface': 'eth1', 'Mask': '255.255.255.0'}]} + @pytest.mark.deprecated def test_route(self): result = exec_payload(self.shell, 'route', use_api=True) routes = result['route'] diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_running_honeypot.py b/w3af/plugins/attack/payloads/payloads/tests/test_running_honeypot.py index bafcb04f72..71c22d11d5 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_running_honeypot.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_running_honeypot.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_running_honeypot.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest @@ -29,10 +32,12 @@ class test_running_honeypot(PayloadTestHelper): EXPECTED_RESULT = {'is_a_honeypot': False, 'running_honeypot': False} + @pytest.mark.deprecated def test_running_honeypot(self): result = exec_payload(self.shell, 'running_honeypot', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) @attr('ci_fails') + @pytest.mark.deprecated def test_a_positive_test(self): - raise SkipTest('FIXME: I need a positive test.') \ No newline at end of file + raise SkipTest('FIXME: I need a positive test.') diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_running_vm.py b/w3af/plugins/attack/payloads/payloads/tests/test_running_vm.py index 75a9ecf500..6e8cb8da32 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_running_vm.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_running_vm.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_running_vm.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper @@ -29,6 +32,7 @@ class test_running_vm(PayloadTestHelper): EXPECTED_RESULT = {'running_vm': False} + @pytest.mark.deprecated def test_running_vm(self): result = exec_payload(self.shell, 'running_vm', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_smb_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_smb_config_files.py index a18bc52c31..9eaff6bc9b 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_smb_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_smb_config_files.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_smb_config_files.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper @@ -29,6 +32,7 @@ class test_smb_config_files(PayloadTestHelper): EXPECTED_RESULT = {} + @pytest.mark.deprecated def test_smb_config_files(self): result = exec_payload(self.shell, 'smb_config_files', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_spider.py b/w3af/plugins/attack/payloads/payloads/tests/test_spider.py index 1c70adcab5..01d6566970 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_spider.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_spider.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_spider.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper @@ -28,6 +31,7 @@ @attr('fails') class test_spider(PayloadTestHelper): + @pytest.mark.deprecated def test_spider(self): result = exec_payload(self.shell, 'spider', args=(2,), use_api=True) self.assertTrue('/home/moth/keys.txt' in result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_ssh_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_ssh_config_files.py index 24eba2f2a3..dde3720f68 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_ssh_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_ssh_config_files.py @@ -18,12 +18,14 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload class TestSSHConfigFiles(PayloadTestHelper): + @pytest.mark.deprecated def test_ssh_config_files(self): result = exec_payload(self.shell, 'ssh_config_files', use_api=True) self.assertNotIn('/etc/ssh/sshd_config', result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_ssh_version.py b/w3af/plugins/attack/payloads/payloads/tests/test_ssh_version.py index 5545d841ee..8b28b6ed77 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_ssh_version.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_ssh_version.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_ssh_version.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper @@ -31,6 +34,7 @@ class test_ssh_version(PayloadTestHelper): EXPECTED_RESULT = {'ssh_version': 'OpenSSH_5.9p1 Debian-5ubuntu1'} @attr('ci_fails') + @pytest.mark.deprecated def test_ssh_version(self): result = exec_payload(self.shell, 'ssh_version', use_api=True) self.assertEquals(self.EXPECTED_RESULT, result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_svn_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_svn_config_files.py index 1939f8f4f6..2dc9a22cbe 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_svn_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_svn_config_files.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_svn_config_files.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper @@ -27,6 +30,7 @@ class test_svn_config_files(PayloadTestHelper): @attr('ci_fails') + @pytest.mark.deprecated def test_svn_config_files(self): result = exec_payload(self.shell, 'svn_config_files', use_api=True) self.assertTrue('/home/moth/.subversion/config' in result) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_tcp.py b/w3af/plugins/attack/payloads/payloads/tests/test_tcp.py index 0f6f26352d..712fce1ba8 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_tcp.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_tcp.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +27,7 @@ class TestTCP(PayloadTestHelper): EXPECTED_RESULT = {'172.18.0.9:8000', '0.0.0.0:8001', '0.0.0.0:8000'} + @pytest.mark.deprecated def test_tcp(self): result = exec_payload(self.shell, 'tcp', use_api=True) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_udp.py b/w3af/plugins/attack/payloads/payloads/tests/test_udp.py index 4899d95183..3cb6ba217b 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_udp.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_udp.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -27,6 +28,7 @@ class TestUDP(PayloadTestHelper): # No udp services running inside django-moth docker image EXPECTED_RESULT = set() + @pytest.mark.deprecated def test_udp(self): result = exec_payload(self.shell, 'udp', use_api=True) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_uptime.py b/w3af/plugins/attack/payloads/payloads/tests/test_uptime.py index c3cb0d1d8e..78f6844f84 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_uptime.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_uptime.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_uptime.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -29,6 +32,7 @@ class test_uptime(PayloadTestHelper): EXPECTED_RESULT = {'idletime': {'hours': '141', 'minutes': '43', 'seconds': '30'}, 'uptime': {'hours': '144', 'minutes': '12', 'seconds': '2'}} + @pytest.mark.deprecated def test_uptime(self): result = exec_payload(self.shell, 'uptime', use_api=True) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_users.py b/w3af/plugins/attack/payloads/payloads/tests/test_users.py index aadb3fd27e..a9ff7f5ce4 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_users.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_users.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import \ PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -29,6 +30,7 @@ class TestUsers(PayloadTestHelper): u'syslog', u'games', u'proxy', u'lp', u'news', u'mail', u'gnats', u'irc', u'backup', u'ubuntu', u'man'} + @pytest.mark.deprecated def test_users(self): result = exec_payload(self.shell, 'users', use_api=True) self.assertEquals(self.EXPECTED_RESULT, set(result.keys())) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_users_config_files.py b/w3af/plugins/attack/payloads/payloads/tests/test_users_config_files.py index 6638f032e6..3cafabfac0 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_users_config_files.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_users_config_files.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.attack.payloads.payloads.tests.payload_test_helper import PayloadTestHelper from w3af.plugins.attack.payloads.payload_handler import exec_payload @@ -26,6 +27,7 @@ class TestUsersConfigFiles(PayloadTestHelper): EXPECTED_RESULT = {u'/root/.profile', u'/root/.bashrc'} + @pytest.mark.deprecated def test_users_config_files(self): result = exec_payload(self.shell, 'users_config_files', use_api=True) diff --git a/w3af/plugins/attack/payloads/payloads/tests/test_w3af_agent.py b/w3af/plugins/attack/payloads/payloads/tests/test_w3af_agent.py index daead6f9a4..52bec0d9b1 100644 --- a/w3af/plugins/attack/payloads/payloads/tests/test_w3af_agent.py +++ b/w3af/plugins/attack/payloads/payloads/tests/test_w3af_agent.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_w3af_agent.py Copyright 2012 Andres Riancho @@ -18,6 +20,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.core.controllers.misc.get_local_ip import get_local_ip @@ -31,6 +34,7 @@ class test_w3af_agent(PayloadTestHelperExec): @onlyroot @attr('ci_fails') + @pytest.mark.deprecated def test_w3af_agent(self): result = exec_payload(self.shell, 'w3af_agent', args=(get_local_ip(),), use_api=True) diff --git a/w3af/plugins/attack/payloads/tests/test_base_payload.py b/w3af/plugins/attack/payloads/tests/test_base_payload.py index 6cb6082d21..4cb4e7c0d8 100644 --- a/w3af/plugins/attack/payloads/tests/test_base_payload.py +++ b/w3af/plugins/attack/payloads/tests/test_base_payload.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import MagicMock diff --git a/w3af/plugins/attack/payloads/tests/test_shell_handler.py b/w3af/plugins/attack/payloads/tests/test_shell_handler.py index fccfc58745..fd2cdd47df 100644 --- a/w3af/plugins/attack/payloads/tests/test_shell_handler.py +++ b/w3af/plugins/attack/payloads/tests/test_shell_handler.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -30,6 +31,7 @@ class TestShellHandler(unittest.TestCase): TEST_CMD = 'ls' + @pytest.mark.deprecated def test_get_shell_code_extension(self): shells = get_shell_code('php', self.TEST_CMD) @@ -48,6 +50,7 @@ def test_get_shell_code_extension_force(self): self.assertEqual(lang, 'php') self.assertIn('echo ', php_shell_code) + @pytest.mark.deprecated def test_get_shell_code_no_extension(self): shells = get_shell_code('', self.TEST_CMD) @@ -57,6 +60,7 @@ def test_get_shell_code_no_extension(self): self.assertEqual(lang, 'php') self.assertIn('echo ', php_shell_code) + @pytest.mark.deprecated def test_get_shell_code_invalid_extension(self): shells = get_shell_code('123456', self.TEST_CMD) @@ -66,6 +70,7 @@ def test_get_shell_code_invalid_extension(self): self.assertEqual(lang, 'php') self.assertIn('echo ', php_shell_code) + @pytest.mark.deprecated def test_get_web_shell_extension(self): shells = get_webshells('php') @@ -87,18 +92,21 @@ def test_get_web_shell_code_extension_force(self): self.assertEqual(lang, 'php') self.assertIn('echo ', php_shell_code) + @pytest.mark.deprecated def test_get_web_shell_code_no_extension(self): shells = get_webshells('') # All returned when invalid extension self.assertEqual(len(shells), 6) + @pytest.mark.deprecated def test_get_web_shell_code_invalid_extension(self): shells = get_webshells('123456') # All returned when invalid extension self.assertEqual(len(shells), 6) + @pytest.mark.deprecated def test_with_kb_data(self): kb.kb.raw_write('server_header', 'powered_by_string', ['ASP foo bar',]) diff --git a/w3af/plugins/grep/password_profiling_plugins/tests/test_pdf.py b/w3af/plugins/grep/password_profiling_plugins/tests/test_pdf.py index 541370c9fb..ba4b24d604 100644 --- a/w3af/plugins/grep/password_profiling_plugins/tests/test_pdf.py +++ b/w3af/plugins/grep/password_profiling_plugins/tests/test_pdf.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os diff --git a/w3af/plugins/tests/attack/test_dav.py b/w3af/plugins/tests/attack/test_dav.py index d9f085434c..ed444a8671 100644 --- a/w3af/plugins/tests/attack/test_dav.py +++ b/w3af/plugins/tests/attack/test_dav.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginConfig, ExecExploitTest @@ -39,6 +40,7 @@ class TestDAVShell(ExecExploitTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_found_exploit_dav(self): # Run the scan cfg = self._run_configs['cfg'] @@ -55,6 +57,7 @@ def test_found_exploit_dav(self): self._exploit_vuln(vuln_to_exploit_id, 'dav') @attr('ci_fails') + @pytest.mark.deprecated def test_from_template(self): dt = DAVTemplate() diff --git a/w3af/plugins/tests/attack/test_eval.py b/w3af/plugins/tests/attack/test_eval.py index 969fbd30be..7f2c31e85a 100644 --- a/w3af/plugins/tests/attack/test_eval.py +++ b/w3af/plugins/tests/attack/test_eval.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.plugins.tests.helper import PluginConfig, ExecExploitTest @@ -37,6 +38,7 @@ class TestEvalShell(ExecExploitTest): }, } + @pytest.mark.deprecated def test_found_exploit_eval(self): # Run the scan cfg = self._run_configs['eval'] @@ -54,6 +56,7 @@ def test_found_exploit_eval(self): vuln_to_exploit_id = vuln.get_id() self._exploit_vuln(vuln_to_exploit_id, 'eval') + @pytest.mark.deprecated def test_from_template(self): et = EvalTemplate() diff --git a/w3af/plugins/tests/attack/test_file_upload.py b/w3af/plugins/tests/attack/test_file_upload.py index ea18fe1985..6c6e78f7d5 100644 --- a/w3af/plugins/tests/attack/test_file_upload.py +++ b/w3af/plugins/tests/attack/test_file_upload.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.php_moth import get_php_moth_http from w3af.plugins.tests.helper import PluginConfig, ExecExploitTest from w3af.core.data.kb.vuln_templates.file_upload_template import FileUploadTemplate @@ -45,6 +46,7 @@ class TestFileUploadShell(ExecExploitTest): }, } } + @pytest.mark.deprecated def test_found_exploit_file_upload(self): # Run the scan cfg = self._run_configs['cfg'] @@ -61,6 +63,7 @@ def test_found_exploit_file_upload(self): vuln_to_exploit_id = vuln.get_id() self._exploit_vuln(vuln_to_exploit_id, 'file_upload') + @pytest.mark.deprecated def test_from_template(self): fut = FileUploadTemplate() @@ -80,6 +83,7 @@ def test_from_template(self): self._exploit_vuln(vuln_to_exploit_id, 'file_upload') + @pytest.mark.deprecated def test_from_template_534(self): fut = FileUploadTemplate() diff --git a/w3af/plugins/tests/attack/test_local_file_reader.py b/w3af/plugins/tests/attack/test_local_file_reader.py index 9a04358dda..d7ffeaaaf2 100644 --- a/w3af/plugins/tests/attack/test_local_file_reader.py +++ b/w3af/plugins/tests/attack/test_local_file_reader.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.tests.helper import PluginConfig, ReadExploitTest from w3af.core.data.kb.vuln_templates.local_file_read_template import LocalFileReadTemplate from w3af.core.controllers.ci.moth import get_moth_http @@ -36,6 +37,7 @@ class TestFileReadShell(ReadExploitTest): } } + @pytest.mark.deprecated def test_find_exploit_lfi(self): # Run the scan cfg = self._run_configs['cfg'] @@ -52,6 +54,7 @@ def test_find_exploit_lfi(self): vuln_to_exploit_id = vuln.get_id() self._exploit_vuln(vuln_to_exploit_id, 'local_file_reader') + @pytest.mark.deprecated def test_from_template(self): lfit = LocalFileReadTemplate() diff --git a/w3af/plugins/tests/attack/test_os_commanding.py b/w3af/plugins/tests/attack/test_os_commanding.py index 4d63866426..99ec82d27e 100644 --- a/w3af/plugins/tests/attack/test_os_commanding.py +++ b/w3af/plugins/tests/attack/test_os_commanding.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.core.data.kb.vuln_templates.os_commanding_template import OSCommandingTemplate from w3af.plugins.tests.helper import PluginConfig, ExecExploitTest @@ -39,6 +40,7 @@ class TestOSCommandingShell(ExecExploitTest): } } + @pytest.mark.deprecated def test_found_exploit_osc(self): # Run the scan cfg = self._run_configs['cfg'] @@ -90,6 +92,7 @@ def test_found_exploit_osc(self): self.assertIn('execute', _help) self.assertIn('upload', _help) + @pytest.mark.deprecated def test_from_template(self): osct = OSCommandingTemplate() diff --git a/w3af/plugins/tests/attack/test_rfi.py b/w3af/plugins/tests/attack/test_rfi.py index 89e85cf22d..6fa09cc572 100644 --- a/w3af/plugins/tests/attack/test_rfi.py +++ b/w3af/plugins/tests/attack/test_rfi.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginConfig, ExecExploitTest @@ -43,6 +44,7 @@ class TestRFI(ExecExploitTest): } } + @pytest.mark.deprecated def test_found_exploit_rfi(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'] + '?file=abc.txt', cfg['plugins']) @@ -58,6 +60,7 @@ def test_found_exploit_rfi(self): vuln_to_exploit_id = vuln.get_id() self._exploit_vuln(vuln_to_exploit_id, 'rfi') + @pytest.mark.deprecated def test_from_template(self): rfit = RFITemplate() diff --git a/w3af/plugins/tests/attack/test_sqlmap.py b/w3af/plugins/tests/attack/test_sqlmap.py index 962d6e7c7e..b7fbd53d80 100644 --- a/w3af/plugins/tests/attack/test_sqlmap.py +++ b/w3af/plugins/tests/attack/test_sqlmap.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.sqlmap_testenv import get_sqlmap_testenv_http from w3af.core.controllers.ci.moth import get_moth_http @@ -49,6 +50,7 @@ class TestSQLMapShell(ReadExploitTest): } + @pytest.mark.deprecated def test_found_exploit_sqlmap_sqli(self): # Run the scan cfg = self._run_configs['sqli'] @@ -73,6 +75,7 @@ def test_found_exploit_sqlmap_sqli(self): self._exploit_vuln(vuln_to_exploit_id, 'sqlmap') + @pytest.mark.deprecated def test_found_exploit_sqlmap_blind_sqli(self): # Run the scan cfg = self._run_configs['blind_sqli'] @@ -91,6 +94,7 @@ def test_found_exploit_sqlmap_blind_sqli(self): vuln_to_exploit_id = vuln.get_id() self._exploit_vuln(vuln_to_exploit_id, 'sqlmap') + @pytest.mark.deprecated def test_from_template(self): sqlit = SQLiTemplate() @@ -107,6 +111,7 @@ def test_from_template(self): self._exploit_vuln(vuln_to_exploit_id, 'sqlmap') + @pytest.mark.deprecated def test_found_exploit_blind_sqli_form_GET(self): """ Reproduce bug https://github.com/andresriancho/w3af/issues/262 diff --git a/w3af/plugins/tests/attack/test_xpath.py b/w3af/plugins/tests/attack/test_xpath.py index a5fdcdc92f..8171fc5a08 100644 --- a/w3af/plugins/tests/attack/test_xpath.py +++ b/w3af/plugins/tests/attack/test_xpath.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from mock import MagicMock from nose.plugins.attrib import attr @@ -46,6 +47,7 @@ class TestXPathShell(PluginTest): } @attr('fails') + @pytest.mark.deprecated def test_find_exploit_xpath(self): # Run the scan cfg = self._run_configs['cfg'] @@ -63,6 +65,7 @@ def test_find_exploit_xpath(self): self._exploit_xpath(vuln_to_exploit_id) @attr('fails') + @pytest.mark.deprecated def test_from_template(self): xt = XPathTemplate() diff --git a/w3af/plugins/tests/audit/test_all_false_positive.py b/w3af/plugins/tests/audit/test_all_false_positive.py index f9988b4a6b..ab74dac775 100644 --- a/w3af/plugins/tests/audit/test_all_false_positive.py +++ b/w3af/plugins/tests/audit/test_all_false_positive.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -29,6 +30,7 @@ class TestAllFP(PluginTest): target_url = 'http://moth/w3af/core/base_false_positive/' @attr('ci_fails') + @pytest.mark.deprecated def test_false_positive(self): raise SkipTest('FIXME: This test takes too long to run.') diff --git a/w3af/plugins/tests/audit/test_blind_sqli.py b/w3af/plugins/tests/audit/test_blind_sqli.py index 46522a88a2..51b2a0d01f 100644 --- a/w3af/plugins/tests/audit/test_blind_sqli.py +++ b/w3af/plugins/tests/audit/test_blind_sqli.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.tests.helper import PluginTest, PluginConfig from w3af.core.controllers.ci.moth import get_moth_http from w3af.core.controllers.ci.w3af_moth import get_w3af_moth_http @@ -31,6 +32,7 @@ class TestDjangoBlindSQLI(PluginTest): + @pytest.mark.deprecated def test_integer(self): target_url = get_moth_http('/audit/blind_sqli/where_integer_qs.py') qs = '?id=1' @@ -46,11 +48,13 @@ def test_integer(self): self.assertEquals("numeric", vuln['type']) self.assertEquals(target_url, str(vuln.get_url())) + @pytest.mark.deprecated def test_single_quote(self): target_url = get_moth_http('/audit/blind_sqli/where_string_single_qs.py') qs = '?uname=pablo' self._scan_single_quote(target_url, qs) + @pytest.mark.deprecated def test_single_quote_non_true_value_as_init(self): target_url = get_moth_http('/audit/blind_sqli/where_string_single_qs.py') qs = '?uname=foobar39' @@ -69,6 +73,7 @@ def _scan_single_quote(self, target_url, qs): self.assertEquals('string_single', vuln['type']) self.assertEquals(target_url, str(vuln.get_url())) + @pytest.mark.deprecated def test_found_exploit_blind_sqli_form(self): # Run the scan target = get_moth_http('/audit/blind_sqli/blind_where_integer_form.py') @@ -85,6 +90,7 @@ def test_found_exploit_blind_sqli_form(self): self.assertEquals('blind_where_integer_form.py', vuln.get_url().get_file_name()) + @pytest.mark.deprecated def test_found_exploit_blind_sqli_form_GET(self): # Run the scan target = get_moth_http('/audit/blind_sqli/blind_where_integer_form_get.py') @@ -104,6 +110,7 @@ def test_found_exploit_blind_sqli_form_GET(self): class TestReflectedXSSFalsePositive(PluginTest): + @pytest.mark.deprecated def test_xss_false_positive_1516(self): target_url = get_wavsep_http('/wavsep/active/Reflected-XSS/' 'RXSS-Detection-Evaluation-GET/' @@ -127,6 +134,7 @@ class TestOldMothBlindSQLI(PluginTest): ('ignore_regex', '.*(asp|aspx)', PluginConfig.STR)),), } + @pytest.mark.deprecated def test_found_blind_sqli_old_moth(self): expected_path_param = { (u'bsqli_string.php', u'email'), diff --git a/w3af/plugins/tests/audit/test_buffer_overflow.py b/w3af/plugins/tests/audit/test_buffer_overflow.py index ea52ad0d27..85d5e2a982 100644 --- a/w3af/plugins/tests/audit/test_buffer_overflow.py +++ b/w3af/plugins/tests/audit/test_buffer_overflow.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -46,6 +47,7 @@ def get_response(self, http_request, uri, response_headers): } } + @pytest.mark.deprecated def test_found_bo(self): self._scan(self._run_config['target'], self._run_config['plugins']) diff --git a/w3af/plugins/tests/audit/test_cors_origin.py b/w3af/plugins/tests/audit/test_cors_origin.py index 77802df3cd..4ad3e01e60 100644 --- a/w3af/plugins/tests/audit/test_cors_origin.py +++ b/w3af/plugins/tests/audit/test_cors_origin.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -60,6 +61,7 @@ class TestCORSOriginScan(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_scan(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -88,6 +90,7 @@ def setUp(self): self.url, _id=3) self.request = FuzzableRequest(self.url) + @pytest.mark.deprecated def test_allow_methods_no(self): allow_methods = 'GET, POST, Options' allow_origin = 'http://w3af.org/' @@ -100,6 +103,7 @@ def test_allow_methods_no(self): self.assertEqual(vulns, []) + @pytest.mark.deprecated def test_allow_methods_strange(self): allow_methods = 'GET, POST, OPTIONS, FOO' @@ -117,6 +121,7 @@ def test_allow_methods_strange(self): self.assertEqual(vuln.get_name(), 'Uncommon CORS methods enabled') self.assertNotEqual(vuln.get_desc(), None) + @pytest.mark.deprecated def test_allow_methods_sensitive(self): allow_methods = 'GET, POST, OPTIONS, PUT' @@ -134,6 +139,7 @@ def test_allow_methods_sensitive(self): self.assertEqual(vuln.get_name(), 'Sensitive CORS methods enabled') self.assertNotEqual(vuln.get_desc(), None) + @pytest.mark.deprecated def test_allow_methods_sensitive_strange(self): allow_methods = 'GET, POST, OPTIONS, PUT, FOO' @@ -154,6 +160,7 @@ def test_allow_methods_sensitive_strange(self): self.assertIsNotNone(vulns[0].get_desc()) self.assertIsNotNone(vulns[1].get_desc()) + @pytest.mark.deprecated def test_allow_methods_sensitive_call_max(self): allow_methods = 'GET, POST, OPTIONS, PUT' @@ -175,6 +182,7 @@ def test_allow_methods_sensitive_call_max(self): 'Sensitive CORS methods enabled', msg) + @pytest.mark.deprecated def test_universal_allow_not(self): allow_methods = 'GET, POST, OPTIONS' allow_origin = 'http://w3af.org/' @@ -187,6 +195,7 @@ def test_universal_allow_not(self): self.assertEqual(len(vulns), 0, vulns) + @pytest.mark.deprecated def test_universal_allow_yes(self): allow_methods = 'GET, POST, OPTIONS' allow_origin = '*' @@ -204,6 +213,7 @@ def test_universal_allow_yes(self): 'Access-Control-Allow-Origin set to "*"') self.assertNotEqual(vuln.get_desc(), None) + @pytest.mark.deprecated def test_universal_origin_echo_false(self): allow_methods = 'GET, POST, OPTIONS' allow_origin = 'http://www.google.com/' @@ -215,6 +225,7 @@ def test_universal_origin_echo_false(self): self.assertEqual(len(vulns), 0, vulns) + @pytest.mark.deprecated def test_universal_origin_echo_without_credentials(self): allow_methods = 'GET, POST, OPTIONS' allow_origin = 'http://moth/' @@ -231,6 +242,7 @@ def test_universal_origin_echo_without_credentials(self): 'Insecure Access-Control-Allow-Origin') self.assertNotEqual(vuln.get_desc(), None) + @pytest.mark.deprecated def test_universal_origin_echo_with_credentials(self): allow_methods = 'GET, POST, OPTIONS' allow_origin = 'http://moth/' @@ -247,6 +259,7 @@ def test_universal_origin_echo_with_credentials(self): 'Insecure Access-Control-Allow-Origin with credentials') self.assertNotEqual(vuln.get_desc(), None) + @pytest.mark.deprecated def test_universal_origin_allow_creds(self): allow_methods = 'GET, POST, OPTIONS' allow_origin = '*' diff --git a/w3af/plugins/tests/audit/test_csrf.py b/w3af/plugins/tests/audit/test_csrf.py index b0dd0567ae..1f368b62d9 100644 --- a/w3af/plugins/tests/audit/test_csrf.py +++ b/w3af/plugins/tests/audit/test_csrf.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.plugins.tests.helper import PluginTest, PluginConfig, LOREM @@ -59,6 +60,7 @@ def setUp(self): self.uri_opener = ExtendedUrllib() self.csrf_plugin.set_url_opener(self.uri_opener) + @pytest.mark.deprecated def test_found_csrf(self): expected = [ '/w3af/audit/csrf/vulnerable/buy.php', @@ -81,6 +83,7 @@ def test_found_csrf(self): self.assertTrue( all(['CSRF vulnerability' == v.get_name() for v in vulns])) + @pytest.mark.deprecated def test_resp_is_equal(self): url = URL('http://www.w3af.com/') headers = Headers([('content-type', 'text/html')]) @@ -97,6 +100,7 @@ def test_resp_is_equal(self): r2 = HTTPResponse(200, 'a', headers, url, url) self.assertTrue(self.csrf_plugin._is_resp_equal(r1, r2)) + @pytest.mark.deprecated def test_is_suitable(self): url = URL('http://www.w3af.com/') headers = Headers([('content-type', 'text/html')]) @@ -155,6 +159,7 @@ def test_is_suitable(self): suitable = self.csrf_plugin._is_suitable(req, res) self.assertTrue(suitable) + @pytest.mark.deprecated def test_is_origin_checked_true_case01(self): url = URL(get_w3af_moth_http('/w3af/audit/csrf/referer/buy.php?shares=123')) headers = Headers([('Referer', 'http://moth/w3af/audit/csrf/referer/')]) @@ -165,6 +170,7 @@ def test_is_origin_checked_true_case01(self): origin_checked = self.csrf_plugin._is_origin_checked(freq, orig_response, None) self.assertTrue(origin_checked) + @pytest.mark.deprecated def test_is_origin_checked_true_case02(self): url = URL(get_w3af_moth_http('/w3af/audit/csrf/referer-rnd/buy.php?shares=123')) headers = Headers([('Referer', 'http://moth/w3af/audit/csrf/referer-rnd/')]) @@ -175,6 +181,7 @@ def test_is_origin_checked_true_case02(self): origin_checked = self.csrf_plugin._is_origin_checked(freq, orig_response, None) self.assertTrue(origin_checked) + @pytest.mark.deprecated def test_is_origin_checked_false(self): url = URL(get_w3af_moth_http('/w3af/audit/csrf/vulnerable/buy.php?shares=123')) headers = Headers([('Referer', 'http://moth/w3af/audit/csrf/referer-rnd/')]) @@ -185,6 +192,7 @@ def test_is_origin_checked_false(self): origin_checked = self.csrf_plugin._is_origin_checked(freq, orig_response, None) self.assertFalse(origin_checked) + @pytest.mark.deprecated def test_is_token_checked_true(self): generator = URL(get_w3af_moth_http('/w3af/audit/csrf/secure-replay-allowed/')) http_response = self.uri_opener.GET(generator) @@ -204,6 +212,7 @@ def test_is_token_checked_true(self): original_response) self.assertTrue(checked) + @pytest.mark.deprecated def test_is_token_checked_false(self): """ This covers the case where there is a token but for some reason it @@ -244,12 +253,15 @@ def test_is_csrf_token_true_case03(self): def test_is_csrf_token_false_case01(self): self.assertFalse(self.csrf_plugin.is_csrf_token('token', '')) + @pytest.mark.deprecated def test_is_csrf_token_false_case02(self): self.assertFalse(self.csrf_plugin.is_csrf_token('secret', 'helloworld')) + @pytest.mark.deprecated def test_is_csrf_token_false_case03(self): self.assertFalse(self.csrf_plugin.is_csrf_token('secret', 'helloworld123')) + @pytest.mark.deprecated def test_is_csrf_token_false_case04(self): self.assertFalse(self.csrf_plugin.is_csrf_token('secret', 'hello world 123')) @@ -262,6 +274,7 @@ def test_is_csrf_token_false_string_special_chars(self): def test_is_csrf_token_false_unicode(self): self.assertFalse(self.csrf_plugin.is_csrf_token('secret', u'áÄé')) + @pytest.mark.deprecated def test_is_csrf_token_false_case05(self): self.assertTrue(self.csrf_plugin.is_csrf_token('secret', LOREM)) diff --git a/w3af/plugins/tests/audit/test_dav.py b/w3af/plugins/tests/audit/test_dav.py index 9676f00577..e8c432a97e 100644 --- a/w3af/plugins/tests/audit/test_dav.py +++ b/w3af/plugins/tests/audit/test_dav.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -39,6 +40,7 @@ class TestDav(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_found_all_dav(self): cfg = self._run_configs['cfg'] self._scan(self.target_vuln_all, cfg['plugins']) @@ -58,6 +60,7 @@ def test_found_all_dav(self): v.get_url().get_domain_path()) for v in vulns])) @attr('ci_fails') + @pytest.mark.deprecated def test_no_privileges(self): """ DAV is configured but the directory doesn't have the file-system permissions @@ -83,6 +86,7 @@ def test_no_privileges(self): self.assertEquals(self.target_no_privs, vuln_url) @attr('ci_fails') + @pytest.mark.deprecated def test_not_found_dav(self): cfg = self._run_configs['cfg'] self._scan(self.target_safe_all, cfg['plugins']) diff --git a/w3af/plugins/tests/audit/test_deserialization.py b/w3af/plugins/tests/audit/test_deserialization.py index ee33aff858..5fe496058a 100644 --- a/w3af/plugins/tests/audit/test_deserialization.py +++ b/w3af/plugins/tests/audit/test_deserialization.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import re import json @@ -70,6 +71,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [DeserializeMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_deserialization_in_pickle(self): self._scan(self.target_url, test_config) vulns = self.kb.get('deserialization', 'deserialization') @@ -104,6 +106,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [DeserializeMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_deserialization_in_pickle(self): self._scan(self.target_url, test_config) vulns = self.kb.get('deserialization', 'deserialization') @@ -144,6 +147,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [DeserializeMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_deserialization_in_pickle(self): self._scan(self.target_url, test_config) vulns = self.kb.get('deserialization', 'deserialization') diff --git a/w3af/plugins/tests/audit/test_eval.py b/w3af/plugins/tests/audit/test_eval.py index 8009cb778b..a63f5beff6 100644 --- a/w3af/plugins/tests/audit/test_eval.py +++ b/w3af/plugins/tests/audit/test_eval.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.core.controllers.ci.mcir import get_mcir_http from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -50,6 +51,7 @@ class TestEval(PluginTest): } } + @pytest.mark.deprecated def test_found_eval_echo(self): cfg = self._run_configs['echo'] self._scan(cfg['target'], cfg['plugins']) @@ -64,6 +66,7 @@ def test_found_eval_echo(self): self.assertEquals("text", vuln.get_token_name()) self.assertEquals(self.target_echo, str(vuln.get_url())) + @pytest.mark.deprecated def test_found_eval_delay(self): cfg = self._run_configs['delay'] self._scan(cfg['target'], cfg['plugins']) @@ -96,6 +99,7 @@ class TestPHPEchoEval(PluginTest): ('use_time_delay', False, PluginConfig.BOOL)),), } + @pytest.mark.deprecated def test_found_eval_echo_php(self): self._scan(self.target, self.config) @@ -126,6 +130,7 @@ class TestPHPSleepEval(PluginTest): ('use_time_delay', True, PluginConfig.BOOL)),), } + @pytest.mark.deprecated def test_found_eval_echo_php(self): self._scan(self.target, self.config) diff --git a/w3af/plugins/tests/audit/test_file_upload.py b/w3af/plugins/tests/audit/test_file_upload.py index c04f7774d8..72e1b0d21b 100644 --- a/w3af/plugins/tests/audit/test_file_upload.py +++ b/w3af/plugins/tests/audit/test_file_upload.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from mock import patch from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -70,6 +71,7 @@ class TestFileUpload(PluginTest): }, } + @pytest.mark.deprecated def test_reported_file_uploads(self): cfg = self._run_configs['basic'] self._scan(cfg['target'], cfg['plugins']) @@ -82,6 +84,7 @@ def test_reported_file_uploads(self): self.assertEquals(str(v.get_url().get_domain_path()), self.file_upload_url) + @pytest.mark.deprecated def test_reported_file_uploads_issue_534(self): # https://github.com/andresriancho/w3af/issues/534 cfg = self._run_configs['crawling'] @@ -148,6 +151,7 @@ class TestParseOutputFromUpload(PluginTest): } } + @pytest.mark.deprecated def test_parse_response(self): cfg = self._run_configs['cfg'] @@ -200,6 +204,7 @@ class TestRegexOutputFromUpload(TestParseOutputFromUpload): method='GET', status=200), ] + @pytest.mark.deprecated def test_parse_response(self): with patch(self.FILENAME_RAND_ALPHA) as rand_alpha_mock: rand_alpha_mock.return_value = 'mockname' diff --git a/w3af/plugins/tests/audit/test_format_string.py b/w3af/plugins/tests/audit/test_format_string.py index 2a4d52eade..a8a02fd6d3 100644 --- a/w3af/plugins/tests/audit/test_format_string.py +++ b/w3af/plugins/tests/audit/test_format_string.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -37,6 +38,7 @@ class TestFormatString(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_found_format(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/audit/test_frontpage.py b/w3af/plugins/tests/audit/test_frontpage.py index 5b5cfb6f7b..dd042c79f1 100644 --- a/w3af/plugins/tests/audit/test_frontpage.py +++ b/w3af/plugins/tests/audit/test_frontpage.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from mock import patch from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -50,6 +51,7 @@ class TestFrontpage(PluginTest): } } + @pytest.mark.deprecated def test_upload(self): cfg = self._run_configs['cfg'] diff --git a/w3af/plugins/tests/audit/test_generic.py b/w3af/plugins/tests/audit/test_generic.py index d1893414da..3d184a1e98 100644 --- a/w3af/plugins/tests/audit/test_generic.py +++ b/w3af/plugins/tests/audit/test_generic.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import urllib @@ -44,6 +45,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [GenericErrorMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_generic(self): self._scan(self.target_url, self.CONFIG) @@ -78,6 +80,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [GenericErrorMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_generic_extensive(self): self._scan(self.target_url, self.CONFIG) @@ -112,6 +115,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [SQLIMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_sqli_not_generic(self): self._scan(self.target_url, self.CONFIG) diff --git a/w3af/plugins/tests/audit/test_global_redirect.py b/w3af/plugins/tests/audit/test_global_redirect.py index 05564dea9e..6f5063e874 100644 --- a/w3af/plugins/tests/audit/test_global_redirect.py +++ b/w3af/plugins/tests/audit/test_global_redirect.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from unittest import TestCase from w3af.core.controllers.ci.moth import get_moth_http @@ -48,6 +49,7 @@ class TestGlobalRedirect(PluginTest): target_url = get_moth_http('/audit/global_redirect/') + @pytest.mark.deprecated def test_found_redirect(self): cfg = SCAN_CONFIG['cfg'] cfg['target'] = self.target_url @@ -82,6 +84,7 @@ class TestGlobalRedirectBasic(PluginTest): headers={'Location': 'https://www.w3af.org/'}, body='')] + @pytest.mark.deprecated def test_original_response_has_no_redirect(self): cfg = SCAN_CONFIG['cfg'] cfg['target'] = self.target_url @@ -106,6 +109,7 @@ class TestGlobalRedirectBasicWithMetaRedir(PluginTest): MockResponse('http://httpretty/redir?target=http://www.w3af.org/', body='')] + @pytest.mark.deprecated def test_original_response_has_meta_redirect(self): cfg = SCAN_CONFIG['cfg'] cfg['target'] = self.target_url @@ -134,6 +138,7 @@ class TestGlobalRedirectExtendedPayloadSet(PluginTest): headers={'Location': 'httpretty.w3af.org'}, body='')] + @pytest.mark.deprecated def test_original_response_has_redirect(self): cfg = SCAN_CONFIG['cfg'] cfg['target'] = self.target_url @@ -208,6 +213,7 @@ def test_response_has_redirect_headers(self): self.assertTrue(plugin._response_has_redirect(resp)) + @pytest.mark.deprecated def test_response_has_redirect_meta(self): plugin = global_redirect() @@ -238,6 +244,7 @@ def test_response_has_redirect_js_2(self): self.assertTrue(plugin._response_has_redirect(resp)) + @pytest.mark.deprecated def test_response_has_redirect_js_false(self): plugin = global_redirect() @@ -248,6 +255,7 @@ def test_response_has_redirect_js_false(self): self.assertFalse(plugin._response_has_redirect(resp)) + @pytest.mark.deprecated def test_response_has_redirect_headers_false(self): plugin = global_redirect() diff --git a/w3af/plugins/tests/audit/test_htaccess_methods.py b/w3af/plugins/tests/audit/test_htaccess_methods.py index 272b15740e..2c3b5ad223 100644 --- a/w3af/plugins/tests/audit/test_htaccess_methods.py +++ b/w3af/plugins/tests/audit/test_htaccess_methods.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -45,6 +46,8 @@ class TestHTAccess(PluginTest): MockResponse(target_url, 'Hidden treasure', method='POST', status=200)] + @pytest.mark.deprecated + @pytest.mark.deprecated def test_found_htaccess_methods(self): cfg = RUN_CONFIG['cfg'] self._scan(self.target_url, cfg['plugins']) @@ -67,6 +70,8 @@ class TestHTAccessFalsePositiveGeneric(PluginTest): MockResponse(target_url, 'Bad credentials', method='POST', status=403)] + @pytest.mark.deprecated + @pytest.mark.deprecated def test_false_positive(self): cfg = RUN_CONFIG['cfg'] self._scan(self.target_url, cfg['plugins']) @@ -75,12 +80,14 @@ def test_false_positive(self): self.assertEquals(0, len(vulns)) +@pytest.mark.deprecated class TestHTaccessCheck1915_1(TestHTAccessFalsePositiveGeneric): # https://github.com/andresriancho/w3af/issues/1915 MOCK_RESPONSES = [MockResponse(TestHTAccessFalsePositiveGeneric.target_url, 'Bad credentials', method='GET', status=401)] +@pytest.mark.deprecated class TestHTaccessCheck1915_2(TestHTAccessFalsePositiveGeneric): # https://github.com/andresriancho/w3af/issues/1915 MOCK_RESPONSES = [MockResponse(TestHTAccessFalsePositiveGeneric.target_url, diff --git a/w3af/plugins/tests/audit/test_ldapi.py b/w3af/plugins/tests/audit/test_ldapi.py index 142d024201..9453dc6ca7 100644 --- a/w3af/plugins/tests/audit/test_ldapi.py +++ b/w3af/plugins/tests/audit/test_ldapi.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -37,6 +38,7 @@ class TestLDAPI(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_found_ldapi(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/audit/test_lfi.py b/w3af/plugins/tests/audit/test_lfi.py index ec07786847..497f84e82c 100644 --- a/w3af/plugins/tests/audit/test_lfi.py +++ b/w3af/plugins/tests/audit/test_lfi.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.core.controllers.ci.wavsep import get_wavsep_http from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -37,6 +38,7 @@ class TestLFI(PluginTest): target_url = get_moth_http('/audit/local_file_read/') + @pytest.mark.deprecated def test_found_lfi(self): self._scan(self.target_url, CONFIG) @@ -59,6 +61,7 @@ class TestWAVSEP500Error(PluginTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_find_lfi_wavsep_error(self): expected_path_param = { (u'Case01-LFI-FileClass-FilenameContext-Unrestricted-OSPath-DefaultFullInput-AnyPathReq-Read.jsp', u'target'), diff --git a/w3af/plugins/tests/audit/test_memcachei.py b/w3af/plugins/tests/audit/test_memcachei.py index 624b7b5e1d..850d2fc39a 100644 --- a/w3af/plugins/tests/audit/test_memcachei.py +++ b/w3af/plugins/tests/audit/test_memcachei.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.tests.helper import PluginTest, PluginConfig from w3af.core.controllers.ci.moth import get_moth_http @@ -35,6 +36,7 @@ class TestMemcachei(PluginTest): } } + @pytest.mark.deprecated def test_found_memcachei(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/audit/test_mx_injection.py b/w3af/plugins/tests/audit/test_mx_injection.py index 1264a5e0e8..2548e89a53 100644 --- a/w3af/plugins/tests/audit/test_mx_injection.py +++ b/w3af/plugins/tests/audit/test_mx_injection.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -37,6 +38,7 @@ class TestMXInjection(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_found_mxi(self): # Run the scan cfg = self._run_configs['cfg'] diff --git a/w3af/plugins/tests/audit/test_os_commanding.py b/w3af/plugins/tests/audit/test_os_commanding.py index 71ccfdf353..077a63f22e 100644 --- a/w3af/plugins/tests/audit/test_os_commanding.py +++ b/w3af/plugins/tests/audit/test_os_commanding.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -39,6 +40,7 @@ class TestOSCommanding(PluginTest): } } + @pytest.mark.deprecated def test_found_osc(self): # Run the scan cfg = self._run_configs['cfg'] diff --git a/w3af/plugins/tests/audit/test_phishing_vector.py b/w3af/plugins/tests/audit/test_phishing_vector.py index 4e654e3abb..d0553b36d4 100644 --- a/w3af/plugins/tests/audit/test_phishing_vector.py +++ b/w3af/plugins/tests/audit/test_phishing_vector.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -41,6 +42,7 @@ class TestPhishingVector(PluginTest): }, } + @pytest.mark.deprecated def test_found_phishing_vector(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/audit/test_preg_replace.py b/w3af/plugins/tests/audit/test_preg_replace.py index 95a14887c7..5835ef06d9 100644 --- a/w3af/plugins/tests/audit/test_preg_replace.py +++ b/w3af/plugins/tests/audit/test_preg_replace.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -42,6 +43,7 @@ class TestPreg(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_found_preg(self): # Run the scan cfg = self._run_configs['cfg'] diff --git a/w3af/plugins/tests/audit/test_redos.py b/w3af/plugins/tests/audit/test_redos.py index 0f4b950a6b..7a54b0401e 100644 --- a/w3af/plugins/tests/audit/test_redos.py +++ b/w3af/plugins/tests/audit/test_redos.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import time @@ -62,6 +63,7 @@ class TestREDoS(PluginTest): body='dummy'), ] + @pytest.mark.deprecated def test_found_redos(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -90,6 +92,7 @@ class TestREDoSNegative(PluginTest): delay=0.1), ] + @pytest.mark.deprecated def test_found_redos(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/audit/test_response_splitting.py b/w3af/plugins/tests/audit/test_response_splitting.py index 6870da84b9..a15e8499ef 100644 --- a/w3af/plugins/tests/audit/test_response_splitting.py +++ b/w3af/plugins/tests/audit/test_response_splitting.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import urllib @@ -68,6 +69,7 @@ class TestResponseSplitting(PluginTest): }, } + @pytest.mark.deprecated def test_found_response_splitting(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -126,6 +128,7 @@ class TestResponseSplittingParameterModifiesResponse(PluginTest): }, } + @pytest.mark.deprecated def test_found_response_splitting_modifies_response(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -181,6 +184,7 @@ class TestResponseSplittingHeader(PluginTest): }, } + @pytest.mark.deprecated def test_response_splitting_headers(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], diff --git a/w3af/plugins/tests/audit/test_rfd.py b/w3af/plugins/tests/audit/test_rfd.py index 72ebaca70f..754da8c4c4 100644 --- a/w3af/plugins/tests/audit/test_rfd.py +++ b/w3af/plugins/tests/audit/test_rfd.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse RUN_CONFIG = { @@ -57,6 +58,7 @@ class TestJSONAllFiltered(PluginTest): method='GET', status=200), ] + @pytest.mark.deprecated def test_not_found_json_all_filtered(self): cfg = RUN_CONFIG['cfg'] self._scan(self.target_url, cfg['plugins']) @@ -85,6 +87,7 @@ class TestJSON(PluginTest): method='GET', status=200), ] + @pytest.mark.deprecated def test_found_json(self): cfg = RUN_CONFIG['cfg'] self._scan(self.target_url, cfg['plugins']) @@ -113,6 +116,7 @@ class TestJSONDobleQuotesFiltered(PluginTest): method='GET', status=200), ] + @pytest.mark.deprecated def test_not_found_json(self): cfg = RUN_CONFIG['cfg'] self._scan(self.target_url, cfg['plugins']) @@ -139,6 +143,7 @@ class TestJSONP(PluginTest): method='GET', status=200), ] + @pytest.mark.deprecated def test_found_jsonp(self): cfg = RUN_CONFIG['cfg'] self._scan(self.target_url, cfg['plugins']) diff --git a/w3af/plugins/tests/audit/test_rfi.py b/w3af/plugins/tests/audit/test_rfi.py index 0eae17ea31..f558e222d2 100644 --- a/w3af/plugins/tests/audit/test_rfi.py +++ b/w3af/plugins/tests/audit/test_rfi.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import urllib2 import threading @@ -73,6 +74,7 @@ class TestRFI(PluginTest): } + @pytest.mark.deprecated def test_found_rfi_with_w3af_site(self): cfg = self._run_configs['remote_rce'] self._scan(cfg['target'], cfg['plugins']) @@ -86,6 +88,7 @@ def test_found_rfi_with_w3af_site(self): self.assertEquals(self.target_rce, vuln.get_url().url_string) @attr('smoke') + @pytest.mark.deprecated def test_found_rfi_with_local_server_rce(self): cfg = self._run_configs['local_rce'] self._scan(cfg['target'], cfg['plugins']) @@ -98,6 +101,7 @@ def test_found_rfi_with_local_server_rce(self): self.assertEquals("Remote code execution", vuln.get_name()) self.assertEquals(self.target_rce, vuln.get_url().url_string) + @pytest.mark.deprecated def test_found_rfi_with_local_server_read(self): cfg = self._run_configs['local_read'] self._scan(cfg['target'], cfg['plugins']) @@ -110,6 +114,7 @@ def test_found_rfi_with_local_server_read(self): self.assertEquals("Remote file inclusion", vuln.get_name()) self.assertEquals(self.target_read, vuln.get_url().url_string) + @pytest.mark.deprecated def test_found_rfi_with_remote_server_read(self): cfg = self._run_configs['remote_read'] self._scan(cfg['target'], cfg['plugins']) @@ -122,6 +127,7 @@ def test_found_rfi_with_remote_server_read(self): self.assertEquals("Remote file inclusion", vuln.get_name()) self.assertEquals(self.target_read, vuln.get_url().url_string) + @pytest.mark.deprecated def test_custom_web_server(self): RFIWebHandler.RESPONSE_BODY = '' ws = HTTPServer(('127.0.0.1', 0), '.', RFIWebHandler) diff --git a/w3af/plugins/tests/audit/test_rosetta_flash.py b/w3af/plugins/tests/audit/test_rosetta_flash.py index 3efb0f4e68..4a7d00fafc 100644 --- a/w3af/plugins/tests/audit/test_rosetta_flash.py +++ b/w3af/plugins/tests/audit/test_rosetta_flash.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -51,6 +52,7 @@ def get_response(self, http_request, uri, response_headers): method='GET', status=200, content_type='application/javascript')] + @pytest.mark.deprecated def test_found_rosetta_flash(self): self._scan(self.target_url, CONFIG) vulns = self.kb.get('rosetta_flash', 'rosetta_flash') @@ -91,6 +93,7 @@ def get_response(self, http_request, uri, response_headers): method='GET', status=200, content_type='application/javascript')] + @pytest.mark.deprecated def test_not_found_rosetta_flash(self): self._scan(self.target_url, CONFIG) vulns = self.kb.get('rosetta_flash', 'rosetta_flash') diff --git a/w3af/plugins/tests/audit/test_shell_shock.py b/w3af/plugins/tests/audit/test_shell_shock.py index fcb6098d6d..5e706369b1 100644 --- a/w3af/plugins/tests/audit/test_shell_shock.py +++ b/w3af/plugins/tests/audit/test_shell_shock.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -47,6 +48,7 @@ class BasicShellShockTest(PluginTest): status=200, headers={'shellshock': 'check'})] + @pytest.mark.deprecated def test_shell_shock_basic(self): cfg = RUN_CONFIG['cfg'] self._scan(self.target_url, cfg['plugins']) @@ -64,6 +66,7 @@ class BasicNegativeShellShockTest(PluginTest): method='GET', status=200)] + @pytest.mark.deprecated def test_shell_shock_basic(self): cfg = RUN_CONFIG['cfg'] self._scan(self.target_url, cfg['plugins']) diff --git a/w3af/plugins/tests/audit/test_sqli.py b/w3af/plugins/tests/audit/test_sqli.py index 2d8ca36fba..5e04a2a77b 100644 --- a/w3af/plugins/tests/audit/test_sqli.py +++ b/w3af/plugins/tests/audit/test_sqli.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -40,6 +41,7 @@ class TestSQLI(PluginTest): } } + @pytest.mark.deprecated def test_found_sqli(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -67,6 +69,7 @@ class TestSQLMapTestEnv(PluginTest): ('ignore_regex', '.*(asp|aspx)', PluginConfig.STR)),), } + @pytest.mark.deprecated def test_found_sqli_in_testenv(self): """ SqlMap's testenv is a rather strange test application since it doesn't @@ -166,6 +169,7 @@ class TestWAVSEPError(WAVSEPTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_found_sqli_wavsep_error(self): expected_path_param = { # These are detected using sql injection errors: @@ -214,6 +218,7 @@ class TestWAVSEP500Error(WAVSEPTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_found_sqli_wavsep_error(self): expected_path_param = { (u'Case01-InjectionInLogin-String-LoginBypass-WithErrors.jsp', u'username'), @@ -257,6 +262,7 @@ class TestWAVSEPWithDifferentiation(WAVSEPTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_found_sqli_wavsep_differentiation(self): expected_path_param = { (u'Case01-InjectionInLogin-String-LoginBypass-WithDifferent200Responses.jsp', u'username'), @@ -300,6 +306,7 @@ class TestWAVSEPIdentical(WAVSEPTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_found_sqli_wavsep_identical(self): expected_path_param = { (u'Case01-InjectionInView-Numeric-Blind-200ValidResponseWithDefaultOnException.jsp', u'transactionId'), @@ -331,6 +338,7 @@ class TestWAVSEPExperimental(WAVSEPTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_found_sqli_wavsep_experimental(self): expected_path_param = { (u'Case01-InjectionInInsertValues-String-BinaryDeliberateRuntimeError-With200Errors.jsp', u'target'), @@ -356,6 +364,7 @@ class TestWAVSEPError500POST(WAVSEPTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_found_sqli_wavsep_error_500_post(self): expected_path_param = { (u'Case01-InjectionInLogin-String-LoginBypass-WithErrors.jsp', u'username'), @@ -398,6 +407,7 @@ class TestWAVSEPError200POST(WAVSEPTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_found_sqli_wavsep_error_200_post(self): expected_path_param = { (u'Case01-InjectionInLogin-String-LoginBypass-With200Errors.jsp', u'password'), @@ -441,6 +451,7 @@ class TestWAVSEPWithDifferentiationPOST(WAVSEPTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_found_sqli_wavsep_differentiation_post(self): expected_path_param = { (u'Case01-InjectionInLogin-String-LoginBypass-WithDifferent200Responses.jsp', u'username'), @@ -484,6 +495,7 @@ class TestWAVSEPIdenticalPOST(WAVSEPTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_found_sqli_wavsep_identical_post(self): expected_path_param = { (u'Case01-InjectionInView-Numeric-Blind-200ValidResponseWithDefaultOnException.jsp', u'transactionId'), @@ -515,6 +527,7 @@ class TestWAVSEPExperimentalPOST(WAVSEPTest): target_url = get_wavsep_http(base_path) + @pytest.mark.deprecated def test_found_sqli_wavsep_experimental_post(self): expected_path_param = { (u'Case01-InjectionInInsertValues-String-BinaryDeliberateRuntimeError-With200Errors.jsp', u'target'), diff --git a/w3af/plugins/tests/audit/test_ssi.py b/w3af/plugins/tests/audit/test_ssi.py index 4b38e37e81..3b89b7b5fe 100644 --- a/w3af/plugins/tests/audit/test_ssi.py +++ b/w3af/plugins/tests/audit/test_ssi.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import urllib from jinja2 import Template @@ -55,6 +56,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [SSIMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_ssi(self): self._scan(self.target_url, test_config) vulns = self.kb.get('ssi', 'ssi') @@ -84,6 +86,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [SSIMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_ssi(self): self._scan(self.target_url, test_config) vulns = self.kb.get('ssi', 'ssi') diff --git a/w3af/plugins/tests/audit/test_ssl_certificate.py b/w3af/plugins/tests/audit/test_ssl_certificate.py index a02d5eac3e..b08767fe68 100644 --- a/w3af/plugins/tests/audit/test_ssl_certificate.py +++ b/w3af/plugins/tests/audit/test_ssl_certificate.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from nose.plugins.attrib import attr @@ -43,6 +44,7 @@ class TestSSLCertificate(PluginTest): } } + @pytest.mark.deprecated def test_ssl_certificate_local(self): # Start the HTTPS server certfile = os.path.join(ROOT_PATH, 'plugins', 'tests', 'audit', @@ -71,6 +73,7 @@ def test_ssl_certificate_local(self): self.assertEquals(self.local_target_url % port, str(vuln.get_url())) @attr('internet') + @pytest.mark.deprecated def test_ssl_certificate_yandex(self): cfg = self._run_configs['cfg'] self._scan(self.remote_url, cfg['plugins']) @@ -90,6 +93,7 @@ def test_ssl_certificate_yandex(self): self.assertIn(estring, info.get_desc()) @attr('internet') + @pytest.mark.deprecated def test_ssl_certificate_api_mercadopago_com(self): api_url = 'https://api.mercadopago.com/' diff --git a/w3af/plugins/tests/audit/test_un_ssl.py b/w3af/plugins/tests/audit/test_un_ssl.py index fc131e83b5..0c33ed21d9 100644 --- a/w3af/plugins/tests/audit/test_un_ssl.py +++ b/w3af/plugins/tests/audit/test_un_ssl.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import httpretty from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -43,6 +44,7 @@ def setUp(self): super(TestUnSSL, self).setUp() self._register_httpretty_uri('https', 'httpretty', 443) + @pytest.mark.deprecated def test_found_unssl(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -73,6 +75,7 @@ class TestNotFoundUnSSL(PluginTest): } @httpretty.activate + @pytest.mark.deprecated def test_not_found_unssl(self): httpretty.register_uri(httpretty.GET, self.target_url, body='This is NOT SECURE') diff --git a/w3af/plugins/tests/audit/test_websocket_hijacking.py b/w3af/plugins/tests/audit/test_websocket_hijacking.py index 7fab57acc1..b94be2d228 100644 --- a/w3af/plugins/tests/audit/test_websocket_hijacking.py +++ b/w3af/plugins/tests/audit/test_websocket_hijacking.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.data.parsers.doc.url import URL from w3af.core.data.kb.info import Info from w3af.plugins.grep.websockets_links import WebSocketInfoSet @@ -92,6 +93,7 @@ class OpenWebSocketsTest(WebSocketTest): status=101, headers=SUCCESSFUL_UPGRADE)] + @pytest.mark.deprecated def test_open_websockets(self): self.verify_found(['Open WebSocket']) @@ -106,6 +108,7 @@ class NoWebSocketTest(WebSocketTest): method='GET', status=200)] + @pytest.mark.deprecated def test_no_websockets(self): self.verify_found([]) @@ -129,6 +132,7 @@ def matches(self, http_request, uri, response_headers): status=101, headers=SUCCESSFUL_UPGRADE)] + @pytest.mark.deprecated def test_origin_match_bug_websockets(self): self.verify_found(['Insecure WebSocket Origin filter']) @@ -152,6 +156,7 @@ def matches(self, http_request, uri, response_headers): status=101, headers=SUCCESSFUL_UPGRADE)] + @pytest.mark.deprecated def test_origin_match_test_websockets(self): self.verify_found(['Origin restricted WebSocket']) @@ -179,6 +184,7 @@ def setup_basic_authentication(self): self.w3afcore.uri_opener.settings.set_basic_auth(URL('websocket.com'), 'user1', 'password') + @pytest.mark.deprecated def test_basic_auth_websockets(self): self.setup_basic_authentication() self.verify_found(['Websockets CSRF vulnerability']) @@ -208,6 +214,7 @@ def matches(self, http_request, uri, response_headers): method='GET', status=None)] + @pytest.mark.deprecated def test_cookie_auth_websockets(self): self.verify_found(['Websockets CSRF vulnerability']) @@ -246,6 +253,7 @@ class OpenWebSocketsWithCrawlTest(WebSocketTest): status=101, headers=SUCCESSFUL_UPGRADE)] + @pytest.mark.deprecated def test_open_websockets_with_crawl(self): # Run the plugin cfg = ALL_RUN_CONFIG['cfg'] diff --git a/w3af/plugins/tests/audit/test_xpath.py b/w3af/plugins/tests/audit/test_xpath.py index cae7b50f35..29bdd694ad 100644 --- a/w3af/plugins/tests/audit/test_xpath.py +++ b/w3af/plugins/tests/audit/test_xpath.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.tests.helper import PluginTest, PluginConfig from w3af.core.controllers.ci.moth import get_moth_http @@ -40,6 +41,7 @@ class TestXPATH(PluginTest): } } + @pytest.mark.deprecated def test_found_xpath(self): # Run the scan cfg = self._run_configs['cfg'] diff --git a/w3af/plugins/tests/audit/test_xss.py b/w3af/plugins/tests/audit/test_xss.py index df200fd324..c946f315ef 100644 --- a/w3af/plugins/tests/audit/test_xss.py +++ b/w3af/plugins/tests/audit/test_xss.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from unittest import TestCase @@ -106,6 +107,7 @@ def normalize_expected_data(self, target_url, expected): return expected_data @attr('smoke') + @pytest.mark.deprecated def test_find_one_xss(self): """ Simplest possible test to verify that we identify XSSs. @@ -125,6 +127,7 @@ def test_find_one_xss(self): set(kb_data), ) + @pytest.mark.deprecated def test_2919_javascript_src_frame(self): """ https://github.com/andresriancho/w3af/issues/2919 @@ -146,6 +149,7 @@ def test_2919_javascript_src_frame(self): set(kb_data), ) + @pytest.mark.deprecated def test_no_false_positive_499(self): """ Avoiding false positives in the case where the payload is echoed back @@ -165,6 +169,7 @@ def scan_file_upload_fuzz_files(self): target_path = get_php_moth_http('/audit/file_upload/echo_content/') self._scan(target_path, cfg['plugins']) + @pytest.mark.deprecated def test_user_configured_find_in_file_upload_content(self): """ Do not send file content mutants unless the user configures it. @@ -182,6 +187,7 @@ def test_user_configured_find_in_file_upload_content(self): xss_vulns = self.kb.get('xss', 'xss') self.assertEqual(len(xss_vulns), 0, xss_vulns) + @pytest.mark.deprecated def test_find_in_file_upload_content(self): """ Find XSS in the content of an uploaded file @@ -201,6 +207,7 @@ def test_find_in_file_upload_content(self): set(kb_data), ) + @pytest.mark.deprecated def test_found_xss(self): cfg = self._run_configs['cfg'] self._scan(self.XSS_PATH, cfg['plugins']) @@ -257,6 +264,7 @@ def test_found_xss(self): csp_vulns) @attr('ci_fails') + @pytest.mark.deprecated def test_found_xss_with_redirect(self): cfg = self._run_configs['cfg'] self._scan(self.XSS_302_URL, cfg['plugins']) @@ -281,6 +289,7 @@ def test_found_xss_with_redirect(self): set(kb_data), ) + @pytest.mark.deprecated def test_found_wavsep_get_xss(self): cfg = self._run_configs['cfg'] self._scan(self.WAVSEP_PATH, cfg['plugins']) diff --git a/w3af/plugins/tests/audit/test_xst.py b/w3af/plugins/tests/audit/test_xst.py index 16c9e5ef23..92c4d66db7 100644 --- a/w3af/plugins/tests/audit/test_xst.py +++ b/w3af/plugins/tests/audit/test_xst.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -35,6 +36,7 @@ class TestXST(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_found_xst(self): self._scan(self._run_config['target'], self._run_config['plugins']) diff --git a/w3af/plugins/tests/audit/test_xxe.py b/w3af/plugins/tests/audit/test_xxe.py index 35281c5e39..97805126a9 100644 --- a/w3af/plugins/tests/audit/test_xxe.py +++ b/w3af/plugins/tests/audit/test_xxe.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re import urllib @@ -57,6 +58,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [XXEMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_xxe(self): self._scan(self.target_url, test_config) vulns = self.kb.get('xxe', 'xxe') @@ -109,6 +111,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [XXEMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_xxe_with_remote(self): # Use this mock to make sure that the vulnerability is found using @@ -153,6 +156,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [XXEMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_not_found_xxe(self): self._scan(self.target_url, test_config) errors = self.kb.get('xxe', 'errors') @@ -193,6 +197,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [XXEMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_not_found_xxe(self): self._scan(self.target_url, test_config) errors = self.kb.get('xxe', 'errors') @@ -238,6 +243,7 @@ def get_response(self, http_request, uri, response_headers): MOCK_RESPONSES = [XXEMockResponse(re.compile('.*'), body=None, method='GET', status=200)] + @pytest.mark.deprecated def test_found_xxe(self): self._scan(self.target_url, test_config) vulns = self.kb.get('xxe', 'xxe') diff --git a/w3af/plugins/tests/auth/test_autocomplete.py b/w3af/plugins/tests/auth/test_autocomplete.py index de7f5a4060..f7c3a2ee1e 100644 --- a/w3af/plugins/tests/auth/test_autocomplete.py +++ b/w3af/plugins/tests/auth/test_autocomplete.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from httpretty import httpretty @@ -139,6 +140,7 @@ class TestAutocomplete(PluginTest): } } + @pytest.mark.deprecated def test_find_form_submit_csrf_token(self): self._scan(self._run_config['target'], self._run_config['plugins']) @@ -198,6 +200,7 @@ class TestAutocompleteInvalidCredentials(PluginTest): } } + @pytest.mark.deprecated def test_handle_invalid_credentials(self): self._scan(self._run_config['target'], self._run_config['plugins']) @@ -224,6 +227,7 @@ def test_handle_invalid_credentials(self): class TestAutocompleteAuthenticationFailure(unittest.TestCase): + @pytest.mark.deprecated def test_consecutive_authentication_failure(self): plugin = autocomplete() kb.kb.cleanup() @@ -254,6 +258,7 @@ def test_consecutive_authentication_failure(self): self.assertEqual(info.get_desc(with_id=False), expected_desc) self.assertEqual(info.get_id(), []) + @pytest.mark.deprecated def test_mixed_authentication_results(self): plugin = autocomplete() kb.kb.cleanup() @@ -271,6 +276,7 @@ def test_mixed_authentication_results(self): infos = kb.kb.get('authentication', 'error') self.assertEqual(len(infos), 0) + @pytest.mark.deprecated def test_mixed_authentication_results_fail_fail_success(self): plugin = autocomplete() kb.kb.cleanup() diff --git a/w3af/plugins/tests/auth/test_detailed.py b/w3af/plugins/tests/auth/test_detailed.py index 3e416a9408..255bf0b02c 100644 --- a/w3af/plugins/tests/auth/test_detailed.py +++ b/w3af/plugins/tests/auth/test_detailed.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from httpretty import httpretty import w3af.core.data.kb.knowledge_base as kb @@ -58,6 +59,7 @@ class TestDetailedBasic(PluginTest): } } + @pytest.mark.deprecated def test_post_auth_xss(self): self._scan(self._run_config['target'], self._run_config['plugins']) @@ -100,6 +102,7 @@ class TestDetailedFailAuth(PluginTest): } } + @pytest.mark.deprecated def test_failed_login_invalid_password(self): self._scan(self._run_config['target'], self._run_config['plugins']) @@ -163,6 +166,7 @@ class TestDetailedRedirect(PluginTest): } } + @pytest.mark.deprecated def test_redirect_login(self): self._scan(self._run_config['target'], self._run_config['plugins']) @@ -225,6 +229,7 @@ class TestDetailedRedirectLoop(PluginTest): } } + @pytest.mark.deprecated def test_redirect_loop_in_login(self): """ The main test here is that the plugin finishes @@ -282,6 +287,7 @@ class TestDetailedSquareBrackets(PluginTest): } } + @pytest.mark.deprecated def test_post_auth_xss(self): self._scan(self._run_config['target'], self._run_config['plugins']) diff --git a/w3af/plugins/tests/auth/test_generic.py b/w3af/plugins/tests/auth/test_generic.py index c127643573..d853b93da9 100644 --- a/w3af/plugins/tests/auth/test_generic.py +++ b/w3af/plugins/tests/auth/test_generic.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.skip import SkipTest from nose.plugins.attrib import attr @@ -86,6 +87,7 @@ class TestGeneric(PluginTest): } @attr('smoke') + @pytest.mark.deprecated def test_post_auth_xss(self): self._scan(self._run_config['target'], self._run_config['plugins']) @@ -101,6 +103,7 @@ def test_post_auth_xss(self): @attr('internet') @attr('fails') + @pytest.mark.deprecated def test_demo_testfire_net(self): # We don't control the demo.testfire.net domain, so we'll check if its # up before doing anything else diff --git a/w3af/plugins/tests/bruteforce/test_basic_auth.py b/w3af/plugins/tests/bruteforce/test_basic_auth.py index afc09f6cff..3ef352f744 100644 --- a/w3af/plugins/tests/bruteforce/test_basic_auth.py +++ b/w3af/plugins/tests/bruteforce/test_basic_auth.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from nose.plugins.attrib import attr @@ -67,6 +68,7 @@ class TestBasicAuth(PluginTest): } @attr('smoke') + @pytest.mark.deprecated def test_found_credentials(self): # Run the scan cfg = self._run_configs['positive'] @@ -84,6 +86,7 @@ def test_found_credentials(self): self.assertEquals(vuln['user'], 'admin') self.assertEquals(vuln['pass'], 'admin') + @pytest.mark.deprecated def test_not_found_credentials(self): # Run the scan cfg = self._run_configs['negative'] diff --git a/w3af/plugins/tests/bruteforce/test_form_auth.py b/w3af/plugins/tests/bruteforce/test_form_auth.py index 7ab0397451..ef8bb8ce8f 100644 --- a/w3af/plugins/tests/bruteforce/test_form_auth.py +++ b/w3af/plugins/tests/bruteforce/test_form_auth.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import random @@ -83,6 +84,7 @@ class FormAuthTest(GenericFormAuthTest): } @attr('smoke') + @pytest.mark.deprecated def test_found_credentials_post(self): self._scan(self.target_post_url, self.basic_config) @@ -97,6 +99,7 @@ def test_found_credentials_post(self): self.assertEquals(vuln['user'], 'admin') self.assertEquals(vuln['pass'], '1234') + @pytest.mark.deprecated def test_found_credentials_get(self): self._scan(self.target_get_url, self.basic_config) @@ -111,6 +114,7 @@ def test_found_credentials_get(self): self.assertEquals(vuln['user'], 'admin') self.assertEquals(vuln['pass'], 'admin') + @pytest.mark.deprecated def test_found_credentials_password_only(self): self._scan(self.target_password_only_url, self.basic_config) @@ -126,6 +130,7 @@ def test_found_credentials_password_only(self): self.assertEquals(vuln['user'], 'password-only-form') self.assertEquals(vuln['pass'], '1234') + @pytest.mark.deprecated def test_negative(self): self._scan(self.target_negative_url, self.negative_test) @@ -173,6 +178,7 @@ def request_callback(self, request, uri, response_headers): ] + @pytest.mark.deprecated def test_found_credentials(self): self._scan(self.target_url, self.basic_config) @@ -234,6 +240,7 @@ def request_callback(self, request, uri, response_headers): ] + @pytest.mark.deprecated def test_found_credentials(self): self._scan(self.target_url, self.basic_config) @@ -297,6 +304,7 @@ def request_callback(self, request, uri, response_headers): ] + @pytest.mark.deprecated def test_found_credentials(self): # Controls the numbers generated in the request_callback random.seed(1) @@ -361,6 +369,7 @@ def request_callback(self, request, uri, response_headers): ] + @pytest.mark.deprecated def test_found_credentials(self): # Controls the numbers generated in the request_callback random.seed(1) @@ -437,6 +446,7 @@ def request_callback(self, request, uri, response_headers): ] + @pytest.mark.deprecated def test_not_found_credentials(self): # Controls the numbers generated in the request_callback random.seed(1) diff --git a/w3af/plugins/tests/crawl/phishtank/test_phishtank_xml_parsing.py b/w3af/plugins/tests/crawl/phishtank/test_phishtank_xml_parsing.py index 9f42f32ead..8354442c71 100644 --- a/w3af/plugins/tests/crawl/phishtank/test_phishtank_xml_parsing.py +++ b/w3af/plugins/tests/crawl/phishtank/test_phishtank_xml_parsing.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest import lxml.etree as etree diff --git a/w3af/plugins/tests/crawl/test_archive_dot_org.py b/w3af/plugins/tests/crawl/test_archive_dot_org.py index cfda666124..c1f0184954 100644 --- a/w3af/plugins/tests/crawl/test_archive_dot_org.py +++ b/w3af/plugins/tests/crawl/test_archive_dot_org.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.core.controllers.exceptions import RunOnce @@ -38,6 +39,7 @@ class TestArchiveDotOrg(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_found_urls(self): self._scan(self.archive_url, self._run_config['plugins']) urls = self.kb.get_all_known_urls() @@ -54,12 +56,14 @@ def test_found_urls(self): self.assertTrue(urls_as_strings.issuperset(expected_set), msg) self.assertGreater(len(urls), 50) + @pytest.mark.deprecated def test_raise_on_local_domain(self): url = URL('http://moth/') fr = FuzzableRequest(url, method='GET') ado = archive_dot_org() self.assertRaises(RunOnce, ado.discover_wrapper, fr) + @pytest.mark.deprecated def test_raise_on_domain_not_in_archive(self): url = URL('http://www.w3af-scanner.org/') fr = FuzzableRequest(url, method='GET') diff --git a/w3af/plugins/tests/crawl/test_bing_spider.py b/w3af/plugins/tests/crawl/test_bing_spider.py index a6256bdb6f..1e52ab4def 100644 --- a/w3af/plugins/tests/crawl/test_bing_spider.py +++ b/w3af/plugins/tests/crawl/test_bing_spider.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -43,6 +44,7 @@ class TestBingSpider(PluginTest): MOCK_RESPONSES = [MockResponse(target_url_fmt % eu, 'Response body.') for eu in EXPECTED_URLS] + @pytest.mark.deprecated def test_found_urls(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_content_negotiation.py b/w3af/plugins/tests/crawl/test_content_negotiation.py index ac91347483..479033de22 100644 --- a/w3af/plugins/tests/crawl/test_content_negotiation.py +++ b/w3af/plugins/tests/crawl/test_content_negotiation.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -37,6 +38,7 @@ class TestContentNegotiation(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_content_negotiation_find_urls(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_crawl_exception_handling.py b/w3af/plugins/tests/crawl/test_crawl_exception_handling.py index 0c90eae9da..3f4507c9e7 100644 --- a/w3af/plugins/tests/crawl/test_crawl_exception_handling.py +++ b/w3af/plugins/tests/crawl/test_crawl_exception_handling.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import shutil @@ -80,6 +81,7 @@ def tearDown(self): super(TestCrawlExceptions, self).tearDown() + @pytest.mark.deprecated def test_spider_found_urls(self): cfg = self._run_configs['cfg'] diff --git a/w3af/plugins/tests/crawl/test_digit_sum.py b/w3af/plugins/tests/crawl/test_digit_sum.py index 149f9907f9..71375ef741 100644 --- a/w3af/plugins/tests/crawl/test_digit_sum.py +++ b/w3af/plugins/tests/crawl/test_digit_sum.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.tests.helper import PluginTest, PluginConfig from w3af.core.controllers.ci.moth import get_moth_http @@ -31,6 +32,7 @@ class TestDigitSum(PluginTest): 'plugins': {'crawl': (PluginConfig('digit_sum',),)} } + @pytest.mark.deprecated def test_found_fname(self): self._scan(self.target_url + 'index-3-1.html', self._run_config['plugins']) @@ -39,6 +41,7 @@ def test_found_fname(self): u'/crawl/digit_sum/index-2-1.html') self.assertAllURLsFound(EXPECTED_URLS) + @pytest.mark.deprecated def test_found_qs(self): self._scan(self.target_url + 'index1.py?id=22', self._run_config['plugins']) diff --git a/w3af/plugins/tests/crawl/test_dir_file_bruter.py b/w3af/plugins/tests/crawl/test_dir_file_bruter.py index 065f36431d..10d5da7b57 100644 --- a/w3af/plugins/tests/crawl/test_dir_file_bruter.py +++ b/w3af/plugins/tests/crawl/test_dir_file_bruter.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af import ROOT_PATH @@ -96,6 +97,7 @@ class TestDirFileBruter(PluginTest): ),)} } + @pytest.mark.deprecated def test_directories(self): self._scan(self._run_directories['target'], self._run_directories['plugins']) @@ -103,12 +105,14 @@ def test_directories(self): expected_urls = ('/crawl/', '/portal/', '/') self.assertAllURLsFound(expected_urls) + @pytest.mark.deprecated def test_files(self): self._scan(self._run_files['target'], self._run_files['plugins']) expected_urls = ('/iamhidden.txt', '/') self.assertAllURLsFound(expected_urls) + @pytest.mark.deprecated def test_directories_files(self): self._scan(self._run_directory_files['target'], self._run_directory_files['plugins']) @@ -118,6 +122,7 @@ def test_directories_files(self): u'/crawl/dir_bruter/spameggs/') self.assertAllURLsFound(expected_urls) + @pytest.mark.deprecated def test_recursive(self): self._scan(self._run_recursive['target'], self._run_recursive['plugins']) diff --git a/w3af/plugins/tests/crawl/test_dot_ds_store.py b/w3af/plugins/tests/crawl/test_dot_ds_store.py index 7fb74f9007..92d9826c71 100644 --- a/w3af/plugins/tests/crawl/test_dot_ds_store.py +++ b/w3af/plugins/tests/crawl/test_dot_ds_store.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -41,6 +42,7 @@ class TestDSStore(PluginTest): MockResponse('http://mock/other', 'Secret directory'), MockResponse('http://mock/', 'Not here', status=404)] + @pytest.mark.deprecated def test_ds_store(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_dot_listing.py b/w3af/plugins/tests/crawl/test_dot_listing.py index 09f308d0f7..cf344cf356 100644 --- a/w3af/plugins/tests/crawl/test_dot_listing.py +++ b/w3af/plugins/tests/crawl/test_dot_listing.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af import ROOT_PATH @@ -43,6 +44,7 @@ class TestDotListing(PluginTest): MockResponse('http://mock/wasadhiya-7.mp3', 'Secret file'), MockResponse('http://mock/', 'Not here', status=404)] + @pytest.mark.deprecated def test_dot_listing(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -61,6 +63,7 @@ def test_dot_listing(self): set((self.target_url + end) for end in expected_urls) ) + @pytest.mark.deprecated def test_listing_extraction(self): listing_files_path = os.path.join(ROOT_PATH, 'plugins', 'tests', 'crawl', 'dot_listing') file_name_fmt = 'listing_test_%s.txt' diff --git a/w3af/plugins/tests/crawl/test_dwsync_xml.py b/w3af/plugins/tests/crawl/test_dwsync_xml.py index 766110946b..a3ce4454b3 100644 --- a/w3af/plugins/tests/crawl/test_dwsync_xml.py +++ b/w3af/plugins/tests/crawl/test_dwsync_xml.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -41,6 +42,7 @@ class TestDWSyncXML(PluginTest): MOCK_RESPONSES = [MockResponse('http://mock/_notes/dwsync.xml', DWSYNC), MockResponse('http://mock/secret/', 'Secret directory')] + @pytest.mark.deprecated def test_dwsync_xml(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_find_backdoors.py b/w3af/plugins/tests/crawl/test_find_backdoors.py index 502758424d..5b70a28444 100644 --- a/w3af/plugins/tests/crawl/test_find_backdoors.py +++ b/w3af/plugins/tests/crawl/test_find_backdoors.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -45,6 +46,7 @@ class TestFindBackdoor(PluginTest): MockResponse('http://httpretty-mock/c99shell.php', ' c99shell')] + @pytest.mark.deprecated def test_find_backdoor(self): cfg = run_configs['base'] self._scan(self.target_url, cfg['plugins']) @@ -71,6 +73,7 @@ class TestFalsePositiveFindBackdoor2017_1(PluginTest): MOCK_RESPONSES = [MockResponse(re.compile('(.*)'), APACHE_403, status=403)] + @pytest.mark.deprecated def test_2017_false_positive_backdoor_1(self): cfg = run_configs['base'] self._scan(self.target_url, cfg['plugins']) @@ -93,6 +96,8 @@ class TestFalsePositiveFindBackdoor2017_2(PluginTest): MockResponse(re.compile('http://.*?/forbidden/.*'), APACHE_403, status=403)] + @pytest.mark.deprecated + @pytest.mark.slow def test_2017_false_positive_backdoor_2(self): cfg = run_configs['crawl'] self._scan(self.target_url, cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_find_captchas.py b/w3af/plugins/tests/crawl/test_find_captchas.py index 6e9ae24164..0c9dcc7fa0 100644 --- a/w3af/plugins/tests/crawl/test_find_captchas.py +++ b/w3af/plugins/tests/crawl/test_find_captchas.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -35,6 +36,7 @@ class TestFindCAPTCHAS(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_find_captcha(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_find_dvcs.py b/w3af/plugins/tests/crawl/test_find_dvcs.py index f1e1adefb5..0018c7cbc7 100644 --- a/w3af/plugins/tests/crawl/test_find_dvcs.py +++ b/w3af/plugins/tests/crawl/test_find_dvcs.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import w3af.core.data.constants.severity as severity @@ -53,6 +54,7 @@ class TestFindDVCS(PluginTest): # 'cvs' ) + @pytest.mark.deprecated def test_dvcs(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -76,12 +78,14 @@ def test_dvcs(self): self.assertEqual(vuln_repo.get_name(), 'Source code repository') self.assertIn(repo, vuln_repo.get_desc().lower()) + @pytest.mark.deprecated def test_ignore_file_blank(self): fdvcs = find_dvcs() files = fdvcs.ignore_file('') self.assertEqual(files, set()) + @pytest.mark.deprecated def test_ignore_file_two_files_comment(self): fdvcs = find_dvcs() content = """# Ignore these files @@ -116,6 +120,8 @@ class TestSVN(PluginTest): } } + @pytest.mark.deprecated + @pytest.mark.slow def test_wc_db(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_genexus_xml.py b/w3af/plugins/tests/crawl/test_genexus_xml.py index 4b6070cd34..7a0f97c9bf 100644 --- a/w3af/plugins/tests/crawl/test_genexus_xml.py +++ b/w3af/plugins/tests/crawl/test_genexus_xml.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -76,6 +77,7 @@ class TestGenexusXML(PluginTest): MockResponse('http://httpretty-mock/foobar.aspx', 'Exists')] + @pytest.mark.deprecated def test_genexus_xml(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_ghdb.py b/w3af/plugins/tests/crawl/test_ghdb.py index 543b63265b..a761294438 100644 --- a/w3af/plugins/tests/crawl/test_ghdb.py +++ b/w3af/plugins/tests/crawl/test_ghdb.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import datetime from nose.plugins.skip import SkipTest @@ -44,6 +45,7 @@ class TestGHDB(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_ghdb_private(self): cfg = self._run_configs['cfg'] @@ -59,6 +61,7 @@ def test_ghdb_private(self): self.assertEqual(len(vulns), 0, vulns) @attr('ci_fails') + @pytest.mark.deprecated def test_ghdb_match(self): call_count = 0 @@ -98,6 +101,7 @@ def generate_google_result(*args): self.assertEqual(vuln.get_severity(), severity.MEDIUM) self.assertEqual(vuln.get_name(), 'Google hack database match') + @pytest.mark.deprecated def test_xml_parsing(self): ghdb_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'ghdb') @@ -108,6 +112,7 @@ def test_xml_parsing(self): for ghdb_inst in ghdb_set: self.assertIsInstance(ghdb_inst, GoogleHack) + @pytest.mark.deprecated def test_too_old_xml(self): ghdb_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'ghdb') diff --git a/w3af/plugins/tests/crawl/test_google_spider.py b/w3af/plugins/tests/crawl/test_google_spider.py index 2667e18ef7..721ec73ad1 100644 --- a/w3af/plugins/tests/crawl/test_google_spider.py +++ b/w3af/plugins/tests/crawl/test_google_spider.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -35,6 +36,7 @@ class TestGoogleSpider(PluginTest): } } + @pytest.mark.slow def test_found_urls(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_import_results.py b/w3af/plugins/tests/crawl/test_import_results.py index 753fa3fea7..f4c7c952cd 100644 --- a/w3af/plugins/tests/crawl/test_import_results.py +++ b/w3af/plugins/tests/crawl/test_import_results.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af import ROOT_PATH @@ -64,6 +65,7 @@ class TestImportResults(PluginTest): } + @pytest.mark.deprecated def test_base64(self): cfg = self._run_configs['w3af'] self._scan(cfg['target'], cfg['plugins']) @@ -120,6 +122,7 @@ def test_base64(self): self.assertEqual(set(urls), expected_urls) + @pytest.mark.deprecated def test_burp_b64(self): cfg = self._run_configs['burp64'] self._scan(cfg['target'], cfg['plugins']) @@ -182,6 +185,7 @@ def test_burp_b64(self): self.assertEqual(set(urls), expected_urls) + @pytest.mark.deprecated def test_burp(self): cfg = self._run_configs['burp'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_open_api.py b/w3af/plugins/tests/crawl/test_open_api.py index cb831a65d4..c4e3206866 100644 --- a/w3af/plugins/tests/crawl/test_open_api.py +++ b/w3af/plugins/tests/crawl/test_open_api.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import json import re @@ -55,6 +56,7 @@ class TestOpenAPIFindAllEndpointsWithAuth(PluginTest): IntParamQueryString().get_specification(), content_type='application/json')] + @pytest.mark.deprecated def test_find_all_endpoints_with_auth(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -180,6 +182,7 @@ def get_response(self, http_request, uri, response_headers): method='GET', status=200)] + @pytest.mark.deprecated def test_find_all_endpoints_with_auth(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -244,6 +247,7 @@ class TestOpenAPIRaisesWarningIfNoAuth(PluginTest): NestedModel().get_specification(), content_type='application/json')] + @pytest.mark.deprecated def test_auth_warning_raised(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -275,6 +279,7 @@ class TestOpenAPIRaisesWarningIfParsingError(PluginTest): NestedModel().get_specification()[:-1], content_type='application/json')] + @pytest.mark.deprecated def test_parsing_error_raised(self): cfg = self._run_configs['cfg'] @@ -320,6 +325,7 @@ class TestOpenAPIFindsSpecInOtherDirectory(PluginTest): NestedModel().get_specification(), content_type='application/json')] + @pytest.mark.deprecated def test_auth_warning_raised(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -348,6 +354,7 @@ class TestOpenAPIFindsSpecInOtherDirectory2(PluginTest): NestedModel().get_specification(), content_type='application/json')] + @pytest.mark.deprecated def test_auth_warning_raised(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -413,6 +420,7 @@ def get_response(self, http_request, uri, response_headers): status=200) ] + @pytest.mark.deprecated def test_fuzzing_parameters_in_path(self): # # TODO: This unittest is failing because of basePath being ignored diff --git a/w3af/plugins/tests/crawl/test_oracle_discovery.py b/w3af/plugins/tests/crawl/test_oracle_discovery.py index f9c55c58b1..885ed0b6bc 100644 --- a/w3af/plugins/tests/crawl/test_oracle_discovery.py +++ b/w3af/plugins/tests/crawl/test_oracle_discovery.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.plugins.tests.helper import PluginTest, PluginConfig from w3af.core.controllers.ci.moth import get_moth_http @@ -31,6 +32,7 @@ class TestOracleDiscovery(PluginTest): 'plugins': {'crawl': (PluginConfig('oracle_discovery'),)} } + @pytest.mark.deprecated def test_oracle_discovery(self): self._scan(self._run_config['target'], self._run_config['plugins']) diff --git a/w3af/plugins/tests/crawl/test_payment_webhook_finder.py b/w3af/plugins/tests/crawl/test_payment_webhook_finder.py index e20e9050a5..52531cdb2e 100644 --- a/w3af/plugins/tests/crawl/test_payment_webhook_finder.py +++ b/w3af/plugins/tests/crawl/test_payment_webhook_finder.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.data.parsers.doc.url import URL from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse from w3af.plugins.crawl.payment_webhook_finder import payment_webhook_finder @@ -62,6 +63,8 @@ class TestPaymentWebHookFinderGET(PluginTest): 'plugins': {'crawl': (PluginConfig('payment_webhook_finder'),)} } + @pytest.mark.deprecated + @pytest.mark.slow def test_find_using_GET(self): fill_kb_with_cgi_urls(self.target_url, self.kb.add_url) @@ -95,6 +98,8 @@ class TestPaymentWebHookFinderPOST(PluginTest): 'plugins': {'crawl': (PluginConfig('payment_webhook_finder'),)} } + @pytest.mark.deprecated + @pytest.mark.slow def test_find_using_POST(self): fill_kb_with_cgi_urls(self.target_url, self.kb.add_url) diff --git a/w3af/plugins/tests/crawl/test_phishtank.py b/w3af/plugins/tests/crawl/test_phishtank.py index fc37955a34..51d79601e4 100644 --- a/w3af/plugins/tests/crawl/test_phishtank.py +++ b/w3af/plugins/tests/crawl/test_phishtank.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import csv from w3af.core.controllers.ci.moth import get_moth_http @@ -34,6 +35,7 @@ class TestPhishtank(PluginTest): safe_url = get_moth_http() phish_detail = 'http://www.phishtank.com/phish_detail.php?phish_id=' + @pytest.mark.deprecated def test_phishtank_no_match(self): phishtank_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'phishtank') @@ -59,10 +61,12 @@ def get_last_vulnerable_url(self): return phishing_url + @pytest.mark.deprecated def test_total_urls(self): total_lines = len(file(phishtank.PHISHTANK_DB).read().split('\n')) self.assertGreater(total_lines, 5000) + @pytest.mark.deprecated def test_phishtank_match_url(self): phishtank_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'phishtank') @@ -79,6 +83,7 @@ def test_phishtank_match_url(self): self.assertEqual(vuln.get_severity(), MEDIUM) self.assertEqual(vuln.get_url().get_domain(), vuln_url.get_domain()) + @pytest.mark.deprecated def test_phishtank_match_last_url(self): phishtank_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'phishtank') @@ -95,6 +100,7 @@ def test_phishtank_match_last_url(self): self.assertEqual(vuln.get_severity(), MEDIUM) self.assertEqual(vuln.get_url().get_domain(), vuln_url.get_domain()) + @pytest.mark.deprecated def test_too_old_db(self): is_older = days_since_file_update(phishtank.PHISHTANK_DB, 30) diff --git a/w3af/plugins/tests/crawl/test_phpinfo.py b/w3af/plugins/tests/crawl/test_phpinfo.py index c0b870c403..1d507ad08f 100644 --- a/w3af/plugins/tests/crawl/test_phpinfo.py +++ b/w3af/plugins/tests/crawl/test_phpinfo.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from w3af import ROOT_PATH @@ -45,6 +46,7 @@ class TestPHPInfo516(PluginTest): 'plugins': {'crawl': (PluginConfig('phpinfo'),)} } + @pytest.mark.deprecated def test_phpinfo(self): self._scan(self._run_config['target'], self._run_config['plugins']) @@ -70,13 +72,16 @@ def test_phpinfo(self): self.assertIn(expected_info, found_infos) +@pytest.mark.deprecated class TestPHPInfo4311(TestPHPInfo516): PHPINFO = os.path.join(ROOT_PATH, 'plugins', 'tests', 'crawl', 'phpinfo', 'phpinfo-4.3.11.html') +@pytest.mark.deprecated class TestPHPInfo513rc4dev(TestPHPInfo516): PHPINFO = os.path.join(ROOT_PATH, 'plugins', 'tests', 'crawl', 'phpinfo', 'phpinfo-5.1.3-rc4dev.html') +@pytest.mark.deprecated class TestPHPInfo433(TestPHPInfo516): PHPINFO = os.path.join(ROOT_PATH, 'plugins', 'tests', 'crawl', 'phpinfo', 'phpinfo-4.3.3.html') diff --git a/w3af/plugins/tests/crawl/test_pykto.py b/w3af/plugins/tests/crawl/test_pykto.py index 4d4a89bc5b..b04e124608 100644 --- a/w3af/plugins/tests/crawl/test_pykto.py +++ b/w3af/plugins/tests/crawl/test_pykto.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import re import os @@ -51,6 +52,7 @@ class TestPykto(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_basic_pykto(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -157,6 +159,7 @@ def test_check_case09(self): class TestNiktoTestParser(PluginTest): + @pytest.mark.deprecated def test_updated_scan_db(self): pykto_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'pykto') @@ -172,6 +175,7 @@ def test_updated_scan_db(self): 'cd -' self.assertFalse(is_older, msg) + @pytest.mark.deprecated def test_not_too_many_ignores(self): config = Config(['/cgi-bin/'], [], [], [], []) url = URL('http://moth/') @@ -184,6 +188,7 @@ def test_not_too_many_ignores(self): self.assertLess(len(nikto_parser.ignored), 30, len(nikto_parser.ignored)) + @pytest.mark.deprecated def test_parse_db_line_basic(self): """ This test reads a line from the DB and parses it, it's objective is to @@ -224,6 +229,7 @@ def test_parse_db_line_basic(self): self.assertEqual(cart32_test_from_db.match_1, nikto_test.match_1) self.assertEqual(cart32_test_from_db.message, nikto_test.message) + @pytest.mark.deprecated def test_parse_db_line_junk(self): config = Config(['/cgi-bin/'], [], [], [], []) url = URL('http://moth/') @@ -241,6 +247,7 @@ def test_parse_db_line_junk(self): self.assertIn('/docs/', nikto_test.uri.url_string) self.assertEqual(len('/docs/') + 5, len(nikto_test.uri.get_path())) + @pytest.mark.deprecated def test_parse_db_line_no_vars(self): config = Config([], [], [], [], []) url = URL('http://moth/') @@ -257,6 +264,7 @@ def test_parse_db_line_no_vars(self): self.assertEqual('/docs/', nikto_test.uri.get_path()) + @pytest.mark.deprecated def test_parse_db_line_cgidirs(self): config = Config(['/cgi-bin/'], [], [], [], []) url = URL('http://moth/') @@ -273,6 +281,7 @@ def test_parse_db_line_cgidirs(self): self.assertEqual('/cgi-bin/', nikto_test.uri.get_path()) + @pytest.mark.deprecated def test_parse_db_line_admin_dirs(self): admin_dirs = ['/adm/', '/admin/'] @@ -290,6 +299,7 @@ def test_parse_db_line_admin_dirs(self): self.assertEqual(admin_dirs, [nt.uri.get_path() for nt in nikto_tests]) + @pytest.mark.deprecated def test_parse_db_line_admin_users_two(self): admin_dirs = ['/adm/', '/admin/'] users = ['sys', 'root'] @@ -308,6 +318,7 @@ def test_parse_db_line_admin_users_two(self): self.assertEqual(['/adm/sys', '/adm/root', '/admin/sys', '/admin/root'], [nt.uri.get_path() for nt in nikto_tests]) + @pytest.mark.deprecated def test_parse_db_line_raw_bytes(self): config = Config(['/cgi-bin/'], [], [], [], []) url = URL('http://moth/') @@ -323,6 +334,7 @@ def test_parse_db_line_raw_bytes(self): else: self.assertTrue(False) + @pytest.mark.deprecated def test_parse_db_line_basic_w3af_scan_database(self): """ This test reads a line from the w3af scan database and parses it, it's diff --git a/w3af/plugins/tests/crawl/test_ria_enumerator.py b/w3af/plugins/tests/crawl/test_ria_enumerator.py index 344bff2be4..a40267120b 100644 --- a/w3af/plugins/tests/crawl/test_ria_enumerator.py +++ b/w3af/plugins/tests/crawl/test_ria_enumerator.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -33,6 +34,7 @@ class TestRIAEnumerator(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_ria_enumerator(self): self._scan(self._run_config['target'], self._run_config['plugins']) diff --git a/w3af/plugins/tests/crawl/test_robots_txt.py b/w3af/plugins/tests/crawl/test_robots_txt.py index 183dce9e36..499845346e 100644 --- a/w3af/plugins/tests/crawl/test_robots_txt.py +++ b/w3af/plugins/tests/crawl/test_robots_txt.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.w3af_moth import get_w3af_moth_http from w3af.core.data.parsers.doc.url import URL from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -34,6 +35,7 @@ class TestRobots(PluginTest): } } + @pytest.mark.deprecated def test_robots(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_sitemap_xml.py b/w3af/plugins/tests/crawl/test_sitemap_xml.py index 62a452c83e..aa0cc242da 100644 --- a/w3af/plugins/tests/crawl/test_sitemap_xml.py +++ b/w3af/plugins/tests/crawl/test_sitemap_xml.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -35,6 +36,7 @@ class TestSitemap(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_sitemap(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_spider_man.py b/w3af/plugins/tests/crawl/test_spider_man.py index 9177b3b192..08ce1292c4 100644 --- a/w3af/plugins/tests/crawl/test_spider_man.py +++ b/w3af/plugins/tests/crawl/test_spider_man.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import time import socket import urllib2 @@ -147,6 +148,7 @@ def generic_spiderman_run(self, class TestHTTPSpiderman(TestSpiderman): + @pytest.mark.deprecated def test_spiderman_http(self): port = get_unused_port() @@ -163,6 +165,7 @@ def test_spiderman_http(self): class TestHTTPSSpiderman(TestSpiderman): + @pytest.mark.deprecated def test_spiderman_https(self): port = get_unused_port() diff --git a/w3af/plugins/tests/crawl/test_url_fuzzer.py b/w3af/plugins/tests/crawl/test_url_fuzzer.py index 361fd80ce5..51236ee19f 100644 --- a/w3af/plugins/tests/crawl/test_url_fuzzer.py +++ b/w3af/plugins/tests/crawl/test_url_fuzzer.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -35,6 +36,7 @@ class TestURLFuzzer(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_fuzzer_found_urls(self): cfg = self._run_configs['standalone'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_urllist_txt.py b/w3af/plugins/tests/crawl/test_urllist_txt.py index ae3811cb5e..00e362aabe 100644 --- a/w3af/plugins/tests/crawl/test_urllist_txt.py +++ b/w3af/plugins/tests/crawl/test_urllist_txt.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -35,6 +36,7 @@ class TestURLListTxt(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_urllist_txt(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_user_dir.py b/w3af/plugins/tests/crawl/test_user_dir.py index 8425a127d7..1e9808421d 100644 --- a/w3af/plugins/tests/crawl/test_user_dir.py +++ b/w3af/plugins/tests/crawl/test_user_dir.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from mock import Mock from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -47,6 +48,7 @@ class TestUserDir(PluginTest): ('Identified installed application', 'http://httpretty/xfs/'), ('Fingerprinted operating system', 'http://httpretty/~kmem/')} + @pytest.mark.deprecated def test_fuzzer_user(self): # Don't enable dependencies self.w3afcore.plugins.resolve_dependencies = Mock() diff --git a/w3af/plugins/tests/crawl/test_web_diff.py b/w3af/plugins/tests/crawl/test_web_diff.py index fc8d0e7307..cb9fe91479 100644 --- a/w3af/plugins/tests/crawl/test_web_diff.py +++ b/w3af/plugins/tests/crawl/test_web_diff.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os from nose.plugins.attrib import attr @@ -51,6 +52,7 @@ class TestWebDiff(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_compare(self): cfg = self._run_configs['basic'] diff --git a/w3af/plugins/tests/crawl/test_web_spider.py b/w3af/plugins/tests/crawl/test_web_spider.py index e420adb7be..1b664b3ad8 100644 --- a/w3af/plugins/tests/crawl/test_web_spider.py +++ b/w3af/plugins/tests/crawl/test_web_spider.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import urllib2 import re import os @@ -79,6 +80,7 @@ def generic_scan(self, config, base_directory, start_url, expected_files): self.assertEquals(found_urls, expected_urls) @attr('smoke') + @pytest.mark.deprecated def test_spider_found_urls(self): config = self._run_configs['basic'] expected_files = ['1.html', '2.html', '3.html', '4.html', @@ -88,6 +90,7 @@ def test_spider_found_urls(self): self.generic_scan(config, self.follow_links_url, start_url, expected_files) + @pytest.mark.deprecated def test_utf8_urls(self): config = self._run_configs['basic'] expected_files = [u'vúlnerable.py', @@ -98,6 +101,7 @@ def test_utf8_urls(self): self.generic_scan(config, start_url, start_url, expected_files) + @pytest.mark.deprecated def test_euc_jp_urls(self): config = self._run_configs['basic'] expected_files = [u'raw-qs-jp.py', @@ -106,12 +110,15 @@ def test_euc_jp_urls(self): self.generic_scan(config, start_url, start_url, expected_files) + @pytest.mark.deprecated def test_spider_relative_urls_found_with_regex(self): raise SkipTest('FIXME: Need to test this feature!') + @pytest.mark.deprecated def test_spider_traverse_directories(self): raise SkipTest('FIXME: Need to test this feature!') + @pytest.mark.deprecated def test_wivet(self): clear_wivet() @@ -258,6 +265,7 @@ class TestRelativePathsIn404(PluginTest): MockResponse('http://mock/', 'Thanks.', method='POST'), MockResponse('http://mock/', INDEX_HTML)] + @pytest.mark.deprecated def test_crawl_404_relative(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -304,6 +312,7 @@ class TestDeadLock(PluginTest): MOCK_RESPONSES = [MockResponse('http://mock/', INDEX_HTML), MockResponse('http://mock/', 'Thanks.', method='POST')] + @pytest.mark.deprecated def test_no_lock(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -335,6 +344,7 @@ class TestFormExclusions(PluginTest): MockResponse('http://mock/out/', 'Thanks.', method='POST'), MockResponse('http://mock/in/', 'Thanks.', method='POST')] + @pytest.mark.deprecated def test_form_exclusions(self): user_value = '[{"action": "/out.*"}]' cf.cf.save('form_id_list', FormIDMatcherList(user_value)) diff --git a/w3af/plugins/tests/crawl/test_wordnet.py b/w3af/plugins/tests/crawl/test_wordnet.py index 6be7bd9b5e..c22695d90b 100644 --- a/w3af/plugins/tests/crawl/test_wordnet.py +++ b/w3af/plugins/tests/crawl/test_wordnet.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import w3af.core.data.kb.knowledge_base as kb from nose.plugins.attrib import attr @@ -45,6 +46,7 @@ class TestWordnet(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_found_urls(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -62,6 +64,7 @@ def test_found_urls(self): set((self.target_url + end) for end in expected_urls) ) + @pytest.mark.deprecated def test_search_wordnet(self): wn = wordnet() wn_result = wn._search_wn('blue') diff --git a/w3af/plugins/tests/crawl/test_wordpress_enumerate_users.py b/w3af/plugins/tests/crawl/test_wordpress_enumerate_users.py index 9c513eba40..cfce00c0c8 100644 --- a/w3af/plugins/tests/crawl/test_wordpress_enumerate_users.py +++ b/w3af/plugins/tests/crawl/test_wordpress_enumerate_users.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import re from nose.plugins.attrib import attr @@ -39,6 +40,7 @@ class TestWordpressEnumerateUsers(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_enumerate_users(self): cfg = self._run_configs['direct'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_wordpress_fingerprint.py b/w3af/plugins/tests/crawl/test_wordpress_fingerprint.py index d5676bd74f..79b2d59693 100644 --- a/w3af/plugins/tests/crawl/test_wordpress_fingerprint.py +++ b/w3af/plugins/tests/crawl/test_wordpress_fingerprint.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig from w3af.plugins.crawl.wordpress_fingerprint import FileFingerPrint @@ -49,6 +50,7 @@ class Testwordpress_fingerprint(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_find_version(self): cfg = self._run_configs['direct'] self._scan(cfg['target'], cfg['plugins']) @@ -78,6 +80,7 @@ def test_find_version(self): ' still be the same.', ]) self.assertEqual(descriptions, expected_descriptions) + @pytest.mark.deprecated def test_xml_parsing_case01(self): wordpress_fingerprint_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'wordpress_fingerprint') @@ -90,6 +93,7 @@ def test_xml_parsing_case01(self): '0.71-gold') self.assertIn(wp_file_fp, wp_fingerprints) + @pytest.mark.deprecated def test_updated_wp_versions_xml(self): wp_fp_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'wordpress_fingerprint') url = 'https://github.com/wpscanteam/wpscan/blob/master/data.zip?raw=true' @@ -107,6 +111,7 @@ def test_updated_wp_versions_xml(self): 'cd -' self.assertFalse(is_older, msg % url) + @pytest.mark.deprecated def test_updated_release_db(self): wpfp_inst = self.w3afcore.plugins.get_plugin_inst('crawl', diff --git a/w3af/plugins/tests/crawl/test_wordpress_fullpathdisclosure.py b/w3af/plugins/tests/crawl/test_wordpress_fullpathdisclosure.py index b68503346a..3cfaf556b7 100644 --- a/w3af/plugins/tests/crawl/test_wordpress_fullpathdisclosure.py +++ b/w3af/plugins/tests/crawl/test_wordpress_fullpathdisclosure.py @@ -19,6 +19,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -37,6 +38,7 @@ class TestWordpressPathDisclosure(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_enumerate_users(self): cfg = self._run_configs['direct'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/crawl/test_wsdl_finder.py b/w3af/plugins/tests/crawl/test_wsdl_finder.py index 89660ca9b7..5830b8b9f1 100644 --- a/w3af/plugins/tests/crawl/test_wsdl_finder.py +++ b/w3af/plugins/tests/crawl/test_wsdl_finder.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -39,6 +40,7 @@ class TestWSDLFinder(PluginTest): } @attr('ci_fails') + @pytest.mark.deprecated def test_wsdl_found(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/evasion/test_core_integration.py b/w3af/plugins/tests/evasion/test_core_integration.py index d973fa0a10..701375bc63 100644 --- a/w3af/plugins/tests/evasion/test_core_integration.py +++ b/w3af/plugins/tests/evasion/test_core_integration.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from mock import MagicMock @@ -39,6 +40,7 @@ def setUp(self): def tearDown(self): self.w3afcore.quit() + @pytest.mark.deprecated def test_send_mangled(self): self.w3afcore.plugins.set_plugins(['self_reference'], 'evasion') diff --git a/w3af/plugins/tests/evasion/test_mod_security.py b/w3af/plugins/tests/evasion/test_mod_security.py index 93ec35d9b0..7a5d0acfc1 100644 --- a/w3af/plugins/tests/evasion/test_mod_security.py +++ b/w3af/plugins/tests/evasion/test_mod_security.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.parsers.doc.url import URL @@ -43,6 +44,7 @@ def test_no_post_data(self): r = HTTPRequest( u, data='' ) self.assertEqual(modsec.modify_request( r ).get_data(), '') + @pytest.mark.deprecated def test_urlencoded_post_data(self): modsec = mod_security() diff --git a/w3af/plugins/tests/grep/test_all.py b/w3af/plugins/tests/grep/test_all.py index 006f374296..860126bf9a 100644 --- a/w3af/plugins/tests/grep/test_all.py +++ b/w3af/plugins/tests/grep/test_all.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import os import cProfile @@ -56,6 +57,7 @@ def setUp(self): @patch('w3af.plugins.grep.meta_tags.is_404', side_effect=repeat(False)) @patch('w3af.plugins.grep.lang.is_404', side_effect=repeat(False)) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_image_with_image_content_type(self, *args): """ Verify that our plugins don't break when we send them an image. @@ -78,6 +80,7 @@ def test_image_with_image_content_type(self, *args): @patch('w3af.plugins.grep.meta_tags.is_404', side_effect=repeat(False)) @patch('w3af.plugins.grep.lang.is_404', side_effect=repeat(False)) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_image_with_text_html_content_type(self, *args): """ Verify that our plugins don't break when we send them an image with @@ -95,6 +98,7 @@ def test_image_with_text_html_content_type(self, *args): for pinst in self._plugins: pinst.grep(request, response) + @pytest.mark.deprecated def test_options_for_grep_plugins(self): """ We're not going to assert anything here. What just want to see if @@ -122,6 +126,7 @@ def test_options_for_grep_plugins(self): @patch('w3af.plugins.grep.meta_tags.is_404', side_effect=repeat(False)) @patch('w3af.plugins.grep.lang.is_404', side_effect=repeat(False)) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_all_grep_plugins(self, *args): """ Run a set of 5 html files through all grep plugins. diff --git a/w3af/plugins/tests/grep/test_analyze_cookies.py b/w3af/plugins/tests/grep/test_analyze_cookies.py index 25e38d322c..9bb8c3e5d7 100644 --- a/w3af/plugins/tests/grep/test_analyze_cookies.py +++ b/w3af/plugins/tests/grep/test_analyze_cookies.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -38,6 +39,7 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_analyze_cookies_negative(self): body = '' url = URL('http://www.w3af.com/') @@ -48,6 +50,7 @@ def test_analyze_cookies_negative(self): self.assertEqual(len(kb.kb.get('analyze_cookies', 'cookies')), 0) self.assertEqual(len(kb.kb.get('analyze_cookies', 'invalid-cookies')), 0) + @pytest.mark.deprecated def test_analyze_cookies_simple_cookie(self): body = '' url = URL('http://www.w3af.com/') @@ -60,6 +63,7 @@ def test_analyze_cookies_simple_cookie(self): self.assertEqual(len(kb.kb.get('analyze_cookies', 'cookies')), 1) self.assertEqual(len(kb.kb.get('analyze_cookies', 'invalid-cookies')), 0) + @pytest.mark.deprecated def test_analyze_cookies_collect_no_group(self): body = '' url = URL('http://www.w3af.com/') @@ -77,6 +81,7 @@ def test_analyze_cookies_collect_no_group(self): self.assertEqual(len(kb.kb.get('analyze_cookies', 'cookies')), 2) + @pytest.mark.deprecated def test_analyze_cookies_collect_one(self): body = '' url = URL('http://www.w3af.com/') @@ -96,6 +101,7 @@ def test_analyze_cookies_collect_one(self): self.assertEqual(len(info_set.infos), 1) self.assertEqual(info_set.get_desc(), expected_desc) + @pytest.mark.deprecated def test_analyze_cookies_collect_group_by_key(self): body = '' url_1 = URL('http://www.w3af.com/1') @@ -122,6 +128,7 @@ def test_analyze_cookies_collect_group_by_key(self): self.assertEqual(len(info_set.infos), 2) self.assertEqual(info_set.get_desc(), expected_desc) + @pytest.mark.deprecated def test_analyze_cookies_collect_uniq(self): body = '' url = URL('http://www.w3af.com/') @@ -146,6 +153,7 @@ def test_analyze_cookies_collect_uniq(self): self.assertEqual(len(kb.kb.get('analyze_cookies', 'cookies')), 2) self.assertEqual(len(kb.kb.get('analyze_cookies', 'invalid-cookies')), 0) + @pytest.mark.deprecated def test_analyze_cookies_secure_httponly(self): body = '' url = URL('http://www.w3af.com/') @@ -157,6 +165,7 @@ def test_analyze_cookies_secure_httponly(self): self.assertEqual(len(kb.kb.get('analyze_cookies', 'cookies')), 1) self.assertEqual(len(kb.kb.get('analyze_cookies', 'invalid-cookies')), 0) + @pytest.mark.deprecated def test_analyze_cookies_empty(self): body = '' url = URL('http://www.w3af.com/') @@ -168,6 +177,7 @@ def test_analyze_cookies_empty(self): self.assertEqual(len(kb.kb.get('analyze_cookies', 'cookies')), 1) self.assertEqual(len(kb.kb.get('analyze_cookies', 'invalid-cookies')), 0) + @pytest.mark.deprecated def test_analyze_cookies_fingerprint(self): body = '' url = URL('http://www.w3af.com/') @@ -187,6 +197,7 @@ def test_analyze_cookies_fingerprint(self): msg = 'The remote platform is: "PHP"' self.assertTrue(any([True for i in fingerprint if msg in i.get_desc()])) + @pytest.mark.deprecated def test_analyze_cookies_secure_over_http(self): body = '' url = URL('http://www.w3af.com/') @@ -206,6 +217,7 @@ def test_analyze_cookies_secure_over_http(self): msg = 'A cookie marked with the secure flag' self.assertTrue(any([True for i in false_secure if msg in i.get_desc()])) + @pytest.mark.deprecated def test_analyze_cookies_no_httponly(self): body = '' url = URL('http://www.w3af.com/1') @@ -240,6 +252,7 @@ def test_analyze_cookies_no_httponly(self): self.assertEqual(info_set.get_id(), [1, 2]) self.assertEqual(len(info_set.infos), 2) + @pytest.mark.deprecated def test_analyze_cookies_with_httponly(self): body = '' url = URL('https://www.w3af.com/') @@ -254,6 +267,7 @@ def test_analyze_cookies_with_httponly(self): self.assertEqual(len(kb.kb.get('analyze_cookies', 'http_only')), 0) self.assertEqual(len(kb.kb.get('analyze_cookies', 'secure')), 0) + @pytest.mark.deprecated def test_analyze_cookies_with_httponly_case_sensitive(self): body = '' url = URL('https://www.w3af.com/') @@ -267,6 +281,7 @@ def test_analyze_cookies_with_httponly_case_sensitive(self): self.assertEqual(len(kb.kb.get('analyze_cookies', 'cookies')), 1) self.assertEqual(len(kb.kb.get('analyze_cookies', 'http_only')), 0) + @pytest.mark.deprecated def test_analyze_cookies_with_httponly_secure(self): body = '' url = URL('https://www.w3af.com/') @@ -281,6 +296,7 @@ def test_analyze_cookies_with_httponly_secure(self): self.assertEqual(len(kb.kb.get('analyze_cookies', 'http_only')), 0) self.assertEqual(len(kb.kb.get('analyze_cookies', 'secure')), 0) + @pytest.mark.deprecated def test_analyze_cookies_with_httponly_case_sensitive_expires(self): body = '' url = URL('https://www.w3af.com/') @@ -297,6 +313,7 @@ def test_analyze_cookies_with_httponly_case_sensitive_expires(self): self.assertEqual(len(kb.kb.get('analyze_cookies', 'http_only')), 0) self.assertEqual(len(kb.kb.get('analyze_cookies', 'secure')), 0) + @pytest.mark.deprecated def test_analyze_cookies_https_value_over_http(self): body = '' url = URL('https://www.w3af.com/') @@ -326,6 +343,7 @@ def test_analyze_cookies_https_value_over_http(self): names = [i.get_name() for i in secure_via_http] self.assertIn('Secure cookies over insecure channel', names) + @pytest.mark.deprecated def test_analyze_ssl_cookie_without_secure_flag(self): body = '' url = URL('https://www.w3af.com/') diff --git a/w3af/plugins/tests/grep/test_blank_body.py b/w3af/plugins/tests/grep/test_blank_body.py index c5853dbcf2..e88b7835d5 100644 --- a/w3af/plugins/tests/grep/test_blank_body.py +++ b/w3af/plugins/tests/grep/test_blank_body.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_blank_body.py Copyright 2012 Andres Riancho @@ -19,6 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -42,6 +45,7 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_blank_body(self): body = '' headers = Headers([('content-type', 'text/html')]) @@ -49,6 +53,7 @@ def test_blank_body(self): self.plugin.grep(self.request, response) self.assertEqual(len(kb.kb.get('blank_body', 'blank_body')), 1) + @pytest.mark.deprecated def test_blank_body_none(self): body = 'header body footer' headers = Headers([('content-type', 'text/html')]) @@ -56,6 +61,7 @@ def test_blank_body_none(self): self.plugin.grep(self.request, response) self.assertEqual(len(kb.kb.get('ssn', 'ssn')), 0) + @pytest.mark.deprecated def test_blank_body_method(self): body = '' headers = Headers([('content-type', 'text/html')]) @@ -64,6 +70,7 @@ def test_blank_body_method(self): self.plugin.grep(request, response) self.assertEqual(len(kb.kb.get('ssn', 'ssn')), 0) + @pytest.mark.deprecated def test_blank_body_code(self): body = '' headers = Headers([('content-type', 'text/html')]) diff --git a/w3af/plugins/tests/grep/test_cache_control.py b/w3af/plugins/tests/grep/test_cache_control.py index 18a92e2260..00d9b999c3 100644 --- a/w3af/plugins/tests/grep/test_cache_control.py +++ b/w3af/plugins/tests/grep/test_cache_control.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -40,6 +41,7 @@ def setUp(self): def tearDown(self): kb.kb.cleanup() + @pytest.mark.deprecated def test_cache_control_http(self): """ No cache control, but the content is not sensitive (sent over http) so @@ -57,6 +59,7 @@ def test_cache_control_http(self): infos = kb.kb.get('cache_control', 'cache_control') self.assertEquals(len(infos), 0) + @pytest.mark.deprecated def test_cache_control_images(self): """ No cache control, but the content is not sensitive (is an image) @@ -74,6 +77,7 @@ def test_cache_control_images(self): infos = kb.kb.get('cache_control', 'cache_control') self.assertEquals(len(infos), 0) + @pytest.mark.deprecated def test_cache_control_empty_body(self): """ No cache control, but the content is not sensitive (since it is an @@ -91,6 +95,7 @@ def test_cache_control_empty_body(self): infos = kb.kb.get('cache_control', 'cache_control') self.assertEquals(len(infos), 0) + @pytest.mark.deprecated def test_cache_control_correct_headers(self): """ Sensitive content with cache control headers so NO BUG is stored in KB. @@ -109,6 +114,7 @@ def test_cache_control_correct_headers(self): infos = kb.kb.get('cache_control', 'cache_control') self.assertEquals(len(infos), 0) + @pytest.mark.deprecated def test_cache_control_correct_meta(self): """ Sensitive content with cache control meta tags so no bug is stored in KB. @@ -130,6 +136,7 @@ def test_cache_control_correct_meta(self): infos = kb.kb.get('cache_control', 'cache_control') self.assertEquals(len(infos), 0) + @pytest.mark.deprecated def test_cache_control_incorrect_headers(self): """ Sensitive content with INCORRECT cache control headers bug should be @@ -149,6 +156,7 @@ def test_cache_control_incorrect_headers(self): infos = kb.kb.get('cache_control', 'cache_control') self.assertEquals(len(infos), 1) + @pytest.mark.deprecated def test_cache_control_no_headers(self): """ Sensitive content without cache control headers so bug is stored in KB. diff --git a/w3af/plugins/tests/grep/test_cdn_providers.py b/w3af/plugins/tests/grep/test_cdn_providers.py index af4061a1ee..9a578d6ed4 100644 --- a/w3af/plugins/tests/grep/test_cdn_providers.py +++ b/w3af/plugins/tests/grep/test_cdn_providers.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from w3af.core.data.dc.headers import Headers @@ -37,6 +38,7 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_if_cdn_can_be_detected(self): url = URL('https://example.com/') headers = Headers([('server', 'Netlify')]) @@ -45,6 +47,7 @@ def test_if_cdn_can_be_detected(self): self.plugin.grep(request, response) self.assertEqual(len(kb.get('cdn_providers', 'cdn_providers')), 1) + @pytest.mark.deprecated def test_if_wrong_cdn_info_is_not_detected(self): url = URL('https://example.com/') headers = Headers([('server', 'Netlifo')]) # There's no Netlifo provider, @@ -54,6 +57,7 @@ def test_if_wrong_cdn_info_is_not_detected(self): self.plugin.grep(request, response) self.assertEqual(len(kb.get('cdn_providers', 'cdn_providers')), 0) + @pytest.mark.deprecated def test_if_cdns_are_grouped_by_provider_name(self): netlify_header = Headers([('server', 'Netlify')]) cloudflare_header = Headers([('server', 'cloudflare')]) @@ -77,6 +81,7 @@ def test_if_cdns_are_grouped_by_provider_name(self): self.assertEqual(len(kb.get('cdn_providers', 'cdn_providers')), 2) + @pytest.mark.deprecated def test_if_cdn_provider_can_be_detected_by_url(self): url = URL('https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css') empty_header = Headers() diff --git a/w3af/plugins/tests/grep/test_clamav.py b/w3af/plugins/tests/grep/test_clamav.py index 6ca95fe4b3..e1cfce9d4c 100644 --- a/w3af/plugins/tests/grep/test_clamav.py +++ b/w3af/plugins/tests/grep/test_clamav.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import time import unittest from itertools import repeat @@ -51,6 +52,7 @@ def tearDown(self): self.plugin.end() @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_clamav_eicar(self, *args): body = pyclamd.ClamdAgnostic().EICAR() url = URL('http://www.w3af.com/') @@ -75,6 +77,7 @@ def test_clamav_eicar(self, *args): self.assertEqual(finding.get_url().url_string, url.url_string) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_clamav_empty(self, *args): body = '' url = URL('http://www.w3af.com/') @@ -94,6 +97,7 @@ def test_clamav_empty(self, *args): self.assertEqual(len(findings), 0, findings) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_clamav_workers(self, *args): WAIT_TIME = 3 @@ -131,6 +135,7 @@ def wait(x, y): self.assertLessEqual(time_spent, WAIT_TIME + DELTA) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_no_clamav_eicar(self, *args): body = pyclamd.ClamdAgnostic().EICAR() url = URL('http://www.w3af.com/') @@ -173,6 +178,7 @@ def tearDown(self): super(TestClamAVScan, self).tearDown() self.plugin.end() + @pytest.mark.slow def test_found_vuln(self): """ Test to validate case in which malware is identified while crawling. @@ -193,4 +199,4 @@ def test_found_vuln(self): for finding in findings: self.assertIn(finding.get_url().get_file_name(), EXPECTED_FILES) self.assertEqual(finding.get_name(), 'Malware identified') - self.assertIn('ClamAV identified malware', finding.get_desc()) \ No newline at end of file + self.assertIn('ClamAV identified malware', finding.get_desc()) diff --git a/w3af/plugins/tests/grep/test_click_jacking.py b/w3af/plugins/tests/grep/test_click_jacking.py index d9d1321f0d..041a424715 100644 --- a/w3af/plugins/tests/grep/test_click_jacking.py +++ b/w3af/plugins/tests/grep/test_click_jacking.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import w3af.core.data.constants.severity as severity from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -46,6 +47,7 @@ class TestClickJackingVuln(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -84,6 +86,7 @@ class TestClickJackingProtectedXFrameOptions(PluginTest): } } + @pytest.mark.deprecated def test_no_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -116,6 +119,7 @@ class TestClickJackingCSPNone(PluginTest): } } + @pytest.mark.deprecated def test_no_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -148,6 +152,7 @@ class TestClickJackingCSPWildcard(PluginTest): } } + @pytest.mark.deprecated def test_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -180,6 +185,7 @@ class TestClickJackingCSPSpecificDomain(PluginTest): } } + @pytest.mark.deprecated def test_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -212,6 +218,7 @@ class TestClickJackingCSPSelf(PluginTest): } } + @pytest.mark.slow def test_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -244,6 +251,7 @@ class TestClickJackingCSPSelfAndSpecificDomain(PluginTest): } } + @pytest.mark.deprecated def test_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/grep/test_code_disclosure.py b/w3af/plugins/tests/grep/test_code_disclosure.py index 99c68f123b..d33855c011 100644 --- a/w3af/plugins/tests/grep/test_code_disclosure.py +++ b/w3af/plugins/tests/grep/test_code_disclosure.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from itertools import repeat @@ -54,6 +55,7 @@ def _build_request_response(self, body, url=None, headers=None, method=None): return request, response @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_ASP_code_disclosure(self, *args): body = 'header <% Response.Write("Hello World!") %> footer' request, response = self._build_request_response(body) @@ -62,6 +64,7 @@ def test_ASP_code_disclosure(self, *args): self.assertEqual(len(kb.kb.get('code_disclosure', 'code_disclosure')), 1) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_PHP_code_disclosure(self, *args): body = 'header footer' request, response = self._build_request_response(body) @@ -70,6 +73,7 @@ def test_PHP_code_disclosure(self, *args): self.assertEqual(len(kb.kb.get('code_disclosure', 'code_disclosure')), 1) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_no_code_disclosure_blank(self, *args): body = '' request, response = self._build_request_response(body) @@ -78,6 +82,7 @@ def test_no_code_disclosure_blank(self, *args): self.assertEqual(len(kb.kb.get('code_disclosure', 'code_disclosure')), 0) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_no_code_disclosure(self, *args): body = LOREM request, response = self._build_request_response(body) @@ -86,6 +91,7 @@ def test_no_code_disclosure(self, *args): self.assertEqual(len(kb.kb.get('code_disclosure', 'code_disclosure')), 0) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_no_code_disclosure_xml(self, *args): body = """ @@ -101,6 +107,7 @@ def test_no_code_disclosure_xml(self, *args): self.assertEqual(len(kb.kb.get('code_disclosure', 'code_disclosure')), 0) @patch('w3af.plugins.grep.code_disclosure.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_no_analysis_content_type(self, *args): body = 'header footer' request, response = self._build_request_response(body) diff --git a/w3af/plugins/tests/grep/test_content_sniffing.py b/w3af/plugins/tests/grep/test_content_sniffing.py index f94e9b4a8b..d5bab01399 100644 --- a/w3af/plugins/tests/grep/test_content_sniffing.py +++ b/w3af/plugins/tests/grep/test_content_sniffing.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -40,6 +41,7 @@ def tearDown(self): self.plugin.end() kb.kb.cleanup() + @pytest.mark.deprecated def test_has_content_sniffing_header(self): body = '' url = URL('http://www.w3af.com/') @@ -52,6 +54,7 @@ def test_has_content_sniffing_header(self): self.assertEquals(len(kb.kb.get('content_sniffing', 'content_sniffing')), 0) + @pytest.mark.deprecated def test_no_content_sniffing(self): body = '' url = URL('https://www.w3af.com/') @@ -75,6 +78,7 @@ def test_no_content_sniffing(self): self.assertEqual(info_set.get_name(), 'Missing X-Content-Type-Options header') + @pytest.mark.deprecated def test_no_content_sniffing_group_by_domain(self): body = '' url = URL('https://www.w3af.com/1') diff --git a/w3af/plugins/tests/grep/test_credit_cards.py b/w3af/plugins/tests/grep/test_credit_cards.py index 93c0327290..b4271e7629 100644 --- a/w3af/plugins/tests/grep/test_credit_cards.py +++ b/w3af/plugins/tests/grep/test_credit_cards.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest @@ -41,6 +42,7 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_find_credit_card(self): body = '378282246310005' url = URL('http://www.w3af.com/') @@ -50,6 +52,7 @@ def test_find_credit_card(self): self.plugin.grep(request, response) self.assertEquals(len(kb.kb.get('credit_cards', 'credit_cards')), 1) + @pytest.mark.deprecated def test_find_credit_card_spaces(self): body = '3566 0020 2036 0505' url = URL('http://www.w3af.com/') @@ -59,6 +62,7 @@ def test_find_credit_card_spaces(self): self.plugin.grep(request, response) self.assertEquals(len(kb.kb.get('credit_cards', 'credit_cards')), 1) + @pytest.mark.deprecated def test_find_credit_card_html(self): body = ' 378282246310005' url = URL('http://www.w3af.com/') @@ -68,6 +72,7 @@ def test_find_credit_card_html(self): self.plugin.grep(request, response) self.assertEquals(len(kb.kb.get('credit_cards', 'credit_cards')), 1) + @pytest.mark.deprecated def test_not_find_credit_cards(self): invalid_cards = ('b71449635402848', # Start with a letter '356 600 20203605 05', @@ -89,6 +94,7 @@ def test_not_find_credit_cards(self): len(kb.kb.get('credit_cards', 'credit_cards')), 0) kb.kb.clear('credit_cards', 'credit_cards') + @pytest.mark.deprecated def test_invalid_check_not_find_credit_card_spaces(self): body = '3566 0020 2036 0705' url = URL('http://www.w3af.com/') @@ -98,6 +104,7 @@ def test_invalid_check_not_find_credit_card_spaces(self): self.plugin.grep(request, response) self.assertEquals(len(kb.kb.get('credit_cards', 'credit_cards')), 0) + @pytest.mark.deprecated def test_find_credit_card_performance_true(self): credit_card = '3566 0020 2036 0505' diff --git a/w3af/plugins/tests/grep/test_cross_domain_js.py b/w3af/plugins/tests/grep/test_cross_domain_js.py index 651b8eb823..fba40e5689 100644 --- a/w3af/plugins/tests/grep/test_cross_domain_js.py +++ b/w3af/plugins/tests/grep/test_cross_domain_js.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from nose.plugins.attrib import attr @@ -49,6 +50,7 @@ class TestCrossDomainJS(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -82,6 +84,7 @@ def setUp(self): def tearDown(self): kb.kb.cleanup() + @pytest.mark.deprecated def test_cross_domain_third_party_is_secure(self): body = '' url = URL('http://www.w3af.com/') @@ -95,6 +98,7 @@ def test_cross_domain_third_party_is_secure(self): infos = kb.kb.get('cross_domain_js', 'cross_domain_js') self.assertEquals(len(infos), 0) + @pytest.mark.deprecated def test_cross_domain_third_party_is_insecure(self): body = '' url = URL('http://www.w3af.com/') @@ -108,6 +112,7 @@ def test_cross_domain_third_party_is_insecure(self): infos = kb.kb.get('cross_domain_js', 'cross_domain_js') self.assertEquals(len(infos), 1) + @pytest.mark.deprecated def test_cross_domain_third_party_is_insecure_group_info_set(self): body = '' url_1 = URL('http://www.w3af.com/1') diff --git a/w3af/plugins/tests/grep/test_csp.py b/w3af/plugins/tests/grep/test_csp.py index cdb80eb6e0..2744e977b3 100644 --- a/w3af/plugins/tests/grep/test_csp.py +++ b/w3af/plugins/tests/grep/test_csp.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -39,6 +40,7 @@ class TestCSP(PluginTest): }, } + @pytest.mark.deprecated def test_found_vuln(self): """ Test to validate case in which error are found: diff --git a/w3af/plugins/tests/grep/test_directory_indexing.py b/w3af/plugins/tests/grep/test_directory_indexing.py index 211d486f6c..ab7a4f1136 100644 --- a/w3af/plugins/tests/grep/test_directory_indexing.py +++ b/w3af/plugins/tests/grep/test_directory_indexing.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.core.controllers.ci.moth import get_moth_http @@ -40,6 +41,7 @@ class TestDirectoryIndexing(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg1'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/grep/test_dom_xss.py b/w3af/plugins/tests/grep/test_dom_xss.py index 3e35110130..7048f5ebe4 100644 --- a/w3af/plugins/tests/grep/test_dom_xss.py +++ b/w3af/plugins/tests/grep/test_dom_xss.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.core.controllers.ci.moth import get_moth_http @@ -45,6 +46,7 @@ class TestDOMXSS(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/grep/test_dot_net_event_validation.py b/w3af/plugins/tests/grep/test_dot_net_event_validation.py index 21427ebab4..9891ecb7b1 100644 --- a/w3af/plugins/tests/grep/test_dot_net_event_validation.py +++ b/w3af/plugins/tests/grep/test_dot_net_event_validation.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -41,6 +42,7 @@ class TestEventValidation(PluginTest): target_url = get_moth_http('/grep/dot_net_event_validation/') + @pytest.mark.deprecated def test_found_vuln(self): self._scan(self.target_url, RUN_CONFIGS['cfg']['plugins']) @@ -91,6 +93,7 @@ class TestEventValidationGrouping(PluginTest): body=html, method='GET', status=200)] + @pytest.mark.deprecated def test_grouped_vulnerabilities(self): self._scan(self.target_url, RUN_CONFIGS['cfg']['plugins']) diff --git a/w3af/plugins/tests/grep/test_error_500.py b/w3af/plugins/tests/grep/test_error_500.py index a8d996fc87..54126f4682 100644 --- a/w3af/plugins/tests/grep/test_error_500.py +++ b/w3af/plugins/tests/grep/test_error_500.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr from w3af.core.controllers.ci.moth import get_moth_http @@ -38,6 +39,7 @@ class TestError500(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg1'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/grep/test_error_pages.py b/w3af/plugins/tests/grep/test_error_pages.py index e22edab844..bba045587d 100644 --- a/w3af/plugins/tests/grep/test_error_pages.py +++ b/w3af/plugins/tests/grep/test_error_pages.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from nose.plugins.attrib import attr import w3af.core.data.constants.severity as severity @@ -47,6 +48,7 @@ class TestErrorPages(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -64,6 +66,7 @@ def setUp(self): super(TestErrorPages, self).setUp() kb.kb.cleanup() + @pytest.mark.deprecated def test_found_vuln_max_reports(self): kb.kb.cleanup() plugin = error_pages() @@ -83,6 +86,7 @@ def test_found_vuln_max_reports(self): self.assertEqual(len(kb.kb.get('error_pages', 'error_page')), plugin.MAX_REPORTED_PER_MSG + 1) + @pytest.mark.deprecated def test_found_vuln_max_reports_two_different(self): kb.kb.cleanup() plugin = error_pages() diff --git a/w3af/plugins/tests/grep/test_expect_ct.py b/w3af/plugins/tests/grep/test_expect_ct.py index 2092610d50..4a03412cf5 100644 --- a/w3af/plugins/tests/grep/test_expect_ct.py +++ b/w3af/plugins/tests/grep/test_expect_ct.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -40,6 +41,7 @@ def tearDown(self): self.plugin.end() kb.kb.cleanup() + @pytest.mark.deprecated def test_http_no_vuln(self): body = '' url = URL('http://www.w3af.com/') @@ -51,6 +53,7 @@ def test_http_no_vuln(self): self.assertEquals(len(kb.kb.get('expect_ct', 'expect_ct')), 0) + @pytest.mark.deprecated def test_https_with_ect(self): body = '' url = URL('https://www.w3af.com/') @@ -64,6 +67,7 @@ def test_https_with_ect(self): self.assertEquals(len(kb.kb.get('expect_ct', 'expect_ct')), 0) + @pytest.mark.deprecated def test_https_without_ect(self): body = '' url = URL('https://www.w3af.com/') @@ -88,6 +92,7 @@ def test_https_without_ect(self): self.assertEqual(info_set.get_name(), 'Missing Expect-CT header') + @pytest.mark.deprecated def test_https_without_ect_group_by_domain(self): body = '' url = URL('https://www.w3af.com/1') diff --git a/w3af/plugins/tests/grep/test_feeds.py b/w3af/plugins/tests/grep/test_feeds.py index 2c0c28be72..c173d0d8ea 100644 --- a/w3af/plugins/tests/grep/test_feeds.py +++ b/w3af/plugins/tests/grep/test_feeds.py @@ -1,4 +1,6 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated test_feeds.py Copyright 2012 Andres Riancho @@ -19,6 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -38,6 +41,7 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_rss(self): body = 'header footer' url = URL('http://www.w3af.com/') @@ -51,6 +55,7 @@ def test_rss(self): self.assertTrue('RSS' in i.get_desc()) self.assertTrue('3' in i.get_desc()) + @pytest.mark.deprecated def test_feed(self): body = 'header footer' url = URL('http://www.w3af.com/') @@ -64,6 +69,7 @@ def test_feed(self): self.assertTrue('OPML' in i.get_desc()) self.assertTrue('3' in i.get_desc()) + @pytest.mark.deprecated def test_opml(self): body = 'header footer' url = URL('http://www.w3af.com/') @@ -77,6 +83,7 @@ def test_opml(self): self.assertTrue('OPML' in i.get_desc()) self.assertTrue('3' in i.get_desc()) + @pytest.mark.deprecated def test_no_feeds(self): body = 'header footer' url = URL('http://www.w3af.com/') @@ -87,6 +94,7 @@ def test_no_feeds(self): self.assertEquals(len(kb.kb.get('feeds', 'feeds')), 0) + @pytest.mark.deprecated def test_no_version(self): body = 'header footer' url = URL('http://www.w3af.com/') diff --git a/w3af/plugins/tests/grep/test_file_upload.py b/w3af/plugins/tests/grep/test_file_upload.py index a50e20876f..a29e2c2708 100644 --- a/w3af/plugins/tests/grep/test_file_upload.py +++ b/w3af/plugins/tests/grep/test_file_upload.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -38,6 +39,7 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_simple(self): body = 'header
footer' url = URL('http://www.w3af.com/') @@ -50,6 +52,7 @@ def test_simple(self): i = kb.kb.get('file_upload', 'file_upload')[0] self.assertEquals(i.get_name(), 'File upload form') + @pytest.mark.deprecated def test_complex(self): body = 'header
footer' url = URL('http://www.w3af.com/') @@ -62,6 +65,7 @@ def test_complex(self): i = kb.kb.get('file_upload', 'file_upload')[0] self.assertEquals(i.get_name(), 'File upload form') + @pytest.mark.deprecated def test_none(self): body = 'header
footer' url = URL('http://www.w3af.com/') diff --git a/w3af/plugins/tests/grep/test_form_autocomplete.py b/w3af/plugins/tests/grep/test_form_autocomplete.py index 4eb08e6452..2a59eb2ce9 100644 --- a/w3af/plugins/tests/grep/test_form_autocomplete.py +++ b/w3af/plugins/tests/grep/test_form_autocomplete.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -48,6 +49,7 @@ class TestFormAutocomplete(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg1'] self._scan(cfg['target'], cfg['plugins']) @@ -74,6 +76,7 @@ def setUp(self): def tearDown(self): kb.kb.cleanup() + @pytest.mark.deprecated def test_form_autocomplete_group_info_set(self): body = '
' url_1 = URL('http://www.w3af.com/1') diff --git a/w3af/plugins/tests/grep/test_form_cleartext_password.py b/w3af/plugins/tests/grep/test_form_cleartext_password.py index f929da5e23..f7cc33528d 100644 --- a/w3af/plugins/tests/grep/test_form_cleartext_password.py +++ b/w3af/plugins/tests/grep/test_form_cleartext_password.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -38,6 +39,7 @@ def tearDown(self): self.plugin.end() #Vulnerable to insecure form data submission over HTTP + @pytest.mark.deprecated def test_vs1(self, *args): body = 'header
' \ '' \ @@ -53,6 +55,7 @@ def test_vs1(self, *args): kb.kb.get('form_cleartext_password', 'form_cleartext_password') [0].get_name() == 'Insecure password submission over HTTP', 1) + @pytest.mark.deprecated def test_vs2(self, *args): body = 'header ' \ '
footer' @@ -68,6 +71,7 @@ def test_vs2(self, *args): kb.kb.get('form_cleartext_password','form_cleartext_password') [0].get_name() =='Insecure password submission over HTTP', 1) + @pytest.mark.deprecated def test_vs3(self, *args): body = 'header
' \ '
footer' @@ -83,6 +87,7 @@ def test_vs3(self, *args): kb.kb.get('form_cleartext_password','form_cleartext_password') [0].get_name() == 'Insecure password submission over HTTP', 1) + @pytest.mark.deprecated def test_vs4(self, *args): body = 'header
' \ '
footer' @@ -98,6 +103,7 @@ def test_vs4(self, *args): kb.kb.get('form_cleartext_password','form_cleartext_password') [0].get_name() == 'Insecure password submission over HTTP', 1) + @pytest.mark.deprecated def test_vs5(self, *args): body = 'header
' \ '
footer' @@ -113,6 +119,7 @@ def test_vs5(self, *args): kb.kb.get('form_cleartext_password','form_cleartext_password') [0].get_name() =='Insecure password submission over HTTP', 1) + @pytest.mark.deprecated def test_m1(self, *args): """ Vulnerable to MITM since login form was submitted over HTTP @@ -131,6 +138,7 @@ def test_m1(self, *args): kb.kb.get('form_cleartext_password','form_cleartext_password') [0].get_name() == 'Insecure password form access over HTTP', 1) + @pytest.mark.deprecated def test_d1(self, *args): """ Vulnerable to MITM with double password input @@ -151,6 +159,7 @@ def test_d1(self, *args): kb.kb.get('form_cleartext_password', 'form_cleartext_password') [0].get_name() == 'Insecure password form access over HTTP', 1) + @pytest.mark.deprecated def test_n1(self, *args): """ Not vulnerable @@ -166,6 +175,7 @@ def test_n1(self, *args): len(kb.kb.get('form_cleartext_password', 'form_cleartext_password')), 0) + @pytest.mark.deprecated def test_n2(self, *args): body = 'header
' \ '
footer' @@ -178,6 +188,7 @@ def test_n2(self, *args): len(kb.kb.get('form_cleartext_password', 'form_cleartext_password')), 0) + @pytest.mark.deprecated def test_n3(self, *args): body = 'header
' \ '
footer' @@ -190,6 +201,7 @@ def test_n3(self, *args): len(kb.kb.get('form_cleartext_password', 'form_cleartext_password')), 0) + @pytest.mark.deprecated def test_n4(self, *args): body = 'header
' \ '
footer' @@ -202,6 +214,7 @@ def test_n4(self, *args): len(kb.kb.get('form_cleartext_password', 'form_cleartext_password')), 0) + @pytest.mark.deprecated def test_n5(self, *args): body = 'header
' \ '
footer' @@ -214,6 +227,7 @@ def test_n5(self, *args): len(kb.kb.get('form_cleartext_password', 'form_cleartext_password')), 0) + @pytest.mark.deprecated def test_n6(self, *args): body = 'header
' \ '
footer' @@ -226,6 +240,7 @@ def test_n6(self, *args): len(kb.kb.get('form_cleartext_password', 'form_cleartext_password')), 0) + @pytest.mark.deprecated def test_n7(self, *args): body = 'header
' \ '
footer' @@ -238,6 +253,7 @@ def test_n7(self, *args): len(kb.kb.get('form_cleartext_password', 'form_cleartext_password')), 0) + @pytest.mark.deprecated def test_n8(self, *args): body = 'header
' \ 'footer' @@ -248,4 +264,4 @@ def test_n8(self, *args): self.plugin.grep(request, response) self.assertEqual( len(kb.kb.get('form_cleartext_password', - 'form_cleartext_password')), 0) \ No newline at end of file + 'form_cleartext_password')), 0) diff --git a/w3af/plugins/tests/grep/test_get_emails.py b/w3af/plugins/tests/grep/test_get_emails.py index 1795525175..8c58d9f7e5 100644 --- a/w3af/plugins/tests/grep/test_get_emails.py +++ b/w3af/plugins/tests/grep/test_get_emails.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -52,6 +53,7 @@ class TestGetEmails(PluginTest): } } + @pytest.mark.deprecated def test_found_emails(self): cfg = self._run_configs['cfg1'] self._scan(cfg['target'], cfg['plugins']) @@ -80,6 +82,7 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_group_by_email(self): headers = Headers([('content-type', 'text/html')]) diff --git a/w3af/plugins/tests/grep/test_html_comments.py b/w3af/plugins/tests/grep/test_html_comments.py index a29e055492..bb1e51047f 100644 --- a/w3af/plugins/tests/grep/test_html_comments.py +++ b/w3af/plugins/tests/grep/test_html_comments.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -59,6 +60,7 @@ class TestHTMLCommentsIntegration(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg1'] self._scan(cfg['target'], cfg['plugins']) @@ -87,6 +89,7 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_html_comment(self): body = '' url = URL('http://www.w3af.com/') @@ -99,6 +102,7 @@ def test_html_comment(self): info_sets = kb.kb.get('html_comments', 'interesting_comments') self.assertEquals(len(info_sets), 1) + @pytest.mark.deprecated def test_html_comment_profiling(self): body = '' url = URL('http://www.w3af.com/') diff --git a/w3af/plugins/tests/grep/test_http_auth_detect.py b/w3af/plugins/tests/grep/test_http_auth_detect.py index 5f0b167831..f8c792f608 100644 --- a/w3af/plugins/tests/grep/test_http_auth_detect.py +++ b/w3af/plugins/tests/grep/test_http_auth_detect.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -41,12 +42,14 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_http_auth_detect_negative(self): response = HTTPResponse(200, '', self.headers, self.url, self.url, _id=1) self.plugin.grep(self.request, response) self.assertEqual(len(kb.kb.get('http_auth_detect', 'auth')), 0) self.assertEqual(len(kb.kb.get('http_auth_detect', 'userPassUri')), 0) + @pytest.mark.deprecated def test_http_auth_detect_negative_long(self): body = 'ABC ' * 10000 response = HTTPResponse(200, body, self.headers, self.url, self.url, _id=1) @@ -54,6 +57,7 @@ def test_http_auth_detect_negative_long(self): self.assertEqual(len(kb.kb.get('http_auth_detect', 'auth')), 0) self.assertEqual(len(kb.kb.get('http_auth_detect', 'userPassUri')), 0) + @pytest.mark.deprecated def test_http_auth_detect_uri(self): body = 'ABC ' * 100 body += 'test' @@ -63,6 +67,7 @@ def test_http_auth_detect_uri(self): self.assertEqual(len(kb.kb.get('http_auth_detect', 'auth')), 0) self.assertEqual(len(kb.kb.get('http_auth_detect', 'userPassUri')), 1) + @pytest.mark.deprecated def test_http_auth_detect_non_rfc(self): body = '' response = HTTPResponse(401, body, self.headers, self.url, self.url, _id=1) @@ -71,6 +76,7 @@ def test_http_auth_detect_non_rfc(self): len(kb.kb.get('http_auth_detect', 'non_rfc_auth')), 1) self.assertEqual(len(kb.kb.get('http_auth_detect', 'userPassUri')), 0) + @pytest.mark.deprecated def test_http_auth_detect_simple(self): body = '' hdrs = {'content-type': 'text/html', 'www-authenticate': 'realm-w3af'} diff --git a/w3af/plugins/tests/grep/test_http_in_body.py b/w3af/plugins/tests/grep/test_http_in_body.py index e0d5e0377d..395be2e8f2 100644 --- a/w3af/plugins/tests/grep/test_http_in_body.py +++ b/w3af/plugins/tests/grep/test_http_in_body.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.plugins.tests.helper import PluginTest, PluginConfig import w3af.core.data.constants.severity as severity @@ -41,6 +42,7 @@ class TestHttpInBody(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/grep/test_keys.py b/w3af/plugins/tests/grep/test_keys.py index 8f73046692..6ede0ec39c 100644 --- a/w3af/plugins/tests/grep/test_keys.py +++ b/w3af/plugins/tests/grep/test_keys.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import os import unittest @@ -43,6 +44,7 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_private_key(self): body = '-----BEGIN PRIVATE KEY-----' url = URL('http://www.w3af.com/') @@ -55,6 +57,7 @@ def test_private_key(self): self.assertEquals(len(data), 1) self.assertEquals(type(data[0]), Vuln) + @pytest.mark.deprecated def test_public_key(self): body = '-----BEGIN PUBLIC KEY-----' url = URL('http://www.w3af.com/') @@ -67,6 +70,7 @@ def test_public_key(self): self.assertEquals(len(data), 1) self.assertEquals(type(data[0]), Info) + @pytest.mark.deprecated def test_xml_key(self): body = '' url = URL('http://www.w3af.com/') @@ -78,6 +82,7 @@ def test_xml_key(self): data = kb.kb.get('keys', 'keys') self.assertEquals(len(data), 1) + @pytest.mark.deprecated def test_public_ecdsa_key(self): body = 'ecdsa-sha2-nistp256' url = URL('http://www.w3af.com/') @@ -90,6 +95,7 @@ def test_public_ecdsa_key(self): self.assertEquals(len(data), 1) self.assertEquals(type(data[0]), Info) + @pytest.mark.deprecated def test_multi_match(self): body = """ -----BEGIN OPENSSH PRIVATE KEY----- ssh-ed25519 @@ -104,6 +110,7 @@ def test_multi_match(self): data = kb.kb.get('keys', 'keys') self.assertEquals(len(data), 3) + @pytest.mark.deprecated def test_no_match(self): body = '-----BEGIN-----ssh----- BEGIN PRIVATE PUBLIC KEY' url = URL('http://www.w3af.com/') diff --git a/w3af/plugins/tests/grep/test_lang.py b/w3af/plugins/tests/grep/test_lang.py index 77d3940c01..244af0b0ec 100644 --- a/w3af/plugins/tests/grep/test_lang.py +++ b/w3af/plugins/tests/grep/test_lang.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.plugins.tests.helper import PluginTest, PluginConfig @@ -47,6 +48,7 @@ class TestLang(PluginTest): } } + @pytest.mark.deprecated def test_id_es(self): cfg = self._run_configs['direct'] self._scan(self.langs_url % 'es', cfg['plugins']) @@ -54,6 +56,7 @@ def test_id_es(self): lang = self.kb.raw_read('lang', 'lang') self.assertEquals('es', lang) + @pytest.mark.deprecated def test_id_en(self): cfg = self._run_configs['direct'] self._scan(self.langs_url % 'en', cfg['plugins']) @@ -61,6 +64,7 @@ def test_id_en(self): lang = self.kb.raw_read('lang', 'lang') self.assertEquals('en', lang) + @pytest.mark.deprecated def test_id_en_crawl(self): cfg = self._run_configs['crawl'] self._scan(self.langs_url % 'en', cfg['plugins']) diff --git a/w3af/plugins/tests/grep/test_meta_generator.py b/w3af/plugins/tests/grep/test_meta_generator.py index e68f0fd409..af6beeb1e4 100644 --- a/w3af/plugins/tests/grep/test_meta_generator.py +++ b/w3af/plugins/tests/grep/test_meta_generator.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from itertools import repeat @@ -50,6 +51,7 @@ def tearDown(self): self.plugin.end() @patch('w3af.plugins.grep.meta_generator.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_detects_meta_tags_with_generator(self, *args): request = FuzzableRequest(self.url) response = self._generate_response('') @@ -69,6 +71,7 @@ def test_detects_meta_tags_with_generator(self, *args): self.assertEquals(info_set.get_desc(), expected_desc) @patch('w3af.plugins.grep.meta_generator.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_groups_findings(self, *args): request = FuzzableRequest(self.url) @@ -98,6 +101,7 @@ def test_groups_findings(self, *args): self.assertEquals(descs, {expected_desc_1, expected_desc_2}) @patch('w3af.plugins.grep.meta_generator.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_avoid_false_positive_0(self, *args): request = FuzzableRequest(self.url) response = self._generate_response('') @@ -109,6 +113,7 @@ def test_avoid_false_positive_0(self, *args): self.assertEqual(len(info_sets), 0) @patch('w3af.plugins.grep.meta_generator.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_avoid_false_positive_1(self, *args): request = FuzzableRequest(self.url) response = self._generate_response('') @@ -120,6 +125,7 @@ def test_avoid_false_positive_1(self, *args): self.assertEqual(len(info_sets), 0) @patch('w3af.plugins.grep.meta_generator.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_avoid_false_positive_2(self, *args): request = FuzzableRequest(self.url) response = self._generate_response('') diff --git a/w3af/plugins/tests/grep/test_meta_tags.py b/w3af/plugins/tests/grep/test_meta_tags.py index 36a9011259..c80dc4eb21 100644 --- a/w3af/plugins/tests/grep/test_meta_tags.py +++ b/w3af/plugins/tests/grep/test_meta_tags.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from itertools import repeat @@ -53,6 +54,7 @@ class TestMetaTags(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg1'] self._scan(cfg['target'], cfg['plugins']) @@ -82,6 +84,7 @@ def tearDown(self): kb.kb.cleanup() @patch('w3af.plugins.grep.meta_tags.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_meta_user(self, *args): body = '' url = URL('http://www.w3af.com/') @@ -100,6 +103,7 @@ def test_meta_user(self, *args): self.assertIn('pass', info.get_desc()) @patch('w3af.plugins.grep.meta_tags.is_404', side_effect=repeat(False)) + @pytest.mark.deprecated def test_group_info_set(self, *args): body = '' url_1 = URL('http://www.w3af.com/1') @@ -124,4 +128,4 @@ def test_group_info_set(self, *args): info_set = kb.kb.get_one('meta_tags', 'meta_tags') self.assertEqual(set(info_set.get_urls()), {url_1, url_2}) self.assertEqual(info_set.get_desc(), expected_desc) - # pylint: enable=E1103 \ No newline at end of file + # pylint: enable=E1103 diff --git a/w3af/plugins/tests/grep/test_motw.py b/w3af/plugins/tests/grep/test_motw.py index 81032aedc9..d766f00d64 100644 --- a/w3af/plugins/tests/grep/test_motw.py +++ b/w3af/plugins/tests/grep/test_motw.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import w3af.core.data.constants.severity as severity from w3af.plugins.tests.helper import PluginTest, PluginConfig, MockResponse @@ -46,6 +47,7 @@ class TestValidMOTW(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) @@ -82,6 +84,7 @@ class TestInvalidMOTW(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/grep/test_objects.py b/w3af/plugins/tests/grep/test_objects.py index 30f6586f04..16899f380e 100644 --- a/w3af/plugins/tests/grep/test_objects.py +++ b/w3af/plugins/tests/grep/test_objects.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -29,6 +30,7 @@ from w3af.core.data.dc.headers import Headers +@pytest.mark.deprecated class test_objects(unittest.TestCase): def setUp(self): @@ -56,6 +58,7 @@ def test_object(self): i = kb.kb.get('objects', 'object')[0] self.assertTrue('"object"' in i.get_desc()) + @pytest.mark.deprecated def test_applet(self): body = """header ' 'x' @@ -85,6 +92,7 @@ def test_strange_parameters_find_sql(self): self.assertEquals(len(kb.kb.get('strange_parameters', 'strange_parameters')), 1) + @pytest.mark.deprecated def test_multi(self): body = """ x @@ -95,6 +103,7 @@ def test_multi(self): vulns = kb.kb.get('strange_parameters', 'strange_parameters') self.assertEquals(len(vulns), 2, vulns) + @pytest.mark.deprecated def test_strange_parameters_sent_false_positive_01(self): body = ('') @@ -108,6 +117,7 @@ def test_strange_parameters_sent_false_positive_01(self): self.assertEquals(len(kb.kb.get('strange_parameters', 'strange_parameters')), 0) + @pytest.mark.deprecated def test_strange_parameters_sent_false_positive_02(self): body = 'xyz' diff --git a/w3af/plugins/tests/grep/test_strange_reason.py b/w3af/plugins/tests/grep/test_strange_reason.py index 6deb42e81f..a38ef37713 100644 --- a/w3af/plugins/tests/grep/test_strange_reason.py +++ b/w3af/plugins/tests/grep/test_strange_reason.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -41,30 +42,35 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_strange_reason_empty(self): response = HTTPResponse(200, '', self.headers, self.url, self.url, _id=1, msg='Ok') self.plugin.grep(self.request, response) self.assertEquals(len(kb.kb.get('strange_reason', 'strange_reason')), 0) + @pytest.mark.deprecated def test_strange_reason_large(self): response = HTTPResponse(300, 'A' * 4096, self.headers, self.url, self.url, _id=1, msg='Multiple Choices') self.plugin.grep(self.request, response) self.assertEquals(len(kb.kb.get('strange_reason', 'strange_reason')), 0) + @pytest.mark.deprecated def test_strange_reason_found_200(self): response = HTTPResponse(200, 'A' * 4096, self.headers, self.url, self.url, _id=1, msg='Foo!') self.plugin.grep(self.request, response) self.assertEquals(len(kb.kb.get('strange_reason', 'strange_reason')), 1) + @pytest.mark.deprecated def test_strange_reason_found_300(self): response = HTTPResponse(300, 'A' * 2 ** 10, self.headers, self.url, self.url, _id=1, msg='Multiple') self.plugin.grep(self.request, response) self.assertEquals(len(kb.kb.get('strange_reason', 'strange_reason')), 1) + @pytest.mark.deprecated def test_group_by_reason(self): response = HTTPResponse(200, '', self.headers, self.url, self.url, _id=1, msg='Foos') @@ -86,6 +92,7 @@ def test_group_by_reason(self): self.assertEqual(info_set.get_id(), [1, 3]) self.assertEqual(info_set.get_desc(), expected_desc) + @pytest.mark.deprecated def test_no_group_by_different_reason(self): response = HTTPResponse(200, '', self.headers, self.url, self.url, _id=1, msg='Foo') diff --git a/w3af/plugins/tests/grep/test_strict_transport_security.py b/w3af/plugins/tests/grep/test_strict_transport_security.py index e9c69ecf73..ec95cbd6a4 100644 --- a/w3af/plugins/tests/grep/test_strict_transport_security.py +++ b/w3af/plugins/tests/grep/test_strict_transport_security.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -40,6 +41,7 @@ def tearDown(self): self.plugin.end() kb.kb.cleanup() + @pytest.mark.deprecated def test_http_no_vuln(self): body = '' url = URL('http://www.w3af.com/') @@ -51,6 +53,7 @@ def test_http_no_vuln(self): self.assertEquals(len(kb.kb.get('strict_transport_security', 'strict_transport_security')), 0) + @pytest.mark.deprecated def test_https_with_sts(self): body = '' url = URL('https://www.w3af.com/') @@ -64,6 +67,7 @@ def test_https_with_sts(self): self.assertEquals(len(kb.kb.get('strict_transport_security', 'strict_transport_security')), 0) + @pytest.mark.deprecated def test_https_without_sts(self): body = '' url = URL('https://www.w3af.com/') @@ -88,6 +92,7 @@ def test_https_without_sts(self): self.assertEqual(info_set.get_name(), 'Missing Strict Transport Security header') + @pytest.mark.deprecated def test_https_without_sts_group_by_domain(self): body = '' url = URL('https://www.w3af.com/1') diff --git a/w3af/plugins/tests/grep/test_svn_users.py b/w3af/plugins/tests/grep/test_svn_users.py index 5c73bb8ef8..0f0573ffdd 100644 --- a/w3af/plugins/tests/grep/test_svn_users.py +++ b/w3af/plugins/tests/grep/test_svn_users.py @@ -18,6 +18,7 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest from w3af.core.controllers.ci.moth import get_moth_http from w3af.plugins.tests.helper import PluginTest, PluginConfig import w3af.core.data.constants.severity as severity @@ -41,6 +42,7 @@ class TestSVNUsers(PluginTest): } } + @pytest.mark.deprecated def test_found_vuln(self): cfg = self._run_configs['cfg1'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/grep/test_symfony.py b/w3af/plugins/tests/grep/test_symfony.py index 9b26022dab..6f0947261c 100644 --- a/w3af/plugins/tests/grep/test_symfony.py +++ b/w3af/plugins/tests/grep/test_symfony.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest from functools import partial @@ -58,32 +59,38 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_symfony_positive(self): response = self.http_resp( read=self.EMPTY_BODY, headers=self.SYMFONY_HEADERS) self.assertTrue(self.plugin.symfony_detected(response)) + @pytest.mark.deprecated def test_symfony_negative(self): response = self.http_resp( read=self.EMPTY_BODY, headers=self.NON_SYMFONY_HEADERS) self.assertFalse(self.plugin.symfony_detected(response)) + @pytest.mark.deprecated def test_symfony_override(self): self.plugin._override = True response = self.http_resp(read=self.EMPTY_BODY, headers=self.SYMFONY_HEADERS) self.assertTrue(self.plugin.symfony_detected(response)) + @pytest.mark.deprecated def test_symfony_csrf_positive(self): response = self.http_resp(read=self.PROTECTED_BODY, headers=self.SYMFONY_HEADERS) self.assertTrue(self.plugin.has_csrf_token(response)) + @pytest.mark.deprecated def test_symfony_csrf_negative(self): response = self.http_resp(read=self.UNPROTECTED_BODY, headers=self.SYMFONY_HEADERS) self.assertFalse(self.plugin.has_csrf_token(response)) + @pytest.mark.deprecated def test_symfony_protected(self): response = self.http_resp( read=self.PROTECTED_BODY, headers=self.SYMFONY_HEADERS) @@ -91,6 +98,7 @@ def test_symfony_protected(self): self.plugin.grep(request, response) self.assertEquals(len(kb.kb.get('symfony', 'symfony')), 0) + @pytest.mark.deprecated def test_symfony_unprotected(self): request = FuzzableRequest(self.url, method='GET') response = self.http_resp( diff --git a/w3af/plugins/tests/grep/test_url_session.py b/w3af/plugins/tests/grep/test_url_session.py index 9b4e4014f1..ee85d781e6 100644 --- a/w3af/plugins/tests/grep/test_url_session.py +++ b/w3af/plugins/tests/grep/test_url_session.py @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -40,6 +41,7 @@ def setUp(self): def tearDown(self): self.plugin.end() + @pytest.mark.deprecated def test_url_session_false(self): body = 'abc' url = URL('http://www.w3af.com/') @@ -52,6 +54,7 @@ def test_url_session_false(self): infos = kb.kb.get('url_session', 'url_session') self.assertEquals(len(infos), 0) + @pytest.mark.deprecated def test_url_session_in_url(self): body = 'abc' url = URL('http://www.w3af.com/?JSESSIONID=231badb19b93e44f47da1bd64a8147f2') @@ -67,6 +70,7 @@ def test_url_session_in_url(self): info = infos[0] self.assertEqual(info.get_name(), 'Session ID in URL') + @pytest.mark.deprecated def test_url_session_in_body(self): url = 'http://www.w3af.com/?JSESSIONID=231badb19b93e44f47da1bd64a8147f2' body = 'abc def footer' % url @@ -83,6 +87,7 @@ def test_url_session_in_body(self): info = infos[0] self.assertEqual(info.get_name(), 'Session ID in URL') + @pytest.mark.deprecated def test_url_session_in_body_and_url(self): url = 'http://www.w3af.com/?JSESSIONID=231badb19b93e44f47da1bd64a8147f2' body = 'abc def footer' % url diff --git a/w3af/plugins/tests/grep/test_user_defined_regex.py b/w3af/plugins/tests/grep/test_user_defined_regex.py index 273f5a3d81..411fe6fd0d 100644 --- a/w3af/plugins/tests/grep/test_user_defined_regex.py +++ b/w3af/plugins/tests/grep/test_user_defined_regex.py @@ -1,4 +1,7 @@ """ +@pytest.mark.deprecated +@pytest.mark.deprecated +@pytest.mark.deprecated test_user_defined_regex.py Copyright 2012 Andres Riancho @@ -19,6 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest import unittest import w3af.core.data.kb.knowledge_base as kb @@ -34,6 +38,7 @@ class test_user_defined_regex(unittest.TestCase): def setUp(self): self.plugin = user_defined_regex() + @pytest.mark.deprecated def test_user_defined_regex(self): body = '' url = URL('http://www.w3af.com/') @@ -381,7 +409,12 @@ def test_get_tags_by_filter_empty_tag(self): tags = self.mpdoc.get_tags_by_filter(resp, ('script',), yield_text=True) # Note that lxml returns None for this tag text: - self.assertEqual([Tag('script', {'src': 'foo.js'}, None)], tags) + assert [Tag('script', {'src': 'foo.js'}, None)] == tags + + def test_it_doesnt_silence_type_error_from_document_parser(self, html_response): + self.mpdoc._document_parser_class = MockedDamagedDocumentParser + with pytest.raises(TypeError): + self.mpdoc.get_document_parser_for(html_response) def daemon_child(queue): @@ -390,6 +423,11 @@ def daemon_child(queue): queue.put(False) +class MockedDamagedDocumentParser: + def __init__(self): + raise TypeError('unit-test') + + class DelayedParser(object): def __init__(self, http_response): self.http_response = http_response diff --git a/w3af/plugins/tests/plugin_testing_tools.py b/w3af/plugins/tests/plugin_testing_tools.py index ab9f3936ea..56d677217e 100644 --- a/w3af/plugins/tests/plugin_testing_tools.py +++ b/w3af/plugins/tests/plugin_testing_tools.py @@ -43,7 +43,7 @@ def run_plugin( :param Plugin plugin: plugin class or instance :param dict plugin_config: dict which will be used to pass options with plugin.set_options - :param pytest.fixture mock_domain: pytest fixture to mock requests to + :param dict mock_domain: pytest fixture to mock requests to specific domain :param bool do_end_call: if False plugin.end() won't be called :param dict extra_options: extra options for plugin runner used in certain @@ -63,34 +63,37 @@ def run_plugin( plugin_instance = plugin() else: plugin_instance = plugin - - self._patch_network(mock_domain, plugin_instance) - self.plugin_last_ran = plugin_instance - if plugin_config: - self.set_options_to_plugin(plugin_instance, plugin_config) - - result = None - did_plugin_run = False - - if isinstance(plugin_instance, AuthPlugin): - result = run_auth_plugin(plugin_instance) - did_plugin_run = True - if isinstance(plugin_instance, CrawlPlugin): - result = run_crawl_plugin(plugin_instance, extra_options) - did_plugin_run = True - - if do_end_call: - plugin_instance.end() - - if not did_plugin_run: - raise TestPluginError( - "Can't find any way to run plugin {}. Is it already implemented?".format( - plugin_instance, + self.mocked_server = MockedServer(url_mapping=mock_domain) + with NetworkPatcher( + mock_domain, + mocked_server=self.mocked_server, + plugin_instance=plugin_instance, + ): + if plugin_config: + self.set_options_to_plugin(plugin_instance, plugin_config) + + result = None + did_plugin_run = False + + if isinstance(plugin_instance, AuthPlugin): + result = run_auth_plugin(plugin_instance) + did_plugin_run = True + if isinstance(plugin_instance, CrawlPlugin): + result = run_crawl_plugin(plugin_instance, extra_options) + did_plugin_run = True + + if do_end_call: + plugin_instance.end() + + if not did_plugin_run: + raise TestPluginError( + "Can't find any way to run plugin {}. Is it already implemented?".format( + plugin_instance, + ) ) - ) - return result + return result @staticmethod def set_options_to_plugin(plugin, options): @@ -104,46 +107,6 @@ def set_options_to_plugin(plugin, options): option.set_value(option_value) plugin.set_options(options_list) - def _patch_network(self, mock_domain, plugin_instance): - """ - No patcher.stop() call here because _patch_network should run only inside - test functions, so it's cleared automatically after test. - """ - self.mocked_server = MockedServer(url_mapping=mock_domain) - - # all non-js plugins - patcher = patch( - 'w3af.core.data.url.extended_urllib.ExtendedUrllib.GET', - self.mocked_server.mock_GET, - ) - patcher.start() - - # all chrome (js) plugins - chrome_patcher = patch( - 'w3af.core.controllers.chrome.instrumented.main.InstrumentedChrome.load_url', - self.mocked_server.mock_chrome_load_url(), - ) - chrome_patcher.start() - - # for soap plugin - soap_patcher = patch( - 'w3af.core.data.parsers.doc.wsdl.zeep.transports.Transport._load_remote_data', - self.mocked_server.mock_response, - ) - soap_patcher.start() - - # for web_spider plugin - from w3af.plugins.crawl.web_spider import web_spider - from w3af.core.controllers.core_helpers.fingerprint_404 import fingerprint_404_singleton - if isinstance(plugin_instance, web_spider): - plugin_instance._target_domain = 'example.com' - plugin_instance._first_run = False - mocked_404_singleton = fingerprint_404_singleton(cleanup=True) - mocked_404_singleton.set_url_opener(ExtendedUrllib()) - plugin_instance.set_url_opener(ExtendedUrllib()) - from w3af.core.controllers.threads.threadpool import Pool - plugin_instance.set_worker_pool(Pool()) - def run_auth_plugin(plugin): if not plugin.has_active_session(): @@ -162,7 +125,7 @@ def run_crawl_plugin(plugin_instance, extra_options=None): for url in extra_options['target_domain'] ] - plugin_instance.crawl(initial_request, debugging_id=MagicMock()) + plugin_instance.crawl(initial_request, debugging_id='test') while requests_to_crawl: request = requests_to_crawl.pop() if request == POISON_PILL: @@ -247,6 +210,7 @@ def mock_response(self, url): def match_response(self, url): """ :param str url: string representing url like: https://example.com/test/ + :return str: the content of matched response """ self.response_count += 1 self.urls_requested.append(url) @@ -271,3 +235,66 @@ def _mocked_resp(url, text_resp, *args, **kwargs): original_url=url, ) + +class NetworkPatcher: + """ + Context manager used for mocking the whole network. It uses MockedServer + for patching. + """ + def __init__(self, mock_domain=None, mocked_server=None, plugin_instance=None): + """ + :param dict mock_domain: pytest fixture to mock requests to + specific domain + :param MockedServer mocked_server: + :param Plugin plugin_instance: the plugin instance + """ + self.mock_domain = mock_domain + self.mocked_server = mocked_server or MockedServer(url_mapping=mock_domain) + self.plugin_instance = plugin_instance + self.patchers = [] + + def __enter__(self): + # all non-js plugins + patcher = patch( + 'w3af.core.data.url.extended_urllib.ExtendedUrllib.GET', + self.mocked_server.mock_GET, + ) + patcher.start() + self.patchers.append(patcher) + + # all chrome (js) plugins + chrome_patcher = patch( + 'w3af.core.controllers.chrome.instrumented.main.InstrumentedChrome.load_url', + self.mocked_server.mock_chrome_load_url(), + ) + chrome_patcher.start() + self.patchers.append(chrome_patcher) + + # for soap plugin + soap_patcher = patch( + 'w3af.core.data.parsers.doc.wsdl.zeep.transports.Transport._load_remote_data', + self.mocked_server.mock_response, + ) + soap_patcher.start() + self.patchers.append(soap_patcher) + from w3af.plugins.crawl.web_spider import web_spider + if self.plugin_instance and isinstance(self.plugin_instance, web_spider): + self._handle_web_spider_plugin() + + def __exit__(self, exc_type, exc_val, exc_tb): + for patcher in self.patchers: + try: + patcher.stop() + except RuntimeError: + pass + return False + + def _handle_web_spider_plugin(self): + from w3af.core.controllers.core_helpers.fingerprint_404 import fingerprint_404_singleton + self.plugin_instance._target_domain = 'example.com' + self.plugin_instance._first_run = False + mocked_404_singleton = fingerprint_404_singleton(cleanup=True) + mocked_404_singleton.set_url_opener(ExtendedUrllib()) + self.plugin_instance.set_url_opener(ExtendedUrllib()) + from w3af.core.controllers.threads.threadpool import Pool + self.plugin_instance.set_worker_pool(Pool()) diff --git a/w3af/plugins/tests/test_plugin_testing_tools.py b/w3af/plugins/tests/test_plugin_testing_tools.py new file mode 100644 index 0000000000..888a1c531d --- /dev/null +++ b/w3af/plugins/tests/test_plugin_testing_tools.py @@ -0,0 +1,41 @@ +import pytest +from mock import MagicMock, call + +from w3af.core.data.url.extended_urllib import ExtendedUrllib +from w3af.plugins.tests.plugin_testing_tools import NetworkPatcher + +""" +Unit tests for plugin_testing_tools.py +""" + + +@pytest.fixture +def network_patcher(): + return NetworkPatcher() + + +class TestNetworkPatcher: + def setup_class(self): + self.url_opener = ExtendedUrllib() + + def test_it_works_and_hits_mocked_server(self): + mocked_server = MagicMock() + network_patcher = NetworkPatcher(mocked_server=mocked_server) + with network_patcher: + self.url_opener.GET(MagicMock()) + assert call.mock_GET in mocked_server.method_calls + + def test_it_stops_all_patchers(self, network_patcher): + with network_patcher: + pass + for patcher in network_patcher.patchers: + with pytest.raises(RuntimeError): + patcher.stop() + + def test_it_starts_all_patchers(self, network_patcher): + """ + This test additionally tests if __exit__ can handle already stopped patchers + """ + with network_patcher: + for patcher in network_patcher.patchers: + patcher.stop() # no error here From e9b5713a5fe25bdd77ccf2e8ce5e63a6a63a2cb0 Mon Sep 17 00:00:00 2001 From: QBack Date: Thu, 17 Sep 2020 17:03:47 +0200 Subject: [PATCH 35/41] improve NetworkPatcher() context manager, added @patch_network decorator --- w3af/plugins/tests/plugin_testing_tools.py | 11 +++++++++ .../tests/test_plugin_testing_tools.py | 23 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/tests/plugin_testing_tools.py b/w3af/plugins/tests/plugin_testing_tools.py index 56d677217e..4871758788 100644 --- a/w3af/plugins/tests/plugin_testing_tools.py +++ b/w3af/plugins/tests/plugin_testing_tools.py @@ -280,6 +280,7 @@ def __enter__(self): from w3af.plugins.crawl.web_spider import web_spider if self.plugin_instance and isinstance(self.plugin_instance, web_spider): self._handle_web_spider_plugin() + return self def __exit__(self, exc_type, exc_val, exc_tb): for patcher in self.patchers: @@ -298,3 +299,13 @@ def _handle_web_spider_plugin(self): self.plugin_instance.set_url_opener(ExtendedUrllib()) from w3af.core.controllers.threads.threadpool import Pool self.plugin_instance.set_worker_pool(Pool()) + + +def patch_network(func): + """ + NetworkPatcher decorator + """ + def decorating_function(*args, **kwargs): + with NetworkPatcher(): + return func(*args, **kwargs) + return decorating_function diff --git a/w3af/plugins/tests/test_plugin_testing_tools.py b/w3af/plugins/tests/test_plugin_testing_tools.py index 888a1c531d..fda06d08f0 100644 --- a/w3af/plugins/tests/test_plugin_testing_tools.py +++ b/w3af/plugins/tests/test_plugin_testing_tools.py @@ -1,8 +1,8 @@ import pytest -from mock import MagicMock, call +from mock import MagicMock, call, patch from w3af.core.data.url.extended_urllib import ExtendedUrllib -from w3af.plugins.tests.plugin_testing_tools import NetworkPatcher +from w3af.plugins.tests.plugin_testing_tools import NetworkPatcher, patch_network """ Unit tests for plugin_testing_tools.py @@ -39,3 +39,22 @@ def test_it_starts_all_patchers(self, network_patcher): with network_patcher: for patcher in network_patcher.patchers: patcher.stop() # no error here + + def test_with_as_works(self): + with NetworkPatcher() as network_patcher: + assert isinstance(network_patcher, NetworkPatcher) + + def test_it_works_as_a_decorator(self): + mocked_server = MagicMock() + network_patcher_from_class = ( + lambda *args, **kwargs: NetworkPatcher(mocked_server=mocked_server) + ) + with patch( + 'w3af.plugins.tests.plugin_testing_tools.NetworkPatcher', + network_patcher_from_class, + ): + @patch_network + def decorated_function(): + self.url_opener.GET(MagicMock()) + decorated_function() + assert mocked_server.mock_GET.called From fafed41c29cb183c6ab4894cceb4b70782059bcb Mon Sep 17 00:00:00 2001 From: QBack Date: Mon, 21 Sep 2020 18:20:51 +0200 Subject: [PATCH 36/41] skip tests using internet --- .../chrome/crawler/tests/frameworks/test_react_basics.py | 1 + .../chrome/crawler/tests/frameworks/test_vue_basics.py | 3 +++ w3af/core/controllers/misc/tests/test_is_private_site.py | 2 +- w3af/core/data/url/handlers/tests/test_cache.py | 4 +++- w3af/plugins/tests/grep/test_retirejs.py | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/w3af/core/controllers/chrome/crawler/tests/frameworks/test_react_basics.py b/w3af/core/controllers/chrome/crawler/tests/frameworks/test_react_basics.py index 430534c6b4..fd0ad7e444 100644 --- a/w3af/core/controllers/chrome/crawler/tests/frameworks/test_react_basics.py +++ b/w3af/core/controllers/chrome/crawler/tests/frameworks/test_react_basics.py @@ -23,6 +23,7 @@ from w3af.core.controllers.chrome.crawler.tests.base import BaseChromeCrawlerTest +@pytest.mark.skip('uses internet') class ReactBasicTest(BaseChromeCrawlerTest): def test_react_hello_world_app(self): url = 'http://react-hello-world-app.surge.sh/' diff --git a/w3af/core/controllers/chrome/crawler/tests/frameworks/test_vue_basics.py b/w3af/core/controllers/chrome/crawler/tests/frameworks/test_vue_basics.py index a7611ac1cf..6eeebdc577 100644 --- a/w3af/core/controllers/chrome/crawler/tests/frameworks/test_vue_basics.py +++ b/w3af/core/controllers/chrome/crawler/tests/frameworks/test_vue_basics.py @@ -18,10 +18,13 @@ along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import pytest + from w3af.core.controllers.chrome.crawler.tests.base import BaseChromeCrawlerTest class ReactBasicTest(BaseChromeCrawlerTest): + @pytest.mark.skip('uses internet') def test_vue_todo_list(self): url = 'http://vue-todo-test.surge.sh' found_uris = self._crawl(url) diff --git a/w3af/core/controllers/misc/tests/test_is_private_site.py b/w3af/core/controllers/misc/tests/test_is_private_site.py index 2fad8e75cd..d2a5d3593f 100644 --- a/w3af/core/controllers/misc/tests/test_is_private_site.py +++ b/w3af/core/controllers/misc/tests/test_is_private_site.py @@ -40,6 +40,6 @@ def test_is_private_site_true_case03(self): def test_is_private_site_false_case01(self): self.assertFalse(is_private_site('192.1.0.1')) + @pytest.mark.skip('uses internet') def test_is_private_site_false_case02(self): self.assertFalse(is_private_site('www.w3af.org')) - diff --git a/w3af/core/data/url/handlers/tests/test_cache.py b/w3af/core/data/url/handlers/tests/test_cache.py index 818f60695f..aed1d39b1b 100644 --- a/w3af/core/data/url/handlers/tests/test_cache.py +++ b/w3af/core/data/url/handlers/tests/test_cache.py @@ -23,6 +23,7 @@ import urllib2 import unittest +import pytest from mock import patch, Mock, _Call from w3af.core.data.url.HTTPRequest import HTTPRequest @@ -93,6 +94,7 @@ def test_no_cache(self): class CacheIntegrationTest(unittest.TestCase): + @pytest.mark.skip('uses internet') def test_cache_http_errors(self): settings = opener_settings.OpenerSettings() settings.build_openers() @@ -135,4 +137,4 @@ def read(self): return self.body def info(self): - return self.headers \ No newline at end of file + return self.headers diff --git a/w3af/plugins/tests/grep/test_retirejs.py b/w3af/plugins/tests/grep/test_retirejs.py index 0eb8ac3adf..63a4346121 100644 --- a/w3af/plugins/tests/grep/test_retirejs.py +++ b/w3af/plugins/tests/grep/test_retirejs.py @@ -140,6 +140,7 @@ def test_version_check(self): rjs = retirejs() self.assertTrue(rjs._get_is_valid_retire_version()) + @pytest.mark.skip('uses internet') def test_retire_smoke_test(self): rjs = retirejs() self.assertTrue(rjs._retire_smoke_test()) From a81845fe4687d352b2e641da52bd6564632a320e Mon Sep 17 00:00:00 2001 From: QBack Date: Wed, 30 Sep 2020 18:50:20 +0200 Subject: [PATCH 37/41] refactored wsdl to force zeep using w3af http_client, extended_urllib accepts url as str in GET and POST, and headers as dict --- w3af/conftest.py | 30 +++++ .../tests/frameworks/test_angularjs_basics.py | 1 + w3af/core/data/parsers/doc/tests/test_wsdl.py | 111 ++++++++++++++++++ w3af/core/data/parsers/doc/wsdl.py | 54 +++++++-- .../parsers/tests/test_document_parser.py | 3 +- .../parsers/tests/test_mp_document_parser.py | 6 +- w3af/core/data/url/extended_urllib.py | 106 ++++++++++++----- w3af/core/data/url/handlers/cache.py | 19 +-- .../url/handlers/cache_backend/no_chache.py | 19 +++ .../data/url/handlers/tests/test_cache.py | 99 ++++++++++------ .../data/url/handlers/tests/test_no_cache.py | 15 +++ w3af/core/data/url/opener_settings.py | 4 +- w3af/core/data/url/tests/test_xurllib.py | 80 +++++++++---- w3af/plugins/tests/crawl/test_web_spider.py | 2 +- w3af/plugins/tests/plugin_testing_tools.py | 27 +++-- .../tests/test_plugin_testing_tools.py | 7 ++ 16 files changed, 464 insertions(+), 119 deletions(-) create mode 100644 w3af/conftest.py create mode 100644 w3af/core/data/parsers/doc/tests/test_wsdl.py create mode 100644 w3af/core/data/url/handlers/cache_backend/no_chache.py create mode 100644 w3af/core/data/url/handlers/tests/test_no_cache.py diff --git a/w3af/conftest.py b/w3af/conftest.py new file mode 100644 index 0000000000..d00b6fe14e --- /dev/null +++ b/w3af/conftest.py @@ -0,0 +1,30 @@ +import pytest + +from w3af.core.data.dc.headers import Headers +from w3af.core.data.parsers.doc.url import URL +from w3af.core.data.url.HTTPRequest import HTTPRequest +from w3af.core.data.url.HTTPResponse import HTTPResponse + + +@pytest.fixture +def http_response(): + url = URL('http://example.com/') + headers = Headers([('content-type', 'text/html')]) + return HTTPResponse( + 200, + '', + headers, + url, + url, + ) + + +@pytest.fixture +def http_request(): + url = URL('http://example.com/') + headers = Headers([('content-type', 'text/html')]) + return HTTPRequest( + url, + headers, + method='GET', + ) diff --git a/w3af/core/controllers/chrome/crawler/tests/frameworks/test_angularjs_basics.py b/w3af/core/controllers/chrome/crawler/tests/frameworks/test_angularjs_basics.py index e87ae5734d..12bd36ac85 100644 --- a/w3af/core/controllers/chrome/crawler/tests/frameworks/test_angularjs_basics.py +++ b/w3af/core/controllers/chrome/crawler/tests/frameworks/test_angularjs_basics.py @@ -24,6 +24,7 @@ from w3af.core.controllers.chrome.tests.helpers import ExtendedHttpRequestHandler +@pytest.mark.skip('uses internet') class AngularBasicTest(BaseChromeCrawlerTest): def test_angular_click(self): self._unittest_setup(AngularButtonClickRequestHandler) diff --git a/w3af/core/data/parsers/doc/tests/test_wsdl.py b/w3af/core/data/parsers/doc/tests/test_wsdl.py new file mode 100644 index 0000000000..6a808c04e0 --- /dev/null +++ b/w3af/core/data/parsers/doc/tests/test_wsdl.py @@ -0,0 +1,111 @@ +import pytest +from mock import MagicMock, patch + +from w3af.core.data.dc.headers import Headers +from w3af.core.data.parsers.doc.url import URL +from w3af.core.data.parsers.doc.wsdl import ZeepTransport, WSDLParser +from w3af.core.data.url.HTTPResponse import HTTPResponse +from w3af.core.data.url.extended_urllib import ExtendedUrllib +from w3af.plugins.tests.plugin_testing_tools import NetworkPatcher + + +@pytest.fixture +def mocked_http_client(): + return MagicMock() + + +@pytest.fixture +def zeep_transport(mocked_http_client): + transport = ZeepTransport() + transport.uri_opener = mocked_http_client + return transport + + +@pytest.fixture +def zeep_transport_from_class(zeep_transport): + return lambda *args, **kwargs: zeep_transport + + +@pytest.fixture +def http_response(): + return HTTPResponse( + 200, + '
', + Headers(), + URL('https://example.com/'), + URL('https://example.com/'), + ) + + +class TestZeepTransport: + def test_it_implements_all_needed_methods(self): + zeep_transport = ZeepTransport() + required_methods = [ + 'get', + 'load', + 'post', + 'post_xml', + ] + for method in required_methods: + assert hasattr(zeep_transport, method) + + def test_it_calls_http_client_on_get_method(self, zeep_transport, mocked_http_client): + zeep_transport.get('https://example.com/', '', {}) + assert mocked_http_client.GET.called + + def test_it_calls_http_client_on_post_method(self, zeep_transport, mocked_http_client): + zeep_transport.post('https://example.com/', 'some data', {}) + assert mocked_http_client.POST.called + + def test_it_calls_http_client_on_post_xml_method(self, zeep_transport, mocked_http_client): + from lxml import etree # feeding Zeep dependencies + zeep_transport.post_xml('https://example.com/', etree.Element('test'), {}) + assert mocked_http_client.POST.called + + def test_it_loads_the_response_content(self, zeep_transport, mocked_http_client): + mocked_response = MagicMock(name='mocked_response') + mocked_response.body = 'test' + mocked_http_client.GET = MagicMock(return_value=mocked_response) + + result = zeep_transport.load('http://example.com/') + assert result == 'test' + + +class TestZeepTransportIntegration: + def test_it_can_perform_get_request(self): + url = 'http://example.com/' + with NetworkPatcher() as network_patcher: + zeep_transport = ZeepTransport() + zeep_transport.get(url, {}, {}) + assert url in network_patcher.mocked_server.urls_requested + + def test_it_can_perform_post_request(self): + url = 'http://example.com/' + with NetworkPatcher() as network_patcher: + zeep_transport = ZeepTransport() + zeep_transport.post(url, 'some data', {}) + assert url in network_patcher.mocked_server.urls_requested + + def test_it_can_load_url(self): + url = 'http://example.com/' + with NetworkPatcher() as network_patcher: + zeep_transport = ZeepTransport() + zeep_transport.load('http://example.com/') + assert url in network_patcher.mocked_server.urls_requested + + +class TestWSDLParserIntegration: + def test_wsdl_zeep_transport_uses_extended_urllib(self): + zeep_transport = ZeepTransport() + assert isinstance(zeep_transport.uri_opener, ExtendedUrllib) + + def test_it_uses_extended_urllib_for_performing_requests( + self, + mocked_http_client, + zeep_transport_from_class, + http_response, + ): + mocked_http_client.GET = MagicMock(return_value=http_response) + with patch('w3af.core.data.parsers.doc.wsdl.ZeepTransport', zeep_transport_from_class): + WSDLParser(http_response=http_response) + assert mocked_http_client.GET.called diff --git a/w3af/core/data/parsers/doc/wsdl.py b/w3af/core/data/parsers/doc/wsdl.py index 3c2cd9bfb9..adbb01ce31 100644 --- a/w3af/core/data/parsers/doc/wsdl.py +++ b/w3af/core/data/parsers/doc/wsdl.py @@ -21,23 +21,62 @@ """ import contextlib import sys -import xml.parsers.expat as expat from cStringIO import StringIO -import SOAPpy import zeep from requests import HTTPError from zeep.exceptions import XMLSyntaxError -import w3af.core.controllers.output_manager as om import w3af.core.data.kb.knowledge_base as kb -from w3af.core.controllers.exceptions import BaseFrameworkException from w3af.core.data.kb.info import Info from w3af.core.data.parsers.doc.baseparser import BaseParser from w3af.core.data.parsers.doc.url import URL from w3af.core.controllers import output_manager +class ZeepTransport(zeep.Transport): + """ + Custom Zeep Transport class which overrides it's methods to use w3af's HTTP client. + We don't call super() on any overwritten method as we want to force Zeep to use + our client, not their. + + Tradeoff: + As WSDLParser has to be tight coupled to Zeep by design we have to also + make tight coupling between WSDLParser and ExtendedUrllib. And that's because + parser by design is not intended to perform any requests by itself. Although + Zeep is constructed in this specific way that it performs request when it's + instantiated. + As parsers are not intended to make requests there's also no obvious way to + pass uri_opener into parser. + """ + def __init__(self): + super(ZeepTransport, self).__init__() + from w3af.core.data.url.extended_urllib import ExtendedUrllib + self.uri_opener = ExtendedUrllib() + self.uri_opener.setup(disable_cache=True) + + def get(self, address, params, headers): + return self.uri_opener.GET(address, params, headers=headers) + + def post(self, address, message, headers): + return self.uri_opener.POST(address, data=message, headers=headers) + + def post_xml(self, address, envelope, headers): + from zeep.wsdl.utils import etree_to_string + message = etree_to_string(envelope) + return self.uri_opener.POST(address, data=message, headers=headers) + + def load(self, url): + response = self.uri_opener.GET(url) + return response.body + + +class ZeepClientAdapter(zeep.Client): + def __init__(self, url, transport=None, *args, **kwargs): + transport = transport or ZeepTransport() + super(ZeepClientAdapter, self).__init__(url, transport=transport, *args, **kwargs) + + class WSDLParser(BaseParser): """ This class parses WSDL documents. @@ -48,7 +87,8 @@ class WSDLParser(BaseParser): def __init__(self, http_response): self._proxy = None super(WSDLParser, self).__init__(http_response) - self._wsdl_client = zeep.Client(str(http_response.get_uri())) + wsdl_url = str(http_response.get_uri()) + self._wsdl_client = ZeepClientAdapter(wsdl_url) self._discovered_urls = set() def __getstate__(self): @@ -58,13 +98,13 @@ def __getstate__(self): def __setstate__(self, state): self.__dict__.update(state) - self._wsdl_client = zeep.Client(str(self._http_response.get_uri())) + self._wsdl_client = ZeepClientAdapter(str(self._http_response.get_uri())) @staticmethod def can_parse(http_resp): url = http_resp.get_uri() try: - wsdl_client = zeep.Client(str(url)) + wsdl_client = ZeepClientAdapter(str(url)) except (XMLSyntaxError, HTTPError): exception_description = ( "The result of url: {} seems not to be valid XML.".format( diff --git a/w3af/core/data/parsers/tests/test_document_parser.py b/w3af/core/data/parsers/tests/test_document_parser.py index c1fe9f2aab..9a3a248da9 100644 --- a/w3af/core/data/parsers/tests/test_document_parser.py +++ b/w3af/core/data/parsers/tests/test_document_parser.py @@ -21,7 +21,6 @@ """ import unittest -import time import os from w3af import ROOT_PATH @@ -33,6 +32,7 @@ from w3af.core.data.parsers.doc.url import URL from w3af.core.data.parsers.document_parser import (document_parser_factory, DocumentParser) +from w3af.plugins.tests.plugin_testing_tools import patch_network def _build_http_response(body_content, content_type): @@ -44,6 +44,7 @@ def _build_http_response(body_content, content_type): return HTTPResponse(200, body_content, headers, url, url, charset='utf-8') +@patch_network class TestDocumentParserFactory(unittest.TestCase): PDF_FILE = os.path.join(ROOT_PATH, 'core', 'data', 'parsers', 'doc', diff --git a/w3af/core/data/parsers/tests/test_mp_document_parser.py b/w3af/core/data/parsers/tests/test_mp_document_parser.py index ee7582238f..ee8ce26ff7 100644 --- a/w3af/core/data/parsers/tests/test_mp_document_parser.py +++ b/w3af/core/data/parsers/tests/test_mp_document_parser.py @@ -41,7 +41,7 @@ from w3af.core.data.dc.headers import Headers from w3af.core.data.parsers.doc.html import HTMLParser from w3af.core.data.parsers.tests.test_document_parser import _build_http_response -from w3af.plugins.tests.plugin_testing_tools import NetworkPatcher +from w3af.plugins.tests.plugin_testing_tools import NetworkPatcher, patch_network @pytest.fixture @@ -388,6 +388,7 @@ def test_dictproxy_pickle_8748(self): parser = self.mpdoc.get_document_parser_for(resp) assert isinstance(parser._parser, HTMLParser) + @patch_network def test_get_tags_by_filter(self): body = 'foobar' url = URL('http://www.w3af.com/') @@ -399,6 +400,7 @@ def test_get_tags_by_filter(self): assert [Tag('a', {'href': '/abc'}, 'foo'), Tag('b', {}, 'bar')] == tags + @patch_network def test_get_tags_by_filter_empty_tag(self): body = '' url = URL('http://www.w3af.com/') @@ -413,7 +415,7 @@ def test_get_tags_by_filter_empty_tag(self): def test_it_doesnt_silence_type_error_from_document_parser(self, html_response): self.mpdoc._document_parser_class = MockedDamagedDocumentParser - with pytest.raises(TypeError): + with pytest.raises(TypeError), NetworkPatcher(): self.mpdoc.get_document_parser_for(html_response) diff --git a/w3af/core/data/url/extended_urllib.py b/w3af/core/data/url/extended_urllib.py index 20c77797f3..bc0ebcf9df 100644 --- a/w3af/core/data/url/extended_urllib.py +++ b/w3af/core/data/url/extended_urllib.py @@ -528,10 +528,10 @@ def end(self): def restart(self): self.end() - def setup(self): + def setup(self, disable_cache=False): if self.settings.need_update or self._opener is None: self.settings.need_update = False - self.settings.build_openers() + self.settings.build_openers(disable_cache=disable_cache) self._opener = self.settings.get_custom_opener() self.clear_timeout() @@ -674,12 +674,25 @@ def send_mutant(self, mutant, callback=None, grep=True, cache=True, return res - def GET(self, uri, data=None, headers=None, cache=False, - grep=True, cookies=True, session=None, - respect_size_limit=True, new_connection=False, - error_handling=True, timeout=None, follow_redirects=False, - use_basic_auth=True, use_proxy=True, debugging_id=None, - binary_response=False): + def GET( + self, + uri, + data=None, + headers=None, + cache=False, + grep=True, + cookies=True, + session=None, + respect_size_limit=True, + new_connection=False, + error_handling=True, + timeout=None, + follow_redirects=False, + use_basic_auth=True, + use_proxy=True, + debugging_id=None, + binary_response=False, + ): """ HTTP GET a URI using a proxy, user agent, and other settings that where previously set in opener_settings.py . @@ -702,15 +715,7 @@ def GET(self, uri, data=None, headers=None, cache=False, :return: An HTTPResponse object. """ - headers = headers or Headers() - - if not isinstance(uri, URL): - raise TypeError('The uri parameter of ExtendedUrllib.GET() must be' - ' of url.URL type.') - - if not isinstance(headers, Headers): - raise TypeError('The header parameter of ExtendedUrllib.GET() must' - ' be of Headers type.') + uri, headers = self._parse_uri_and_headers(uri, headers, method_name='GET') # Validate what I'm sending, init the library (if needed) self.setup() @@ -738,12 +743,25 @@ def GET(self, uri, data=None, headers=None, cache=False, with raise_size_limit(respect_size_limit): return self.send(req, grep=grep) - def POST(self, uri, data='', headers=None, grep=True, cache=False, - cookies=True, session=None, error_handling=True, timeout=None, - follow_redirects=None, use_basic_auth=True, use_proxy=True, - debugging_id=None, new_connection=False, - respect_size_limit=None, - binary_response=False): + def POST( + self, + uri, + data='', + headers=None, + grep=True, + cache=False, + cookies=True, + session=None, + error_handling=True, + timeout=None, + follow_redirects=None, + use_basic_auth=True, + use_proxy=True, + debugging_id=None, + new_connection=False, + respect_size_limit=None, + binary_response=False, + ): """ POST's data to a uri using a proxy, user agents, and other settings that where set previously. @@ -755,15 +773,7 @@ def POST(self, uri, data='', headers=None, grep=True, cache=False, :see: The GET() for documentation on the other parameters :return: An HTTPResponse object. """ - headers = headers or Headers() - - if not isinstance(uri, URL): - raise TypeError('The uri parameter of ExtendedUrllib.POST() must' - ' be of url.URL type. Got %s instead.' % type(uri)) - - if not isinstance(headers, Headers): - raise TypeError('The header parameter of ExtendedUrllib.POST() must' - ' be of Headers type.') + uri, headers = self._parse_uri_and_headers(uri, headers, method_name='POST') # Validate what I'm sending, init the library (if needed) self.setup() @@ -792,6 +802,38 @@ def POST(self, uri, data='', headers=None, grep=True, cache=False, return self.send(req, grep=grep) + def _parse_uri_and_headers(self, uri, headers, method_name): + """ + If uri or headers comes in primitive format then make sure they're + instantiated to proper ones. + """ + if isinstance(headers, dict): + new_headers = [] + for key, value in headers.items(): + new_headers.append((key, value)) + headers = Headers(new_headers) + headers = headers or Headers() + + if not isinstance(headers, Headers): + error_message = ( + 'The header parameter of ExtendedUrllib.{}() must be of dict Headers type.' + ) + raise TypeError( + error_message.format(method_name) + ) + + if isinstance(uri, str): + uri = URL(uri) + if not isinstance(uri, URL): + error_message = ( + 'The uri parameter of ExtendedUrllib.{}() must be of str or url.URL type.' + ) + raise TypeError( + error_message.format(method_name) + ) + + return uri, headers + def get_remote_file_size(self, req, cache=True): """ This method was previously used in the framework to perform a HEAD diff --git a/w3af/core/data/url/handlers/cache.py b/w3af/core/data/url/handlers/cache.py index c348419adc..26cb42305f 100644 --- a/w3af/core/data/url/handlers/cache.py +++ b/w3af/core/data/url/handlers/cache.py @@ -28,6 +28,8 @@ # TODO: Why not POST? Why don't we perform real caching and respect # the cache headers/meta tags? # @see: https://bitbucket.org/jaraco/jaraco.net/src/65af6e442d21/jaraco/net/http/caching.py +from w3af.core.data.url.handlers.cache_backend.no_chache import NoCachedResponse + CACHE_METHODS = ('GET', 'HEAD') @@ -42,14 +44,17 @@ class CacheHandler(urllib2.BaseHandler): :author: Version 0.2 by Andres Riancho :author: Version 0.3 by Javier Andalia """ - def __init__(self): - CacheClass.init() + def __init__(self, disable_cache=False): + self._cache_class = DefaultCacheClass + if disable_cache: + self._cache_class = NoCachedResponse + self._cache_class.init() def clear(self): """ Clear the cache (remove all files and directories associated with it). """ - return CacheClass.clear() + return self._cache_class.clear() def default_open(self, request): """ @@ -64,11 +69,11 @@ def default_open(self, request): if not request.get_from_cache: return None - if not CacheClass.exists_in_cache(request): + if not self._cache_class.exists_in_cache(request): return None try: - cache_response_obj = CacheClass(request) + cache_response_obj = self._cache_class(request) except Exception: # Sometimes the cache gets corrupted, or the initial HTTP # request that's saved to disk doesn't completely respect the @@ -105,11 +110,11 @@ def http_response(self, request, response): # above) to decide if the response should be returned from the # cache # - CacheClass.store_in_cache(request, response) + self._cache_class.store_in_cache(request, response) return response https_response = http_response # This is the default implementation -CacheClass = SQLCachedResponse +DefaultCacheClass = SQLCachedResponse diff --git a/w3af/core/data/url/handlers/cache_backend/no_chache.py b/w3af/core/data/url/handlers/cache_backend/no_chache.py new file mode 100644 index 0000000000..910327524a --- /dev/null +++ b/w3af/core/data/url/handlers/cache_backend/no_chache.py @@ -0,0 +1,19 @@ +from w3af.core.data.url.handlers.cache_backend.cached_response import CachedResponse + + +class NoCachedResponse(CachedResponse): + @staticmethod + def init(): + pass + + @staticmethod + def exists_in_cache(request): + return False + + @staticmethod + def clear(): + pass + + @staticmethod + def store_in_cache(request, response): + pass diff --git a/w3af/core/data/url/handlers/tests/test_cache.py b/w3af/core/data/url/handlers/tests/test_cache.py index aed1d39b1b..c91938af9e 100644 --- a/w3af/core/data/url/handlers/tests/test_cache.py +++ b/w3af/core/data/url/handlers/tests/test_cache.py @@ -24,7 +24,7 @@ import unittest import pytest -from mock import patch, Mock, _Call +from mock import patch, Mock, _Call, MagicMock from w3af.core.data.url.HTTPRequest import HTTPRequest from w3af.core.data.url.handlers.cache import CacheHandler @@ -33,64 +33,85 @@ from w3af.core.data.dc.headers import Headers -class TestCacheHandler(unittest.TestCase): - - def tearDown(self): +class TestCacheHandler: + def setup_method(self): + self.url = URL('http://www.w3af.org') + self.request = HTTPRequest(self.url, cache=True) + self.response = FakeHttplibHTTPResponse( + 200, 'OK', 'spameggs', Headers(), self.url.url_string + ) + + def teardown_method(self): CacheHandler().clear() - + def test_basic(self): - url = URL('http://www.w3af.org') - request = HTTPRequest(url, cache=True) - + cache = CacheHandler() - self.assertEqual(cache.default_open(request), None) - - response = FakeHttplibHTTPResponse(200, 'OK', 'spameggs', Headers(), - url.url_string) + assert cache.default_open(self.request) is None - with patch('w3af.core.data.url.handlers.cache.CacheClass') as cc_mock: - store_in_cache = Mock() - cc_mock.attach_mock(store_in_cache, 'store_in_cache') + cc_mock = MagicMock() + cache._cache_class = cc_mock + store_in_cache = Mock() + cc_mock.attach_mock(store_in_cache, 'store_in_cache') - # This stores the response - cache.http_response(request, response) + # This stores the response + cache.http_response(self.request, self.response) - # Make sure the right call was made - _call = _Call(('store_in_cache', (request, response))) - self.assertEqual(cc_mock.mock_calls, [_call]) - cc_mock.reset_mock() + # Make sure the right call was made + _call = _Call(('store_in_cache', (self.request, self.response))) + assert cc_mock.mock_calls == [_call] + cc_mock.reset_mock() - exists_in_cache = Mock() - cc_mock.return_value = response - cc_mock.attach_mock(exists_in_cache, 'exists_in_cache') + exists_in_cache = Mock() + cc_mock.return_value = self.response + cc_mock.attach_mock(exists_in_cache, 'exists_in_cache') - # This retrieves the response from the "cache" - cached_response = cache.default_open(request) + # This retrieves the response from the "cache" + cached_response = cache.default_open(self.request) - # Make sure the right call was made - _exists_call = _Call(('exists_in_cache', (request,))) - _retrieve_call = _Call(((request,), {})) - self.assertEqual(cc_mock.mock_calls, [_exists_call, _retrieve_call]) + # Make sure the right call was made + _exists_call = _Call(('exists_in_cache', (self.request,))) + _retrieve_call = _Call(((self.request,), {})) + assert cc_mock.mock_calls == [_exists_call, _retrieve_call] - self.assertIsNotNone(cached_response) + assert cached_response is not None - self.assertEqual(cached_response.code, response.code) - self.assertEqual(cached_response.msg, response.msg) - self.assertEqual(cached_response.read(), response.read()) - self.assertEqual(Headers(cached_response.info().items()), response.info()) - self.assertEqual(cached_response.geturl(), response.geturl()) + assert cached_response.code == self.response.code + assert cached_response.msg == self.response.msg + assert cached_response.read() == self.response.read() + assert Headers(cached_response.info().items()) == self.response.info() + assert cached_response.geturl() == self.response.geturl() + + def test_cache_handler_with_enabled_cache(self): + default_cache = MagicMock() + with patch( + 'w3af.core.data.url.handlers.cache.DefaultCacheClass', default_cache + ): + cache_handler = CacheHandler(disable_cache=False) + assert cache_handler.default_open(self.request) + # cache_handler.http_response(self.request, self.response) + # assert default_cache.store_in_cache.call_count == 1 + # assert cache_handler.http_response(self.request, self.response) + # assert default_cache.store_in_cache.call_count == 1 + + def test_cache_handler_with_disabled_cache(self): + with patch( + 'w3af.core.data.url.handlers.cache.DefaultCacheClass', MagicMock() + ): + cache_handler = CacheHandler(disable_cache=True) + assert not cache_handler.default_open(self.request) def test_no_cache(self): url = URL('http://www.w3af.org') request = HTTPRequest(url, cache=False) cache = CacheHandler() - self.assertEqual(cache.default_open(request), None) + assert cache.default_open(request) is None response = FakeHttplibHTTPResponse(200, 'OK', 'spameggs', Headers(), url.url_string) cache.http_response(request, response) - self.assertEqual(cache.default_open(request), None) + assert cache.default_open(request) is None class CacheIntegrationTest(unittest.TestCase): @@ -103,7 +124,7 @@ def test_cache_http_errors(self): url = URL('http://w3af.org/foo-bar-not-exists.htm') request = HTTPRequest(url, cache=False) - with patch('w3af.core.data.url.handlers.cache.CacheClass') as cc_mock: + with patch('w3af.core.data.url.handlers.cache.DefaultCacheClass') as cc_mock: store_in_cache = Mock() cc_mock.attach_mock(store_in_cache, 'store_in_cache') diff --git a/w3af/core/data/url/handlers/tests/test_no_cache.py b/w3af/core/data/url/handlers/tests/test_no_cache.py new file mode 100644 index 0000000000..5c8a99294e --- /dev/null +++ b/w3af/core/data/url/handlers/tests/test_no_cache.py @@ -0,0 +1,15 @@ +from mock import MagicMock + +from w3af.core.data.url.handlers.cache_backend.no_chache import NoCachedResponse + + +def test_it_implements_all_static_methods_required(): + NoCachedResponse.init() + NoCachedResponse.clear() + NoCachedResponse.exists_in_cache(MagicMock()) + NoCachedResponse.store_in_cache(MagicMock(), MagicMock()) + + +def test_response_wont_exist_in_cache(http_request, http_response): + NoCachedResponse.store_in_cache(http_request, http_response) + assert not NoCachedResponse.exists_in_cache(http_request) diff --git a/w3af/core/data/url/opener_settings.py b/w3af/core/data/url/opener_settings.py index 16ef552237..d4fc7ee2ef 100644 --- a/w3af/core/data/url/opener_settings.py +++ b/w3af/core/data/url/opener_settings.py @@ -370,11 +370,11 @@ def get_keep_alive_handlers(self): self._ka_https } - def build_openers(self): + def build_openers(self, disable_cache=False): # Instantiate the handlers passing the proxy as parameter self._ka_http = HTTPHandler() self._ka_https = HTTPSHandler(self.get_proxy()) - self._cache_handler = CacheHandler() + self._cache_handler = CacheHandler(disable_cache=disable_cache) # Prepare the list of handlers handlers = [] diff --git a/w3af/core/data/url/tests/test_xurllib.py b/w3af/core/data/url/tests/test_xurllib.py index 54dd0c9015..0dd6bb6dc7 100644 --- a/w3af/core/data/url/tests/test_xurllib.py +++ b/w3af/core/data/url/tests/test_xurllib.py @@ -31,7 +31,7 @@ import httpretty from nose.plugins.attrib import attr -from mock import patch +from mock import patch, MagicMock from w3af import ROOT_PATH from w3af.core.data.url.extended_urllib import ExtendedUrllib @@ -52,7 +52,10 @@ @attr('moth') @attr('smoke') -class TestXUrllib(unittest.TestCase): +class TestXUrllibUnittest(unittest.TestCase): + """ + Pytest style is preferred for newer tests + """ MOTH_MESSAGE = 'moth: vulnerable web application' MOCK_URL = 'http://www.w3af.org/' @@ -64,7 +67,7 @@ def tearDown(self): self.uri_opener.end() httpretty.reset() - @pytest.mark.deprecated + @pytest.mark.skip('uses internet') def test_basic(self): url = URL(get_moth_http()) http_response = self.uri_opener.GET(url, cache=False) @@ -86,7 +89,7 @@ def test_redir_content_length_zero(self): http_response = self.uri_opener.GET(url, cache=False) self.assertEqual(http_response.get_code(), 301) - @pytest.mark.deprecated + @pytest.mark.skip('uses internet') def test_basic_ssl(self): url = URL(get_moth_https()) http_response = self.uri_opener.GET(url, cache=False) @@ -96,6 +99,7 @@ def test_basic_ssl(self): self.assertGreaterEqual(http_response.id, 1) self.assertNotEqual(http_response.id, None) + @pytest.mark.skip('uses internet') def test_github_ssl(self): url = URL('https://raw.githubusercontent.com/RetireJS/retire.js/master/repository/jsrepository.json') @@ -106,7 +110,7 @@ def test_github_ssl(self): self.assertGreaterEqual(http_response.id, 1) self.assertNotEqual(http_response.id, None) - @pytest.mark.deprecated + @pytest.mark.skip('uses internet') def test_cache(self): url = URL(get_moth_http()) http_response = self.uri_opener.GET(url) @@ -116,7 +120,7 @@ def test_cache(self): http_response = self.uri_opener.GET(url) self.assertIn(self.MOTH_MESSAGE, http_response.body) - @pytest.mark.deprecated + @pytest.mark.skip('uses internet') def test_qs_params(self): url = URL(get_moth_http('/audit/xss/simple_xss.py?text=123456abc')) http_response = self.uri_opener.GET(url, cache=False) @@ -173,7 +177,7 @@ def test_GET_with_post_data_and_qs(self): self.assertEqual(httpretty.last_request().body, data) self.assertEqual(httpretty.last_request().path, '/' + qs) - @pytest.mark.deprecated + @pytest.mark.skip('uses internet') def test_post(self): url = URL(get_moth_http('/audit/xss/simple_xss_form.py')) @@ -183,7 +187,7 @@ def test_post(self): http_response = self.uri_opener.POST(url, data, cache=False) self.assertIn('123456abc', http_response.body) - @pytest.mark.deprecated + @pytest.mark.skip('uses internet') def test_post_special_chars(self): url = URL(get_moth_http('/audit/xss/simple_xss_form.py')) test_data = u'abc"-á-' @@ -194,7 +198,6 @@ def test_post_special_chars(self): http_response = self.uri_opener.POST(url, data, cache=False) self.assertIn(test_data, http_response.body) - @pytest.mark.deprecated def test_unknown_domain(self): url = URL('http://longsitethatdoesnotexistfoo.com/') self.assertRaises(HTTPRequestException, self.uri_opener.GET, url) @@ -203,13 +206,12 @@ def test_file_proto(self): url = URL('file://foo/bar.txt') self.assertRaises(HTTPRequestException, self.uri_opener.GET, url) - @pytest.mark.deprecated def test_url_port_closed(self): # TODO: Change 2312 by an always closed/non-http port url = URL('http://127.0.0.1:2312/') self.assertRaises(HTTPRequestException, self.uri_opener.GET, url) - @pytest.mark.deprecated + @pytest.mark.skip('uses internet') def test_url_port_not_http(self): upper_daemon = UpperDaemon(EmptyTCPHandler) upper_daemon.start() @@ -226,7 +228,6 @@ def test_url_port_not_http(self): else: self.assertTrue(False, 'Expected HTTPRequestException.') - @pytest.mark.deprecated def test_url_port_not_http_many(self): upper_daemon = UpperDaemon(EmptyTCPHandler) upper_daemon.start() @@ -255,7 +256,7 @@ def test_url_port_not_http_many(self): self.assertEqual(scan_must_stop_e, 1) self.assertEqual(http_request_e, 9) - @pytest.mark.deprecated + @pytest.mark.skip('uses internet') def test_get_wait_time(self): """ Asserts that all the responses coming out of the extended urllib have a @@ -323,7 +324,6 @@ def test_ssl_sni(self): resp = self.uri_opener.GET(url) self.assertIn('Great!', resp.get_body()) - @pytest.mark.deprecated def test_ssl_fail_when_requesting_http(self): http_daemon = UpperDaemon(Ok200Handler) http_daemon.start() @@ -337,7 +337,6 @@ def test_ssl_fail_when_requesting_http(self): self.assertRaises(HTTPRequestException, self.uri_opener.GET, url) - @pytest.mark.deprecated def test_ssl_fail_when_requesting_moth_http(self): """ https://github.com/andresriancho/w3af/issues/7989 @@ -415,8 +414,8 @@ def send(uri_opener, output): self.assertEqual(http_response.get_code(), 200) self.assertIn(self.MOTH_MESSAGE, http_response.body) - - @pytest.mark.deprecated + + @pytest.mark.skip('uses internet') def test_removes_cache(self): url = URL(get_moth_http()) self.uri_opener.GET(url, cache=False) @@ -434,8 +433,8 @@ def test_removes_cache(self): test_trace_path = os.path.join(temp_dir, trace_fmt % i) self.assertFalse(os.path.exists(test_db_path), test_db_path) self.assertFalse(os.path.exists(test_trace_path), test_trace_path) - - @pytest.mark.deprecated + + @pytest.mark.skip('uses internet') def test_special_char_header(self): url = URL(get_moth_http('/core/headers/echo-headers.py')) header_content = u'name=ábc' @@ -443,7 +442,6 @@ def test_special_char_header(self): http_response = self.uri_opener.GET(url, cache=False, headers=headers) self.assertIn(header_content, http_response.body) - @pytest.mark.deprecated def test_bad_file_descriptor_8125_local(self): """ 8125 is basically an issue with the way HTTP SSL connections handle the @@ -505,6 +503,48 @@ def rate_limit_generic(self, max_requests_per_second, _min, _max): self.assertLessEqual(elapsed_time, _max) +@pytest.fixture +def blind_extended_urllib(): + """ + It's blind. It doesn't send real request and it returns MagicMock instead of + HTTPResponse instance, so mock's implementation stays easy. + """ + extended_urllib = ExtendedUrllib() + extended_urllib.setup() + extended_urllib._opener = MagicMock() + with patch('w3af.core.data.url.extended_urllib.HTTPResponse', MagicMock()): + yield extended_urllib + + +class TestXUrllib: + def test_get_method_can_be_called_with_url_as_string(self, blind_extended_urllib): + blind_extended_urllib.GET('http://example.com/') # no error + + def test_get_method_can_be_called_with_headers_as_dict(self, blind_extended_urllib): + headers = { + 'origin': 'example.com', + 'authorization': 'some token', + } + # no error + blind_extended_urllib.GET('http://example.com/', headers=headers) + + def test_post_method_can_be_called_with_url_as_string(self, blind_extended_urllib): + # no error + blind_extended_urllib.POST('http://example.com/', data='some data') + + def test_post_method_can_be_called_with_headers_as_dict(self, blind_extended_urllib): + headers = { + 'origin': 'example.com', + 'authorization': 'some token', + } + # no error + blind_extended_urllib.POST( + 'http://example.com/', + data='some data', + headers=headers, + ) + + class EmptyTCPHandler(SocketServer.BaseRequestHandler): def handle(self): self.data = self.request.recv(1024).strip() diff --git a/w3af/plugins/tests/crawl/test_web_spider.py b/w3af/plugins/tests/crawl/test_web_spider.py index 9a0a2473a2..6ca9d0ccca 100644 --- a/w3af/plugins/tests/crawl/test_web_spider.py +++ b/w3af/plugins/tests/crawl/test_web_spider.py @@ -313,7 +313,7 @@ class TestDeadLock(PluginTest): MOCK_RESPONSES = [MockResponse('http://mock/', INDEX_HTML), MockResponse('http://mock/', 'Thanks.', method='POST')] - @pytest.mark.deprecated + @pytest.mark.slow def test_no_lock(self): cfg = self._run_configs['cfg'] self._scan(cfg['target'], cfg['plugins']) diff --git a/w3af/plugins/tests/plugin_testing_tools.py b/w3af/plugins/tests/plugin_testing_tools.py index 4871758788..f3ca20c034 100644 --- a/w3af/plugins/tests/plugin_testing_tools.py +++ b/w3af/plugins/tests/plugin_testing_tools.py @@ -166,10 +166,21 @@ def mock_GET(self, url, *args, **kwargs): """ Mock for all places where w3af uses extended urllib. - :param URL url: w3af.core.data.parsers.doc.url.URL instance + :param URL or str url: w3af.core.data.parsers.doc.url.URL instance or str :return: w3af.core.data.url.HTTPResponse.HTTPResponse instance """ - return self._mocked_resp(url, self.match_response(str(url))) + url = str(url) + return self._mocked_resp(URL(url), self.match_response(url)) + + def mock_POST(self, url, *args, **kwargs): + """ + Mock for all places where w3af uses extended urllib. + + :param URL or str url: w3af.core.data.parsers.doc.url.URL instance or str + :return: w3af.core.data.url.HTTPResponse.HTTPResponse instance + """ + url = str(url) + return self._mocked_resp(URL(url), self.match_response(url)) def mock_chrome_load_url(self, *args, **kwargs): def real_mock(self_, url, *args, **kwargs): @@ -270,13 +281,13 @@ def __enter__(self): chrome_patcher.start() self.patchers.append(chrome_patcher) - # for soap plugin - soap_patcher = patch( - 'w3af.core.data.parsers.doc.wsdl.zeep.transports.Transport._load_remote_data', - self.mocked_server.mock_response, + post_patcher = patch( + 'w3af.core.data.url.extended_urllib.ExtendedUrllib.POST', + self.mocked_server.mock_POST, ) - soap_patcher.start() - self.patchers.append(soap_patcher) + self.patchers.append(post_patcher) + post_patcher.start() + from w3af.plugins.crawl.web_spider import web_spider if self.plugin_instance and isinstance(self.plugin_instance, web_spider): self._handle_web_spider_plugin() diff --git a/w3af/plugins/tests/test_plugin_testing_tools.py b/w3af/plugins/tests/test_plugin_testing_tools.py index fda06d08f0..9136c78972 100644 --- a/w3af/plugins/tests/test_plugin_testing_tools.py +++ b/w3af/plugins/tests/test_plugin_testing_tools.py @@ -25,6 +25,13 @@ def test_it_works_and_hits_mocked_server(self): self.url_opener.GET(MagicMock()) assert call.mock_GET in mocked_server.method_calls + def test_it_works_for_post_requests(self): + mocked_server = MagicMock() + network_patcher = NetworkPatcher(mocked_server=mocked_server) + with network_patcher: + self.url_opener.POST('http://example.com/', 'data') + assert mocked_server.mock_POST.called + def test_it_stops_all_patchers(self, network_patcher): with network_patcher: pass From 2d12caa5142b8cd98dcf40c13799a4f9e4e00be8 Mon Sep 17 00:00:00 2001 From: QBack Date: Thu, 1 Oct 2020 03:23:32 +0200 Subject: [PATCH 38/41] fixed test_cache --- .../data/url/handlers/tests/test_cache.py | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/w3af/core/data/url/handlers/tests/test_cache.py b/w3af/core/data/url/handlers/tests/test_cache.py index c91938af9e..0d90f1e436 100644 --- a/w3af/core/data/url/handlers/tests/test_cache.py +++ b/w3af/core/data/url/handlers/tests/test_cache.py @@ -82,39 +82,29 @@ def test_basic(self): assert Headers(cached_response.info().items()) == self.response.info() assert cached_response.geturl() == self.response.geturl() - def test_cache_handler_with_enabled_cache(self): - default_cache = MagicMock() - with patch( - 'w3af.core.data.url.handlers.cache.DefaultCacheClass', default_cache - ): - cache_handler = CacheHandler(disable_cache=False) - assert cache_handler.default_open(self.request) - # cache_handler.http_response(self.request, self.response) - # assert default_cache.store_in_cache.call_count == 1 - # assert cache_handler.http_response(self.request, self.response) - # assert default_cache.store_in_cache.call_count == 1 - - def test_cache_handler_with_disabled_cache(self): - with patch( - 'w3af.core.data.url.handlers.cache.DefaultCacheClass', MagicMock() - ): - cache_handler = CacheHandler(disable_cache=True) - assert not cache_handler.default_open(self.request) - def test_no_cache(self): url = URL('http://www.w3af.org') request = HTTPRequest(url, cache=False) - + cache = CacheHandler() assert cache.default_open(request) is None - + response = FakeHttplibHTTPResponse(200, 'OK', 'spameggs', Headers(), url.url_string) cache.http_response(request, response) assert cache.default_open(request) is None -class CacheIntegrationTest(unittest.TestCase): +class TestCacheIntegration: + def setup_method(self): + self.http_response = FakeHttplibHTTPResponse( + 200, + 'OK', + '', + Headers(), + 'http://example.com/' + ) + @pytest.mark.skip('uses internet') def test_cache_http_errors(self): settings = opener_settings.OpenerSettings() @@ -136,11 +126,23 @@ def test_cache_http_errors(self): # Make sure the right call was made _call = _Call(('store_in_cache', (request, response))) - self.assertEqual(cc_mock.mock_calls, [_call]) + assert cc_mock.mock_calls == [_call] cc_mock.reset_mock() # And make sure the response was a 404 - self.assertEqual(response.status, 404) + assert response.status == 404 + + def test_cache_handler_with_enabled_cache(self, http_request): + http_request.get_from_cache = True + cache_handler = CacheHandler(disable_cache=False) + cache_handler.http_response(http_request, self.http_response) + assert cache_handler.default_open(http_request) + + def test_cache_handler_with_disabled_cache(self, http_request): + http_request.get_from_cache = True + cache_handler = CacheHandler(disable_cache=True) + cache_handler.http_response(http_request, self.http_response) + assert not cache_handler.default_open(http_request) class FakeHttplibHTTPResponse(object): From c3e0eec2b7744d419c1e156a78e8defb51506003 Mon Sep 17 00:00:00 2001 From: QBack Date: Mon, 5 Oct 2020 16:25:43 +0200 Subject: [PATCH 39/41] submit strategy error will be saved to debug logs instead of error log. Removed unused import --- w3af/core/controllers/chrome/login/submit_form/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/w3af/core/controllers/chrome/login/submit_form/main.py b/w3af/core/controllers/chrome/login/submit_form/main.py index a4726663c8..f2370de798 100644 --- a/w3af/core/controllers/chrome/login/submit_form/main.py +++ b/w3af/core/controllers/chrome/login/submit_form/main.py @@ -25,7 +25,6 @@ from w3af.core.controllers.chrome.login.submit_form.strategies.press_enter import PressEnterStrategy from w3af.core.controllers.chrome.login.submit_form.strategies.press_tab_enter import PressTabEnterStrategy -from w3af.core.controllers.chrome.login.submit_form.strategies.form_input_submit import FormInputSubmitStrategy class FormSubmitter(object): @@ -93,4 +92,4 @@ def _handle_exception(self, strategy, e): e, self.debugging_id) om.out.debug(msg % args) - om.out.error(traceback.format_exc()) + om.out.debug(traceback.format_exc()) From 1a063e2341f2efc439f5f38107ba35ad577e2a28 Mon Sep 17 00:00:00 2001 From: QBack Date: Mon, 5 Oct 2020 21:16:30 +0200 Subject: [PATCH 40/41] ZeepTransport will save requests it performs, added get_fuzzable_request() method to BaseParser --- w3af/core/data/parsers/doc/baseparser.py | 3 ++ w3af/core/data/parsers/doc/tests/test_wsdl.py | 50 +++++++++++++++++-- w3af/core/data/parsers/doc/wsdl.py | 29 +++++++++++ 3 files changed, 78 insertions(+), 4 deletions(-) diff --git a/w3af/core/data/parsers/doc/baseparser.py b/w3af/core/data/parsers/doc/baseparser.py index 6cb332e28b..4f7e486155 100644 --- a/w3af/core/data/parsers/doc/baseparser.py +++ b/w3af/core/data/parsers/doc/baseparser.py @@ -145,6 +145,9 @@ def get_references(self): """ raise NotImplementedError(NOT_IMPLEMENTED_FMT % 'get_references') + def get_fuzzable_requests(self): + return [] + def get_emails(self, domain=None): """ :return: A set with email addresses diff --git a/w3af/core/data/parsers/doc/tests/test_wsdl.py b/w3af/core/data/parsers/doc/tests/test_wsdl.py index 6a808c04e0..e272cc532f 100644 --- a/w3af/core/data/parsers/doc/tests/test_wsdl.py +++ b/w3af/core/data/parsers/doc/tests/test_wsdl.py @@ -38,6 +38,9 @@ def http_response(): class TestZeepTransport: + def setup_method(self): + self.url = 'http://example.com/' + def test_it_implements_all_needed_methods(self): zeep_transport = ZeepTransport() required_methods = [ @@ -50,16 +53,16 @@ def test_it_implements_all_needed_methods(self): assert hasattr(zeep_transport, method) def test_it_calls_http_client_on_get_method(self, zeep_transport, mocked_http_client): - zeep_transport.get('https://example.com/', '', {}) + zeep_transport.get(self.url, '', {}) assert mocked_http_client.GET.called def test_it_calls_http_client_on_post_method(self, zeep_transport, mocked_http_client): - zeep_transport.post('https://example.com/', 'some data', {}) + zeep_transport.post(self.url, 'some data', {}) assert mocked_http_client.POST.called def test_it_calls_http_client_on_post_xml_method(self, zeep_transport, mocked_http_client): from lxml import etree # feeding Zeep dependencies - zeep_transport.post_xml('https://example.com/', etree.Element('test'), {}) + zeep_transport.post_xml(self.url, etree.Element('test'), {}) assert mocked_http_client.POST.called def test_it_loads_the_response_content(self, zeep_transport, mocked_http_client): @@ -67,9 +70,41 @@ def test_it_loads_the_response_content(self, zeep_transport, mocked_http_client) mocked_response.body = 'test' mocked_http_client.GET = MagicMock(return_value=mocked_response) - result = zeep_transport.load('http://example.com/') + result = zeep_transport.load(self.url) assert result == 'test' + def test_it_reports_requests_performed(self, zeep_transport): + assert not zeep_transport.requests_performed + zeep_transport.get(self.url, '', {}) + logged_request = { + 'url': self.url, + 'method': 'GET', + 'headers': {}, + 'data': None, + } + assert logged_request in zeep_transport.requests_performed + + def test_it_reports_proper_url_if_url_params_are_passed(self, zeep_transport): + params = {'test': True, 'some_val': 5} + zeep_transport.get(self.url, params, {}) + logged_request = { + 'url': '{}?test=True&some_val=5'.format(self.url), + 'method': 'GET', + 'headers': {}, + 'data': None, + } + assert logged_request in zeep_transport.requests_performed + + def test_it_reports_headers_properly(self, zeep_transport): + zeep_transport.get(self.url, '', {'test': True}) + logged_request = { + 'url': self.url, + 'method': 'GET', + 'headers': {'test': True}, + 'data': None, + } + assert logged_request in zeep_transport.requests_performed + class TestZeepTransportIntegration: def test_it_can_perform_get_request(self): @@ -109,3 +144,10 @@ def test_it_uses_extended_urllib_for_performing_requests( with patch('w3af.core.data.parsers.doc.wsdl.ZeepTransport', zeep_transport_from_class): WSDLParser(http_response=http_response) assert mocked_http_client.GET.called + + def test_it_produces_fuzzable_requests(self, http_response): + with NetworkPatcher(): + wsdl_parser = WSDLParser(http_response=http_response) + fuzzable_requests = wsdl_parser.get_fuzzable_requests() + assert len(fuzzable_requests) == 1 + assert fuzzable_requests[0].get_url() == http_response.get_url() diff --git a/w3af/core/data/parsers/doc/wsdl.py b/w3af/core/data/parsers/doc/wsdl.py index adbb01ce31..aa531015ec 100644 --- a/w3af/core/data/parsers/doc/wsdl.py +++ b/w3af/core/data/parsers/doc/wsdl.py @@ -21,6 +21,7 @@ """ import contextlib import sys +import urllib from cStringIO import StringIO import zeep @@ -32,6 +33,7 @@ from w3af.core.data.parsers.doc.baseparser import BaseParser from w3af.core.data.parsers.doc.url import URL from w3af.core.controllers import output_manager +from w3af.core.data.request.fuzzable_request import FuzzableRequest class ZeepTransport(zeep.Transport): @@ -54,22 +56,38 @@ def __init__(self): from w3af.core.data.url.extended_urllib import ExtendedUrllib self.uri_opener = ExtendedUrllib() self.uri_opener.setup(disable_cache=True) + self.requests_performed = [] def get(self, address, params, headers): + self._save_request(address, method='GET', params=params, headers=headers) return self.uri_opener.GET(address, params, headers=headers) def post(self, address, message, headers): + self._save_request(address, method='POST', data=message, headers=headers) return self.uri_opener.POST(address, data=message, headers=headers) def post_xml(self, address, envelope, headers): from zeep.wsdl.utils import etree_to_string message = etree_to_string(envelope) + self._save_request(address, method='POST', data=message, headers=headers) return self.uri_opener.POST(address, data=message, headers=headers) def load(self, url): + self._save_request(address=url, method='GET') response = self.uri_opener.GET(url) return response.body + def _save_request(self, address, method, params=None, headers=None, data=None): + uri = address + if params: + uri += '?{}'.format(urllib.urlencode(params)) + self.requests_performed.append({ + 'url': uri, + 'method': method, + 'headers': headers, + 'data': data, + }) + class ZeepClientAdapter(zeep.Client): def __init__(self, url, transport=None, *args, **kwargs): @@ -141,6 +159,17 @@ def get_references(self): self._report_wsdl_dump() return list(self._discovered_urls), [] + def get_fuzzable_requests(self): + fuzzable_requests = [] + for request_performed in self._wsdl_client.transport.requests_performed: + fuzzable_requests.append(FuzzableRequest( + URL(request_performed['url']), + request_performed['method'], + headers=request_performed['headers'], + post_data=request_performed['data'], + )) + return fuzzable_requests + @contextlib.contextmanager def _redirect_stdout(self, new_stdout): old_stdout = sys.stdout From 48b1545a5e1eea9c2ac8891a1d495997e109c617 Mon Sep 17 00:00:00 2001 From: QBack Date: Wed, 7 Oct 2020 01:29:38 +0200 Subject: [PATCH 41/41] report possible fuzzable requests from document parsers --- w3af/core/data/parsers/document_parser.py | 3 +++ w3af/plugins/crawl/web_spider.py | 4 ++++ w3af/plugins/tests/crawl/test_web_spider.py | 16 ++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/w3af/core/data/parsers/document_parser.py b/w3af/core/data/parsers/document_parser.py index efb253a6f2..88a8cfce9b 100644 --- a/w3af/core/data/parsers/document_parser.py +++ b/w3af/core/data/parsers/document_parser.py @@ -89,6 +89,9 @@ def can_parse(http_resp): return False + def get_fuzzable_requests(self): + return self._parser.get_fuzzable_requests() + def get_forms(self): """ :return: A list of forms. diff --git a/w3af/plugins/crawl/web_spider.py b/w3af/plugins/crawl/web_spider.py index b9869da83c..a5b452de66 100644 --- a/w3af/plugins/crawl/web_spider.py +++ b/w3af/plugins/crawl/web_spider.py @@ -25,6 +25,7 @@ import itertools import w3af.core.controllers.output_manager as om +import w3af.core.data.kb.knowledge_base as kb import w3af.core.data.kb.config as cf import w3af.core.data.parsers.parser_cache as parser_cache import w3af.core.data.constants.response_codes as http_constants @@ -113,6 +114,9 @@ def crawl(self, fuzzable_request, debugging_id): self._extract_html_forms(doc_parser, fuzzable_request, debugging_id) self._extract_links_and_verify(doc_parser, fuzzable_request, http_response, debugging_id) + for fuzzable_request_ in doc_parser.get_fuzzable_requests(): + if fuzzable_request_ not in kb.kb.get_all_known_fuzzable_requests(): + self.output_queue.put(fuzzable_request_) # raise exceptions in the main thread for better handling # diff --git a/w3af/plugins/tests/crawl/test_web_spider.py b/w3af/plugins/tests/crawl/test_web_spider.py index 6ca9d0ccca..2d40e596bb 100644 --- a/w3af/plugins/tests/crawl/test_web_spider.py +++ b/w3af/plugins/tests/crawl/test_web_spider.py @@ -463,3 +463,19 @@ def test_web_spider_reports_wsdl_description( 'NumberToWords' in str(info) for info in result['wsdl_parser']['soap_actions'] ]) + + def test_scanning_soap_adds_fuzzable_request_to_output_queue( + self, + plugin_runner, + soap_domain, + knowledge_base, + ): + web_spider_instance = web_spider() + plugin_runner.run_plugin( + web_spider_instance, + plugin_config=self.plugin_options, + mock_domain=soap_domain, + extra_options=self.extra_options, + ) + # normally web_spider produces 4 known fuzzable request. SOAP parser adds another one. + assert len(knowledge_base.get_all_known_fuzzable_requests()) == 5