troubadix 24.8.1__tar.gz → 24.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {troubadix-24.8.1 → troubadix-24.9.0}/PKG-INFO +14 -5
- {troubadix-24.8.1 → troubadix-24.9.0}/README.md +13 -4
- {troubadix-24.8.1 → troubadix-24.9.0}/pyproject.toml +1 -1
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_copyright_year.py +99 -62
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_calls_recommended.py +3 -4
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/__version__.py +1 -1
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/argparser.py +2 -2
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugin.py +8 -8
- troubadix-24.9.0/troubadix/plugins/copyright_year.py +152 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_calls_recommended.py +3 -1
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/reporter.py +4 -4
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/results.py +2 -4
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/runner.py +4 -4
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/troubadix.py +6 -6
- troubadix-24.8.1/troubadix/plugins/copyright_year.py +0 -96
- {troubadix-24.8.1 → troubadix-24.9.0}/LICENSE +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/helper/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/helper/test_linguistic_exception_handler.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/helper/test_patterns.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/fail.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/fail2.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_badwords.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_copyright_text.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_creation_date.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_cve_format.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_cvss_format.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_dependencies.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_dependency_category_order.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_deprecated_dependency.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_deprecated_functions.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_double_end_points.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_duplicate_oid.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_duplicated_script_tags.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_encoding.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/fail_bad_new_line.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/fail_badwords.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/fail_name_and_copyright_newline.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/fail_name_newline.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/fail_permissions.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/fail_spelling.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/fail.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/fail_badwords.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/fail_name_and_copyright_newline.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/fail_name_newline.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/fail_solution_template.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/runner/fail.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/runner/fail2.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/runner/test.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/runner/test_valid_oid.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/test.inc +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/21.04/test.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/nasl/warning.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/ok_permissions.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_files/test_oid.nasl +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_forking_nasl_functions.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_get_kb_on_services.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_grammar.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_http_links_in_tags.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_illegal_characters.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_log_messages.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_malformed_dependencies.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_misplaced_compare_in_if.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_missing_desc_exit.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_missing_tag_solution.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_multiple_re_parameters.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_newlines.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_overlong_description_lines.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_overlong_script_tags.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_prod_svc_detect_in_vulnvt.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_qod.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_reporting_consistency.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_add_preference_type.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_calls_empty_values.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_category.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_copyright.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_family.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_tag_form.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_tag_whitespaces.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_tags_mandatory.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_version_and_last_modification_tags.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_xref_form.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_script_xref_url.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_security_messages.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_set_get_kb_calls.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_solution_text.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_solution_type.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_spaces_in_filename.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_spelling.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_tabs.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_todo_tbd.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_trailing_spaces_tabs.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_using_display.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_valid_oid.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_valid_script_tag_names.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_variable_redefinition_in_foreach.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_vt_file_permissions.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/plugins/test_vt_placement.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/changed_packages/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/changed_packages/markers/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/changed_packages/markers/test_added_epoch.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/changed_packages/markers/test_added_release.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/changed_packages/markers/test_added_udeb.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/changed_packages/markers/test_changed_update.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/changed_packages/markers/test_dropped_architecture.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/changed_packages/test_changed_packages.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/changed_packages/test_package.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/test_changed_cves.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/test_changed_oid.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/test_deprecate_vts.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/test_file_extensions.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/test_last_modification.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/test_no_solution.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/standalone_plugins/test_version_updated.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/test_argparser.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/test_helper.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/test_naslinter.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/test_reporter.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/test_results.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/tests/test_runner.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/codespell/codespell.additions +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/codespell/codespell.exclude +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/codespell/codespell.ignore +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/helper/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/helper/helper.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/helper/linguistic_exception_handler.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/helper/patterns.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/badwords.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/copyright_text.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/creation_date.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/cve_format.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/cvss_format.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/dependencies.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/dependency_category_order.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/deprecated_dependency.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/deprecated_functions.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/double_end_points.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/duplicate_oid.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/duplicated_script_tags.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/encoding.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/forking_nasl_functions.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/get_kb_on_services.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/grammar.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/http_links_in_tags.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/illegal_characters.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/log_messages.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/malformed_dependencies.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/misplaced_compare_in_if.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/missing_desc_exit.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/missing_tag_solution.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/multiple_re_parameters.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/newlines.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/overlong_description_lines.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/overlong_script_tags.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/prod_svc_detect_in_vulnvt.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/qod.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/reporting_consistency.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_add_preference_type.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_calls_empty_values.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_category.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_copyright.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_family.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_tag_form.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_tag_whitespaces.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_tags_mandatory.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_version_and_last_modification_tags.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_xref_form.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/script_xref_url.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/security_messages.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/set_get_kb_calls.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/solution_text.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/solution_type.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/spaces_in_filename.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/spelling.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/tabs.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/todo_tbd.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/trailing_spaces_tabs.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/using_display.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/valid_oid.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/valid_script_tag_names.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/variable_assigned_in_if.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/variable_redefinition_in_foreach.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/vt_file_permissions.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/plugins/vt_placement.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/allowed_rev_diff.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_cves.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_oid.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_packages/changed_packages.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_packages/marker/__init__.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_packages/marker/added_epoch.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_packages/marker/added_release.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_packages/marker/added_udeb.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_packages/marker/changed_update.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_packages/marker/dropped_architecture.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_packages/marker/marker.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/changed_packages/package.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/common.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/deprecate_vts.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/file_extensions.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/last_modification.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/no_solution.py +0 -0
- {troubadix-24.8.1 → troubadix-24.9.0}/troubadix/standalone_plugins/version_updated.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: troubadix
|
|
3
|
-
Version: 24.
|
|
3
|
+
Version: 24.9.0
|
|
4
4
|
Summary: A linting and QA check tool for NASL files
|
|
5
5
|
Home-page: https://github.com/greenbone/troubadix
|
|
6
6
|
License: GPL-3.0-or-later
|
|
@@ -44,9 +44,19 @@ A linting and QA check tool for NASL files
|
|
|
44
44
|
|
|
45
45
|
Python 3.9 and later is supported.
|
|
46
46
|
|
|
47
|
+
### Install using pipx
|
|
48
|
+
|
|
49
|
+
You can install the latest stable release of **troubadix** from the Python
|
|
50
|
+
Package Index (pypi) using [pipx]
|
|
51
|
+
|
|
52
|
+
python3 -m pipx install troubadix
|
|
53
|
+
|
|
47
54
|
### Install using pip
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
> [!NOTE]
|
|
57
|
+
> The `pip install` command does no longer work out-of-the-box in newer
|
|
58
|
+
> distributions like Ubuntu 23.04 because of [PEP 668](https://peps.python.org/pep-0668).
|
|
59
|
+
> Please use the [installation via pipx](#install-using-pipx) instead.
|
|
50
60
|
|
|
51
61
|
You can install the latest stable release of **troubadix** from the Python
|
|
52
62
|
Package Index (pypi) using [pip]
|
|
@@ -71,9 +81,7 @@ For installation via pipenv please take a look at their [documentation][pipenv].
|
|
|
71
81
|
**troubadix** uses [poetry] for its own dependency management and build
|
|
72
82
|
process.
|
|
73
83
|
|
|
74
|
-
First install poetry
|
|
75
|
-
|
|
76
|
-
python3 -m pip install --user poetry
|
|
84
|
+
First install poetry (see [documentation](https://python-poetry.org/docs/#installation)).
|
|
77
85
|
|
|
78
86
|
Afterwards run
|
|
79
87
|
|
|
@@ -113,6 +121,7 @@ Licensed under the [GNU General Public License v3.0 or later](LICENSE).
|
|
|
113
121
|
[Greenbone]: https://www.greenbone.net/
|
|
114
122
|
[poetry]: https://python-poetry.org/
|
|
115
123
|
[pip]: https://pip.pypa.io/
|
|
124
|
+
[pipx]: https://pypa.github.io/pipx/
|
|
116
125
|
[pipenv]: https://pipenv.pypa.io/
|
|
117
126
|
[autohooks]: https://github.com/greenbone/autohooks
|
|
118
127
|
|
|
@@ -15,9 +15,19 @@ A linting and QA check tool for NASL files
|
|
|
15
15
|
|
|
16
16
|
Python 3.9 and later is supported.
|
|
17
17
|
|
|
18
|
+
### Install using pipx
|
|
19
|
+
|
|
20
|
+
You can install the latest stable release of **troubadix** from the Python
|
|
21
|
+
Package Index (pypi) using [pipx]
|
|
22
|
+
|
|
23
|
+
python3 -m pipx install troubadix
|
|
24
|
+
|
|
18
25
|
### Install using pip
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
> [!NOTE]
|
|
28
|
+
> The `pip install` command does no longer work out-of-the-box in newer
|
|
29
|
+
> distributions like Ubuntu 23.04 because of [PEP 668](https://peps.python.org/pep-0668).
|
|
30
|
+
> Please use the [installation via pipx](#install-using-pipx) instead.
|
|
21
31
|
|
|
22
32
|
You can install the latest stable release of **troubadix** from the Python
|
|
23
33
|
Package Index (pypi) using [pip]
|
|
@@ -42,9 +52,7 @@ For installation via pipenv please take a look at their [documentation][pipenv].
|
|
|
42
52
|
**troubadix** uses [poetry] for its own dependency management and build
|
|
43
53
|
process.
|
|
44
54
|
|
|
45
|
-
First install poetry
|
|
46
|
-
|
|
47
|
-
python3 -m pip install --user poetry
|
|
55
|
+
First install poetry (see [documentation](https://python-poetry.org/docs/#installation)).
|
|
48
56
|
|
|
49
57
|
Afterwards run
|
|
50
58
|
|
|
@@ -84,5 +92,6 @@ Licensed under the [GNU General Public License v3.0 or later](LICENSE).
|
|
|
84
92
|
[Greenbone]: https://www.greenbone.net/
|
|
85
93
|
[poetry]: https://python-poetry.org/
|
|
86
94
|
[pip]: https://pip.pypa.io/
|
|
95
|
+
[pipx]: https://pypa.github.io/pipx/
|
|
87
96
|
[pipenv]: https://pipenv.pypa.io/
|
|
88
97
|
[autohooks]: https://github.com/greenbone/autohooks
|
|
@@ -26,13 +26,15 @@ class CheckCopyrightYearTestCase(PluginTestCase):
|
|
|
26
26
|
def test_ok_new_header(self):
|
|
27
27
|
path = Path("some/file.nasl")
|
|
28
28
|
content = (
|
|
29
|
-
"# SPDX-FileCopyrightText: 2022 Greenbone AG"
|
|
29
|
+
"# SPDX-FileCopyrightText: 2022 Greenbone AG\n"
|
|
30
|
+
"# SPDX-FileCopyrightText: 2022 some other person\n"
|
|
30
31
|
' script_tag(name:"creation_date", value:"2022-05-14 11:24:55 '
|
|
31
|
-
'+0200 (Tue, 14 May 2022)")
|
|
32
|
-
' script_copyright("Copyright (C) 2022 Greenbone AG")
|
|
32
|
+
'+0200 (Tue, 14 May 2022)");\n'
|
|
33
|
+
' script_copyright("Copyright (C) 2022 Greenbone AG");\n'
|
|
33
34
|
)
|
|
35
|
+
|
|
34
36
|
fake_context = self.create_file_plugin_context(
|
|
35
|
-
nasl_file=path,
|
|
37
|
+
nasl_file=path, file_content=content
|
|
36
38
|
)
|
|
37
39
|
plugin = CheckCopyrightYear(fake_context)
|
|
38
40
|
|
|
@@ -42,153 +44,188 @@ class CheckCopyrightYearTestCase(PluginTestCase):
|
|
|
42
44
|
def test_ok_old_header(self):
|
|
43
45
|
path = Path("some/file.nasl")
|
|
44
46
|
content = (
|
|
45
|
-
"# Copyright (C) 2022 Greenbone AG"
|
|
47
|
+
"# Copyright (C) 2022 Greenbone AG\n"
|
|
48
|
+
"# Copyright (C) 2022 some other Person\n"
|
|
46
49
|
' script_tag(name:"creation_date", value:"2022-05-14 11:24:55 '
|
|
47
|
-
'+0200 (Tue, 14 May 2022)")
|
|
48
|
-
' script_copyright("Copyright (C) 2022 Greenbone AG")
|
|
50
|
+
'+0200 (Tue, 14 May 2022)");\n'
|
|
51
|
+
' script_copyright("Copyright (C) 2022 Greenbone AG");\n'
|
|
49
52
|
)
|
|
50
53
|
fake_context = self.create_file_plugin_context(
|
|
51
|
-
nasl_file=path,
|
|
54
|
+
nasl_file=path, file_content=content
|
|
52
55
|
)
|
|
53
56
|
plugin = CheckCopyrightYear(fake_context)
|
|
54
57
|
|
|
55
58
|
results = list(plugin.run())
|
|
56
59
|
self.assertEqual(len(results), 0)
|
|
57
60
|
|
|
58
|
-
def
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
results = list(plugin.run())
|
|
64
|
-
|
|
65
|
-
self.assertEqual(len(results), 0)
|
|
66
|
-
|
|
67
|
-
def test_pre_ok_new_header(self):
|
|
61
|
+
def test_pre2008_ok_new_header(self):
|
|
62
|
+
# tests that special cases pass:
|
|
63
|
+
# copyright < creation year for pre2008
|
|
64
|
+
# additional copyright that is newer but ok
|
|
68
65
|
path = Path("some/pre2008/file.nasl")
|
|
69
66
|
content = (
|
|
70
|
-
"# SPDX-FileCopyrightText:
|
|
67
|
+
"# SPDX-FileCopyrightText: 2010 Greenbone AG\n"
|
|
68
|
+
"# SPDX-FileCopyrightText: New code since 2022 Greenbone AG\n"
|
|
71
69
|
' script_tag(name:"creation_date", value:"2022-05-14 11:24:55 '
|
|
72
|
-
'+0200 (Tue, 14 May 2022)")
|
|
73
|
-
' script_copyright("Copyright (C) 2020 Greenbone AG")
|
|
70
|
+
'+0200 (Tue, 14 May 2022)");\n'
|
|
71
|
+
' script_copyright("Copyright (C) 2020 Greenbone AG");\n'
|
|
74
72
|
)
|
|
75
73
|
fake_context = self.create_file_plugin_context(
|
|
76
|
-
nasl_file=path,
|
|
74
|
+
nasl_file=path, file_content=content
|
|
77
75
|
)
|
|
78
76
|
plugin = CheckCopyrightYear(fake_context)
|
|
79
77
|
|
|
80
78
|
results = list(plugin.run())
|
|
81
79
|
self.assertEqual(len(results), 0)
|
|
82
80
|
|
|
83
|
-
def
|
|
81
|
+
def test_pre2008_ok_old_header(self):
|
|
84
82
|
path = Path("some/pre2008/file.nasl")
|
|
85
83
|
content = (
|
|
86
|
-
"# Copyright (C) 2020 Greenbone AG"
|
|
84
|
+
"# Copyright (C) 2020 Greenbone AG\n"
|
|
87
85
|
' script_tag(name:"creation_date", value:"2022-05-14 11:24:55 '
|
|
88
|
-
'+0200 (Tue, 14 May 2022)")
|
|
89
|
-
' script_copyright("Copyright (C) 2020 Greenbone AG")
|
|
86
|
+
'+0200 (Tue, 14 May 2022)");\n'
|
|
87
|
+
' script_copyright("Copyright (C) 2020 Greenbone AG");\n'
|
|
90
88
|
)
|
|
91
89
|
fake_context = self.create_file_plugin_context(
|
|
92
|
-
nasl_file=path,
|
|
90
|
+
nasl_file=path, file_content=content
|
|
93
91
|
)
|
|
94
92
|
plugin = CheckCopyrightYear(fake_context)
|
|
95
93
|
|
|
96
94
|
results = list(plugin.run())
|
|
97
95
|
self.assertEqual(len(results), 0)
|
|
98
96
|
|
|
99
|
-
def
|
|
100
|
-
path = Path("some/
|
|
97
|
+
def test_exclude_inc_file(self):
|
|
98
|
+
path = Path("some/file.inc")
|
|
99
|
+
fake_context = self.create_file_plugin_context(nasl_file=path)
|
|
100
|
+
plugin = CheckCopyrightYear(fake_context)
|
|
101
|
+
|
|
102
|
+
results = list(plugin.run())
|
|
103
|
+
|
|
104
|
+
self.assertEqual(len(results), 0)
|
|
105
|
+
|
|
106
|
+
def test_missing_creation_date(self):
|
|
107
|
+
path = Path("some/file.nasl")
|
|
101
108
|
content = (
|
|
102
|
-
|
|
103
|
-
'
|
|
104
|
-
' script_copyright("Copyright (C) 2021 Greenbone AG");',
|
|
109
|
+
"# SPDX-FileCopyrightText: 2022 Greenbone AG\n"
|
|
110
|
+
' script_copyright("Copyright (C) 2022 Greenbone AG");\n'
|
|
105
111
|
)
|
|
112
|
+
|
|
106
113
|
fake_context = self.create_file_plugin_context(
|
|
107
|
-
nasl_file=path,
|
|
114
|
+
nasl_file=path, file_content=content
|
|
108
115
|
)
|
|
109
116
|
plugin = CheckCopyrightYear(fake_context)
|
|
110
117
|
|
|
111
118
|
results = list(plugin.run())
|
|
112
119
|
self.assertEqual(len(results), 1)
|
|
113
120
|
self.assertEqual(
|
|
114
|
-
"
|
|
115
|
-
"the creation year 2020 at line 2",
|
|
116
|
-
results[0].message,
|
|
121
|
+
"Missing creation_date statement in VT", results[0].message
|
|
117
122
|
)
|
|
118
123
|
|
|
119
|
-
def
|
|
124
|
+
def test_missing_copyright_tag(self):
|
|
120
125
|
path = Path("some/file.nasl")
|
|
121
126
|
content = (
|
|
122
|
-
|
|
123
|
-
'
|
|
127
|
+
"# SPDX-FileCopyrightText: 2022 Greenbone AG\n"
|
|
128
|
+
' script_tag(name:"creation_date", value:"2022-05-14 11:24:55 '
|
|
129
|
+
'+0200 (Tue, 14 May 2022)");\n'
|
|
124
130
|
)
|
|
131
|
+
|
|
125
132
|
fake_context = self.create_file_plugin_context(
|
|
126
|
-
nasl_file=path,
|
|
133
|
+
nasl_file=path, file_content=content
|
|
127
134
|
)
|
|
128
135
|
plugin = CheckCopyrightYear(fake_context)
|
|
129
136
|
|
|
130
137
|
results = list(plugin.run())
|
|
131
138
|
self.assertEqual(len(results), 1)
|
|
132
|
-
self.assertEqual(
|
|
133
|
-
"Missing creation_date statement in VT", results[0].message
|
|
134
|
-
)
|
|
139
|
+
self.assertEqual("Missing copyright tag in VT", results[0].message)
|
|
135
140
|
|
|
136
|
-
def
|
|
141
|
+
def test_regex_fail_copyright_tag(self):
|
|
137
142
|
path = Path("some/file.nasl")
|
|
138
143
|
content = (
|
|
144
|
+
"# SPDX-FileCopyrightText: 2022 Greenbone AG\n"
|
|
139
145
|
' script_tag(name:"creation_date", value:"2022-05-14 11:24:55 '
|
|
140
|
-
'+0200 (Tue, 14 May
|
|
141
|
-
' script_copyright("Copyright (C)
|
|
146
|
+
'+0200 (Tue, 14 May 2022)");\n'
|
|
147
|
+
' script_copyright("Copyright (C) Greenbone AG");\n'
|
|
142
148
|
)
|
|
149
|
+
|
|
143
150
|
fake_context = self.create_file_plugin_context(
|
|
144
|
-
nasl_file=path,
|
|
151
|
+
nasl_file=path, file_content=content
|
|
145
152
|
)
|
|
146
153
|
plugin = CheckCopyrightYear(fake_context)
|
|
147
154
|
|
|
148
155
|
results = list(plugin.run())
|
|
149
156
|
self.assertEqual(len(results), 1)
|
|
150
157
|
self.assertEqual(
|
|
151
|
-
"
|
|
152
|
-
"the creation year 2022 at line 2",
|
|
158
|
+
"Unable to extract year from script_copyright tag in VT",
|
|
153
159
|
results[0].message,
|
|
154
160
|
)
|
|
155
161
|
|
|
156
|
-
def
|
|
162
|
+
def test_missing_header_copyright(self):
|
|
157
163
|
path = Path("some/file.nasl")
|
|
158
164
|
content = (
|
|
159
|
-
"# Copyright (C) 2020 Greenbone AG",
|
|
160
165
|
' script_tag(name:"creation_date", value:"2022-05-14 11:24:55 '
|
|
161
|
-
'+0200 (Tue, 14 May
|
|
166
|
+
'+0200 (Tue, 14 May 2022)");\n'
|
|
167
|
+
' script_copyright("Copyright (C) 2022 Greenbone AG");\n'
|
|
162
168
|
)
|
|
169
|
+
|
|
163
170
|
fake_context = self.create_file_plugin_context(
|
|
164
|
-
nasl_file=path,
|
|
171
|
+
nasl_file=path, file_content=content
|
|
165
172
|
)
|
|
166
173
|
plugin = CheckCopyrightYear(fake_context)
|
|
167
174
|
|
|
168
175
|
results = list(plugin.run())
|
|
169
176
|
self.assertEqual(len(results), 1)
|
|
170
177
|
self.assertEqual(
|
|
171
|
-
"VT
|
|
172
|
-
|
|
178
|
+
"VT header is missing a copyright text",
|
|
179
|
+
results[0].message,
|
|
180
|
+
)
|
|
181
|
+
return
|
|
182
|
+
|
|
183
|
+
def test_pre2008_fail(self):
|
|
184
|
+
path = Path("some/pre2008/file.nasl")
|
|
185
|
+
content = (
|
|
186
|
+
"# Copyright (C) 2021 Greenbone AG\n"
|
|
187
|
+
' script_tag(name:"creation_date", value:"2020-05-14 11:24:55 '
|
|
188
|
+
'+0200 (Tue, 14 May 2020)");\n'
|
|
189
|
+
' script_copyright("Copyright (C) 2021 Greenbone AG");\n'
|
|
190
|
+
)
|
|
191
|
+
fake_context = self.create_file_plugin_context(
|
|
192
|
+
nasl_file=path, file_content=content
|
|
193
|
+
)
|
|
194
|
+
plugin = CheckCopyrightYear(fake_context)
|
|
195
|
+
|
|
196
|
+
results = list(plugin.run())
|
|
197
|
+
self.assertEqual(len(results), 2)
|
|
198
|
+
self.assertEqual(
|
|
199
|
+
"a pre2008 vt has a copyright tag year newer than the creation_year",
|
|
173
200
|
results[0].message,
|
|
174
201
|
)
|
|
202
|
+
self.assertEqual(
|
|
203
|
+
"a pre2008 vt has a copyright value in the fileheader"
|
|
204
|
+
" newer than the creation_year",
|
|
205
|
+
results[1].message,
|
|
206
|
+
)
|
|
175
207
|
|
|
176
|
-
def
|
|
208
|
+
def test_fail(self):
|
|
177
209
|
path = Path("some/file.nasl")
|
|
178
210
|
content = (
|
|
179
|
-
"# SPDX-FileCopyrightText:
|
|
211
|
+
"# SPDX-FileCopyrightText: 3000 Greenbone AG\n"
|
|
180
212
|
' script_tag(name:"creation_date", value:"2022-05-14 11:24:55 '
|
|
181
|
-
'+0200 (Tue, 14 May
|
|
213
|
+
'+0200 (Tue, 14 May 2022)");\n'
|
|
214
|
+
' script_copyright("Copyright (C) 1000 Greenbone AG");\n'
|
|
182
215
|
)
|
|
216
|
+
|
|
183
217
|
fake_context = self.create_file_plugin_context(
|
|
184
|
-
nasl_file=path,
|
|
218
|
+
nasl_file=path, file_content=content
|
|
185
219
|
)
|
|
186
220
|
plugin = CheckCopyrightYear(fake_context)
|
|
187
221
|
|
|
188
222
|
results = list(plugin.run())
|
|
189
|
-
self.assertEqual(len(results),
|
|
223
|
+
self.assertEqual(len(results), 2)
|
|
190
224
|
self.assertEqual(
|
|
191
|
-
"
|
|
192
|
-
"the creation year 2022 at line 1",
|
|
225
|
+
"script_copyright tag does not match the creation year",
|
|
193
226
|
results[0].message,
|
|
194
227
|
)
|
|
228
|
+
self.assertEqual(
|
|
229
|
+
"a copyright in the fileheader does not match the creation year",
|
|
230
|
+
results[1].message,
|
|
231
|
+
)
|
|
@@ -67,11 +67,10 @@ class CheckScriptCallsRecommendedTestCase(PluginTestCase):
|
|
|
67
67
|
|
|
68
68
|
def test_dependencies_multiline(self):
|
|
69
69
|
content = (
|
|
70
|
+
# tests group1
|
|
70
71
|
' script_dependencies("123",\n"456");\n'
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
" script_require_keys();\n"
|
|
74
|
-
" script_mandatory_keys();\n"
|
|
72
|
+
# tests group2
|
|
73
|
+
' script_mandatory_keys("foo",\n"bar");\n'
|
|
75
74
|
)
|
|
76
75
|
fake_context = self.create_file_plugin_context(
|
|
77
76
|
nasl_file=self.path, file_content=content
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
|
|
20
20
|
import sys
|
|
21
21
|
from argparse import ArgumentParser, Namespace
|
|
22
|
+
from collections.abc import Sequence
|
|
22
23
|
from multiprocessing import cpu_count
|
|
23
24
|
from pathlib import Path
|
|
24
|
-
from typing import Iterable
|
|
25
25
|
|
|
26
26
|
from pontos.terminal import Terminal
|
|
27
27
|
|
|
@@ -56,7 +56,7 @@ def check_cpu_count(number: str) -> int:
|
|
|
56
56
|
|
|
57
57
|
def parse_args(
|
|
58
58
|
terminal: Terminal,
|
|
59
|
-
args:
|
|
59
|
+
args: Sequence[str],
|
|
60
60
|
) -> Namespace:
|
|
61
61
|
"""Parsing args for troubadix
|
|
62
62
|
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
18
|
from abc import ABC, abstractmethod
|
|
19
|
+
from collections.abc import Iterable, Iterator
|
|
19
20
|
from dataclasses import dataclass
|
|
20
21
|
from pathlib import Path
|
|
21
|
-
from typing import
|
|
22
|
+
from typing import Optional
|
|
22
23
|
|
|
23
24
|
from troubadix.helper import CURRENT_ENCODING
|
|
24
25
|
|
|
@@ -50,13 +51,13 @@ class FilePluginContext:
|
|
|
50
51
|
self,
|
|
51
52
|
*,
|
|
52
53
|
root: Path,
|
|
53
|
-
nasl_file: Path
|
|
54
|
+
nasl_file: Path,
|
|
54
55
|
) -> None:
|
|
55
56
|
self.root = root
|
|
56
57
|
self.nasl_file = nasl_file
|
|
57
58
|
|
|
58
|
-
self._file_content = None
|
|
59
|
-
self._lines = None
|
|
59
|
+
self._file_content: str | None = None
|
|
60
|
+
self._lines: list[str] | None = None
|
|
60
61
|
|
|
61
62
|
@property
|
|
62
63
|
def file_content(self) -> str:
|
|
@@ -67,7 +68,7 @@ class FilePluginContext:
|
|
|
67
68
|
return self._file_content
|
|
68
69
|
|
|
69
70
|
@property
|
|
70
|
-
def lines(self) ->
|
|
71
|
+
def lines(self) -> list[str]:
|
|
71
72
|
if not self._lines:
|
|
72
73
|
self._lines = self.file_content.splitlines()
|
|
73
74
|
return self._lines
|
|
@@ -82,15 +83,14 @@ class FilesPluginContext:
|
|
|
82
83
|
class Plugin(ABC):
|
|
83
84
|
"""A linter plugin"""
|
|
84
85
|
|
|
85
|
-
name: str
|
|
86
|
-
description: str = None
|
|
86
|
+
name: str
|
|
87
87
|
|
|
88
88
|
@abstractmethod
|
|
89
89
|
def run(self) -> Iterator[LinterResult]:
|
|
90
90
|
pass
|
|
91
91
|
|
|
92
92
|
def fix(self) -> Iterator[LinterResult]:
|
|
93
|
-
return []
|
|
93
|
+
return iter([])
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
class FilesPlugin(Plugin):
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2021 Greenbone AG
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Iterator
|
|
8
|
+
|
|
9
|
+
from troubadix.helper import is_ignore_file
|
|
10
|
+
from troubadix.helper.patterns import (
|
|
11
|
+
ScriptTag,
|
|
12
|
+
SpecialScriptTag,
|
|
13
|
+
get_script_tag_pattern,
|
|
14
|
+
get_special_script_tag_pattern,
|
|
15
|
+
)
|
|
16
|
+
from troubadix.plugin import (
|
|
17
|
+
FileContentPlugin,
|
|
18
|
+
LinterError,
|
|
19
|
+
LinterResult,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
_IGNORE_FILES = ()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
SPDX_OR_COPYRIGHT_PATTERN = re.compile(
|
|
26
|
+
r"(SPDX-FileCopyrightText:|Copyright \(C\))\s*(?P<year>\d{4})"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _generate_header_lines(file_content: str):
|
|
31
|
+
for line in file_content.splitlines():
|
|
32
|
+
if line.startswith("#"):
|
|
33
|
+
yield line
|
|
34
|
+
else:
|
|
35
|
+
break
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class CheckCopyrightYear(FileContentPlugin):
|
|
39
|
+
"""This steps checks if a VT contains a Copyright statement containing a
|
|
40
|
+
year not matching the year defined in the creation_date statement.
|
|
41
|
+
|
|
42
|
+
pre2008 script copyright are allowed to predate the creation_year
|
|
43
|
+
|
|
44
|
+
For scripts that contain multiple copyrights with different dates,
|
|
45
|
+
like gather-package-list.nasl, it is important that the newer one,
|
|
46
|
+
which is only valid as of a certain year, has information about
|
|
47
|
+
what it covers in the place where the year would normally be.
|
|
48
|
+
Then that line will be automatically ignored
|
|
49
|
+
without having to add it to the ignore list due to not matching the regex.
|
|
50
|
+
Example:
|
|
51
|
+
if creation year = 2008
|
|
52
|
+
ok:
|
|
53
|
+
# SPDX-FileCopyrightText: 2008 Tim Brown
|
|
54
|
+
# SPDX-FileCopyrightText: New detection methods / pattern / code since 2009 Greenbone AG
|
|
55
|
+
not ok / needs ignore entry:
|
|
56
|
+
# New NASL / detection code since 2018 Copyright (C) 2018 Greenbone AG
|
|
57
|
+
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
name = "check_copyright_year"
|
|
61
|
+
|
|
62
|
+
def check_content(
|
|
63
|
+
self, nasl_file: Path, file_content: str
|
|
64
|
+
) -> Iterator[LinterResult]:
|
|
65
|
+
if nasl_file.suffix == ".inc" or is_ignore_file(
|
|
66
|
+
nasl_file, _IGNORE_FILES
|
|
67
|
+
):
|
|
68
|
+
return
|
|
69
|
+
# extract creation year from script tag
|
|
70
|
+
creation_date_pattern = get_script_tag_pattern(ScriptTag.CREATION_DATE)
|
|
71
|
+
creation_date_match = creation_date_pattern.search(file_content)
|
|
72
|
+
if not creation_date_match:
|
|
73
|
+
yield LinterError(
|
|
74
|
+
"Missing creation_date statement in VT",
|
|
75
|
+
file=nasl_file,
|
|
76
|
+
plugin=self.name,
|
|
77
|
+
)
|
|
78
|
+
return
|
|
79
|
+
creation_year = int(creation_date_match.group("value")[:4])
|
|
80
|
+
|
|
81
|
+
# extract year in value of script_copyright tag
|
|
82
|
+
script_copyright_pattern = get_special_script_tag_pattern(
|
|
83
|
+
SpecialScriptTag.COPYRIGHT
|
|
84
|
+
)
|
|
85
|
+
script_copyright_match = script_copyright_pattern.search(file_content)
|
|
86
|
+
if not script_copyright_match:
|
|
87
|
+
yield LinterError(
|
|
88
|
+
"Missing copyright tag in VT",
|
|
89
|
+
file=nasl_file,
|
|
90
|
+
plugin=self.name,
|
|
91
|
+
)
|
|
92
|
+
return
|
|
93
|
+
copyright_tag_value = script_copyright_match.group("value")
|
|
94
|
+
copyright_tag_match = SPDX_OR_COPYRIGHT_PATTERN.search(
|
|
95
|
+
copyright_tag_value
|
|
96
|
+
)
|
|
97
|
+
if not copyright_tag_match:
|
|
98
|
+
yield LinterError(
|
|
99
|
+
"Unable to extract year from script_copyright tag in VT",
|
|
100
|
+
file=nasl_file,
|
|
101
|
+
plugin=self.name,
|
|
102
|
+
)
|
|
103
|
+
return
|
|
104
|
+
copyright_tag_year = int(copyright_tag_match.group("year"))
|
|
105
|
+
|
|
106
|
+
# list comprehension to collect copy right matches from header
|
|
107
|
+
header_lines = _generate_header_lines(file_content)
|
|
108
|
+
header_copyright_years = [
|
|
109
|
+
int(match.group("year"))
|
|
110
|
+
for line in header_lines
|
|
111
|
+
if (match := SPDX_OR_COPYRIGHT_PATTERN.search(line))
|
|
112
|
+
]
|
|
113
|
+
|
|
114
|
+
if not header_copyright_years:
|
|
115
|
+
yield LinterError(
|
|
116
|
+
"VT header is missing a copyright text",
|
|
117
|
+
file=nasl_file,
|
|
118
|
+
plugin=self.name,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# check if the copyrights years match the creation year
|
|
122
|
+
# pre2008 VTs are allowed to have a copyright that predates the year of creation.
|
|
123
|
+
if copyright_tag_year != creation_year:
|
|
124
|
+
if "pre2008" in str(nasl_file):
|
|
125
|
+
if copyright_tag_year > creation_year:
|
|
126
|
+
yield LinterError(
|
|
127
|
+
"a pre2008 vt has a copyright tag year newer than the creation_year",
|
|
128
|
+
file=nasl_file,
|
|
129
|
+
plugin=self.name,
|
|
130
|
+
)
|
|
131
|
+
else:
|
|
132
|
+
yield LinterError(
|
|
133
|
+
"script_copyright tag does not match the creation year",
|
|
134
|
+
file=nasl_file,
|
|
135
|
+
plugin=self.name,
|
|
136
|
+
)
|
|
137
|
+
for copyright_year in header_copyright_years:
|
|
138
|
+
if creation_year != copyright_year:
|
|
139
|
+
if "pre2008" in str(nasl_file):
|
|
140
|
+
if copyright_year > creation_year:
|
|
141
|
+
yield LinterError(
|
|
142
|
+
"a pre2008 vt has a copyright value in the fileheader"
|
|
143
|
+
" newer than the creation_year",
|
|
144
|
+
file=nasl_file,
|
|
145
|
+
plugin=self.name,
|
|
146
|
+
)
|
|
147
|
+
else:
|
|
148
|
+
yield LinterError(
|
|
149
|
+
"a copyright in the fileheader does not match the creation year",
|
|
150
|
+
file=nasl_file,
|
|
151
|
+
plugin=self.name,
|
|
152
|
+
)
|
|
@@ -73,7 +73,9 @@ class CheckScriptCallsRecommended(FileContentPlugin):
|
|
|
73
73
|
]
|
|
74
74
|
|
|
75
75
|
if not _get_special_script_tag_pattern(
|
|
76
|
-
name=rf"({'|'.join(recommended_many_call)})",
|
|
76
|
+
name=rf"({'|'.join(recommended_many_call)})",
|
|
77
|
+
value=".*?",
|
|
78
|
+
flags=re.DOTALL,
|
|
77
79
|
).search(file_content):
|
|
78
80
|
yield LinterWarning(
|
|
79
81
|
"VT contains none of the following recommended calls: "
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
|
+
from collections.abc import Iterable
|
|
18
19
|
from pathlib import Path
|
|
19
|
-
from typing import Iterable, List
|
|
20
20
|
|
|
21
21
|
from pontos.terminal import Terminal
|
|
22
22
|
|
|
@@ -33,8 +33,8 @@ class Reporter:
|
|
|
33
33
|
root: Path,
|
|
34
34
|
*,
|
|
35
35
|
fix: bool = False,
|
|
36
|
-
log_file: Path = None,
|
|
37
|
-
log_file_statistic: Path = None,
|
|
36
|
+
log_file: Path | None = None,
|
|
37
|
+
log_file_statistic: Path | None = None,
|
|
38
38
|
statistic: bool = True,
|
|
39
39
|
verbose: int = 0,
|
|
40
40
|
ignore_warnings: bool = False,
|
|
@@ -78,7 +78,7 @@ class Reporter:
|
|
|
78
78
|
self._log_append(f"\t\t{message}".replace("\n", "\n\t\t"))
|
|
79
79
|
|
|
80
80
|
def _process_plugin_results(
|
|
81
|
-
self, plugin_name: str, plugin_results:
|
|
81
|
+
self, plugin_name: str, plugin_results: Iterable[LinterResult]
|
|
82
82
|
):
|
|
83
83
|
"""Process the results of a plugin: Print/Log results if
|
|
84
84
|
verbosity/logging fits and count the results"""
|