troubadix 25.12.4__py3-none-any.whl → 26.2.0__py3-none-any.whl
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/__version__.py +1 -1
- troubadix/argparser.py +4 -14
- troubadix/helper/date_format.py +3 -8
- troubadix/helper/helper.py +1 -3
- troubadix/helper/if_block_parser.py +14 -37
- troubadix/helper/linguistic_exception_handler.py +6 -18
- troubadix/helper/patterns.py +7 -19
- troubadix/helper/remove_comments.py +1 -4
- troubadix/helper/text_utils.py +1 -3
- troubadix/plugin.py +3 -9
- troubadix/plugins/__init__.py +6 -20
- troubadix/plugins/badwords.py +3 -9
- troubadix/plugins/copyright_text.py +2 -5
- troubadix/plugins/copyright_year.py +4 -12
- troubadix/plugins/creation_date.py +3 -9
- troubadix/plugins/cvss_format.py +1 -3
- troubadix/plugins/dependencies.py +2 -5
- troubadix/plugins/dependency_category_order.py +7 -20
- troubadix/plugins/deprecated_dependency.py +6 -16
- troubadix/plugins/deprecated_functions.py +2 -4
- troubadix/plugins/double_end_points.py +2 -7
- troubadix/plugins/duplicate_oid.py +1 -3
- troubadix/plugins/duplicated_script_tags.py +1 -2
- troubadix/plugins/forking_nasl_functions.py +1 -4
- troubadix/plugins/get_kb_on_services.py +2 -4
- troubadix/plugins/grammar.py +8 -20
- troubadix/plugins/http_links_in_tags.py +3 -6
- troubadix/plugins/illegal_characters.py +6 -15
- troubadix/plugins/log_messages.py +1 -2
- troubadix/plugins/malformed_dependencies.py +2 -6
- troubadix/plugins/missing_desc_exit.py +1 -3
- troubadix/plugins/multiple_re_parameters.py +2 -7
- troubadix/plugins/newlines.py +1 -2
- troubadix/plugins/overlong_description_lines.py +2 -6
- troubadix/plugins/overlong_script_tags.py +9 -14
- troubadix/plugins/prod_svc_detect_in_vulnvt.py +1 -4
- troubadix/plugins/qod.py +0 -1
- troubadix/plugins/script_add_preference_id.py +3 -10
- troubadix/plugins/script_add_preference_type.py +2 -7
- troubadix/plugins/script_calls_empty_values.py +3 -3
- troubadix/plugins/script_calls_recommended.py +5 -8
- troubadix/plugins/script_copyright.py +1 -3
- troubadix/plugins/script_family.py +1 -2
- troubadix/plugins/script_tag_form.py +1 -3
- troubadix/plugins/script_tag_whitespaces.py +5 -10
- troubadix/plugins/script_tags_mandatory.py +2 -5
- troubadix/plugins/script_version_and_last_modification_tags.py +6 -17
- troubadix/plugins/script_xref_form.py +1 -3
- troubadix/plugins/script_xref_url.py +3 -7
- troubadix/plugins/security_messages.py +8 -21
- troubadix/plugins/severity_date.py +3 -10
- troubadix/plugins/severity_format.py +1 -4
- troubadix/plugins/severity_origin.py +1 -4
- troubadix/plugins/solution_text.py +6 -10
- troubadix/plugins/solution_type.py +1 -2
- troubadix/plugins/spaces_before_dots.py +2 -9
- troubadix/plugins/spaces_in_filename.py +1 -2
- troubadix/plugins/spelling.py +5 -14
- troubadix/plugins/trailing_spaces_tabs.py +2 -5
- troubadix/plugins/using_display.py +2 -6
- troubadix/plugins/valid_oid.py +51 -60
- troubadix/plugins/valid_script_tag_names.py +2 -5
- troubadix/plugins/variable_assigned_in_if.py +2 -7
- troubadix/plugins/variable_redefinition_in_foreach.py +2 -6
- troubadix/plugins/vt_placement.py +2 -8
- troubadix/reporter.py +7 -21
- troubadix/results.py +2 -8
- troubadix/runner.py +5 -14
- troubadix/standalone_plugins/allowed_rev_diff.py +8 -25
- troubadix/standalone_plugins/changed_creation_date.py +4 -14
- troubadix/standalone_plugins/changed_cves.py +4 -12
- troubadix/standalone_plugins/changed_oid.py +3 -8
- troubadix/standalone_plugins/changed_packages/changed_packages.py +3 -8
- troubadix/standalone_plugins/changed_packages/marker/changed_update.py +1 -3
- troubadix/standalone_plugins/changed_packages/marker/dropped_architecture.py +1 -3
- troubadix/standalone_plugins/changed_packages/package.py +13 -7
- troubadix/standalone_plugins/dependency_graph/checks.py +5 -15
- troubadix/standalone_plugins/dependency_graph/dependency_graph.py +5 -13
- troubadix/standalone_plugins/deprecate_vts.py +3 -9
- troubadix/standalone_plugins/file_extensions.py +3 -10
- troubadix/standalone_plugins/last_modification.py +3 -9
- troubadix/standalone_plugins/no_solution.py +12 -34
- troubadix/standalone_plugins/util.py +0 -2
- troubadix/standalone_plugins/version_updated.py +5 -14
- troubadix/troubadix.py +1 -4
- {troubadix-25.12.4.dist-info → troubadix-26.2.0.dist-info}/METADATA +1 -1
- troubadix-26.2.0.dist-info/RECORD +116 -0
- {troubadix-25.12.4.dist-info → troubadix-26.2.0.dist-info}/WHEEL +1 -1
- troubadix-25.12.4.dist-info/RECORD +0 -116
- {troubadix-25.12.4.dist-info → troubadix-26.2.0.dist-info}/entry_points.txt +0 -0
- {troubadix-25.12.4.dist-info → troubadix-26.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -84,9 +84,7 @@ class CheckScriptVersionAndLastModificationTags(FileContentPlugin):
|
|
|
84
84
|
self.old_script_version_value = match_script_version_any.group("value")
|
|
85
85
|
|
|
86
86
|
# script_version("2019-03-21T12:19:01+0000");")
|
|
87
|
-
version_pattern = get_special_script_tag_pattern(
|
|
88
|
-
SpecialScriptTag.VERSION
|
|
89
|
-
)
|
|
87
|
+
version_pattern = get_special_script_tag_pattern(SpecialScriptTag.VERSION)
|
|
90
88
|
version_match = version_pattern.search(file_content)
|
|
91
89
|
|
|
92
90
|
if not version_match:
|
|
@@ -122,22 +120,17 @@ class CheckScriptVersionAndLastModificationTags(FileContentPlugin):
|
|
|
122
120
|
return
|
|
123
121
|
|
|
124
122
|
self.old_last_modification = match_last_modification_any_value.group(0)
|
|
125
|
-
self.old_last_modification_value = (
|
|
126
|
-
match_last_modification_any_value.group("value")
|
|
127
|
-
)
|
|
123
|
+
self.old_last_modification_value = match_last_modification_any_value.group("value")
|
|
128
124
|
|
|
129
125
|
# script_tag(name:"last_modification",
|
|
130
126
|
# value:"2019-03-21 12:19:01 +0000 (Thu, 21 Mar 2019)");
|
|
131
|
-
last_modification_pattern = get_script_tag_pattern(
|
|
132
|
-
ScriptTag.LAST_MODIFICATION
|
|
133
|
-
)
|
|
127
|
+
last_modification_pattern = get_script_tag_pattern(ScriptTag.LAST_MODIFICATION)
|
|
134
128
|
match_last_modified = last_modification_pattern.search(file_content)
|
|
135
129
|
|
|
136
130
|
if not match_last_modified:
|
|
137
131
|
self.fix_last_modification_and_version = True
|
|
138
132
|
yield LinterError(
|
|
139
|
-
|
|
140
|
-
'name:"last_modification".',
|
|
133
|
+
'VT is is using a wrong syntax for script_tag(name:"last_modification".',
|
|
141
134
|
file=nasl_file,
|
|
142
135
|
plugin=self.name,
|
|
143
136
|
)
|
|
@@ -198,18 +191,14 @@ class CheckScriptVersionAndLastModificationTags(FileContentPlugin):
|
|
|
198
191
|
|
|
199
192
|
# get that last modification date formatted correctly:
|
|
200
193
|
# "2021-03-24 10:08:26 +0000 (Wed, 24 Mar 2021)"
|
|
201
|
-
correctly_formatted_last_modification = (
|
|
202
|
-
f"{now:%Y-%m-%d %H:%M:%S %z (%a, %d %b %Y)}"
|
|
203
|
-
)
|
|
194
|
+
correctly_formatted_last_modification = f"{now:%Y-%m-%d %H:%M:%S %z (%a, %d %b %Y)}"
|
|
204
195
|
|
|
205
196
|
file_content = file_content.replace(
|
|
206
197
|
self.old_last_modification,
|
|
207
198
|
tag_template.format(date=correctly_formatted_last_modification),
|
|
208
199
|
)
|
|
209
200
|
|
|
210
|
-
self.context.nasl_file.write_text(
|
|
211
|
-
file_content, encoding=CURRENT_ENCODING
|
|
212
|
-
)
|
|
201
|
+
self.context.nasl_file.write_text(file_content, encoding=CURRENT_ENCODING)
|
|
213
202
|
|
|
214
203
|
yield LinterFix(
|
|
215
204
|
f"Replaced last_modification {self.old_last_modification_value} "
|
|
@@ -41,9 +41,7 @@ class CheckScriptXrefForm(FileContentPlugin):
|
|
|
41
41
|
if matches:
|
|
42
42
|
for match in matches:
|
|
43
43
|
if match:
|
|
44
|
-
if not get_xref_pattern(name=r".*", value=r".*").match(
|
|
45
|
-
match.group(0)
|
|
46
|
-
):
|
|
44
|
+
if not get_xref_pattern(name=r".*", value=r".*").match(match.group(0)):
|
|
47
45
|
yield LinterError(
|
|
48
46
|
f"{match.group(0)}: does not conform to"
|
|
49
47
|
' script_xref(name:"<name>", value:<value>);',
|
|
@@ -30,10 +30,8 @@ ALLOWED_URLS = [
|
|
|
30
30
|
+ "fbd2dac042934e49288b476d5f6a649e5da2@<announce.tomcat.apache.org>",
|
|
31
31
|
"https://m0ze.ru/vulnerability/[2021-05-26]-[WordPress]-[C"
|
|
32
32
|
+ "WE-79]-WP-Reset-WordPress-Plugin-v1.86.txt",
|
|
33
|
-
"http://yehg.net/lab/pr0js/advisories/joomla/core/[joomla_"
|
|
34
|
-
+ "
|
|
35
|
-
"http://yehg.net/lab/pr0js/advisories/eclipse/[eclipse_hel"
|
|
36
|
-
+ "p_server]_cross_site_scripting",
|
|
33
|
+
"http://yehg.net/lab/pr0js/advisories/joomla/core/[joomla_" + "1.0.x~15]_cross_site_scripting",
|
|
34
|
+
"http://yehg.net/lab/pr0js/advisories/eclipse/[eclipse_hel" + "p_server]_cross_site_scripting",
|
|
37
35
|
"http://core.yehg.net/lab/pr0js/advisories/dll_hijacking/["
|
|
38
36
|
+ "flash_player]_10.1.x_insecure_dll_hijacking_(dwmapi.dll)",
|
|
39
37
|
"https://lists.apache.org/thread.html/773c93c2d8a6a52bbe9"
|
|
@@ -62,9 +60,7 @@ class CheckScriptXrefUrl(FileContentPlugin):
|
|
|
62
60
|
if nasl_file.suffix == ".inc":
|
|
63
61
|
return
|
|
64
62
|
|
|
65
|
-
matches = get_xref_pattern(name="URL", value=r".+?").finditer(
|
|
66
|
-
file_content
|
|
67
|
-
)
|
|
63
|
+
matches = get_xref_pattern(name="URL", value=r".+?").finditer(file_content)
|
|
68
64
|
for match in matches:
|
|
69
65
|
if match:
|
|
70
66
|
url_value = match.group("value")
|
|
@@ -36,8 +36,7 @@ def _file_contains_security_message(file_content: str) -> bool:
|
|
|
36
36
|
file_content (str): The content of the VT
|
|
37
37
|
"""
|
|
38
38
|
return any(
|
|
39
|
-
security_message in file_content
|
|
40
|
-
for security_message in SECURITY_MESSAGE_IMPLEMENTATIONS
|
|
39
|
+
security_message in file_content for security_message in SECURITY_MESSAGE_IMPLEMENTATIONS
|
|
41
40
|
)
|
|
42
41
|
|
|
43
42
|
|
|
@@ -54,16 +53,13 @@ class CheckSecurityMessages(FileContentPlugin):
|
|
|
54
53
|
nasl_file (Path): The VTs path
|
|
55
54
|
file_content (str): The content of the VT
|
|
56
55
|
"""
|
|
57
|
-
deprecated_pattern = get_script_tag_pattern(
|
|
58
|
-
script_tag=ScriptTag.DEPRECATED
|
|
59
|
-
)
|
|
56
|
+
deprecated_pattern = get_script_tag_pattern(script_tag=ScriptTag.DEPRECATED)
|
|
60
57
|
if deprecated_pattern.search(file_content):
|
|
61
58
|
return
|
|
62
59
|
|
|
63
60
|
if not _file_contains_security_message(file_content):
|
|
64
61
|
yield LinterError(
|
|
65
|
-
"VT is missing a security_message or implementing"
|
|
66
|
-
" function in a VT with severity",
|
|
62
|
+
"VT is missing a security_message or implementing function in a VT with severity",
|
|
67
63
|
file=nasl_file,
|
|
68
64
|
plugin=self.name,
|
|
69
65
|
)
|
|
@@ -84,15 +80,12 @@ class CheckSecurityMessages(FileContentPlugin):
|
|
|
84
80
|
|
|
85
81
|
if _file_contains_security_message(file_content):
|
|
86
82
|
yield LinterError(
|
|
87
|
-
"VT is using a security_message or implementing"
|
|
88
|
-
" function in a VT without severity",
|
|
83
|
+
"VT is using a security_message or implementing function in a VT without severity",
|
|
89
84
|
file=nasl_file,
|
|
90
85
|
plugin=self.name,
|
|
91
86
|
)
|
|
92
87
|
|
|
93
|
-
def _determinate_security_message_by_severity(
|
|
94
|
-
self, file_content: str
|
|
95
|
-
) -> bool:
|
|
88
|
+
def _determinate_security_message_by_severity(self, file_content: str) -> bool:
|
|
96
89
|
"""Determinates wether a VT requires a
|
|
97
90
|
security_message or implementing function
|
|
98
91
|
call
|
|
@@ -122,15 +115,9 @@ class CheckSecurityMessages(FileContentPlugin):
|
|
|
122
115
|
if nasl_file.suffix == ".inc":
|
|
123
116
|
return
|
|
124
117
|
|
|
125
|
-
security_message_required = (
|
|
126
|
-
self._determinate_security_message_by_severity(file_content)
|
|
127
|
-
)
|
|
118
|
+
security_message_required = self._determinate_security_message_by_severity(file_content)
|
|
128
119
|
|
|
129
120
|
if security_message_required:
|
|
130
|
-
yield from self._check_security_message_present(
|
|
131
|
-
nasl_file, file_content
|
|
132
|
-
)
|
|
121
|
+
yield from self._check_security_message_present(nasl_file, file_content)
|
|
133
122
|
else:
|
|
134
|
-
yield from self._check_security_message_absent(
|
|
135
|
-
nasl_file, file_content
|
|
136
|
-
)
|
|
123
|
+
yield from self._check_security_message_absent(nasl_file, file_content)
|
|
@@ -20,18 +20,13 @@ class CheckSeverityDate(FileContentPlugin):
|
|
|
20
20
|
nasl_file: Path,
|
|
21
21
|
file_content: str,
|
|
22
22
|
) -> Iterator[LinterResult]:
|
|
23
|
-
|
|
24
23
|
if nasl_file.suffix == ".inc":
|
|
25
24
|
return
|
|
26
25
|
|
|
27
26
|
severity_date_pattern = get_script_tag_pattern(ScriptTag.SEVERITY_DATE)
|
|
28
|
-
last_modification_pattern = get_script_tag_pattern(
|
|
29
|
-
ScriptTag.LAST_MODIFICATION
|
|
30
|
-
)
|
|
27
|
+
last_modification_pattern = get_script_tag_pattern(ScriptTag.LAST_MODIFICATION)
|
|
31
28
|
|
|
32
|
-
if not (
|
|
33
|
-
match_severity_date := severity_date_pattern.search(file_content)
|
|
34
|
-
):
|
|
29
|
+
if not (match_severity_date := severity_date_pattern.search(file_content)):
|
|
35
30
|
return
|
|
36
31
|
|
|
37
32
|
yield from check_date(
|
|
@@ -41,9 +36,7 @@ class CheckSeverityDate(FileContentPlugin):
|
|
|
41
36
|
self.name,
|
|
42
37
|
)
|
|
43
38
|
|
|
44
|
-
if match_last_mod_date := last_modification_pattern.search(
|
|
45
|
-
file_content
|
|
46
|
-
):
|
|
39
|
+
if match_last_mod_date := last_modification_pattern.search(file_content):
|
|
47
40
|
yield from compare_date_with_last_modification_date(
|
|
48
41
|
match_severity_date.group("value"),
|
|
49
42
|
"severity_date",
|
|
@@ -16,13 +16,10 @@ class CheckSeverityFormat(FileContentPlugin):
|
|
|
16
16
|
nasl_file: Path,
|
|
17
17
|
file_content: str,
|
|
18
18
|
) -> Iterator[LinterResult]:
|
|
19
|
-
|
|
20
19
|
if nasl_file.suffix == ".inc" or "severity_vector" not in file_content:
|
|
21
20
|
return
|
|
22
21
|
|
|
23
|
-
severity_vector_pattern = get_script_tag_pattern(
|
|
24
|
-
ScriptTag.SEVERITY_VECTOR
|
|
25
|
-
)
|
|
22
|
+
severity_vector_pattern = get_script_tag_pattern(ScriptTag.SEVERITY_VECTOR)
|
|
26
23
|
|
|
27
24
|
severity_vector_match = severity_vector_pattern.search(file_content)
|
|
28
25
|
if not severity_vector_match:
|
|
@@ -16,13 +16,10 @@ class CheckSeverityOrigin(FileContentPlugin):
|
|
|
16
16
|
nasl_file: Path,
|
|
17
17
|
file_content: str,
|
|
18
18
|
) -> Iterator[LinterResult]:
|
|
19
|
-
|
|
20
19
|
if nasl_file.suffix == ".inc" or "severity_origin" not in file_content:
|
|
21
20
|
return
|
|
22
21
|
|
|
23
|
-
severity_origin_pattern = get_script_tag_pattern(
|
|
24
|
-
ScriptTag.SEVERITY_ORIGIN
|
|
25
|
-
)
|
|
22
|
+
severity_origin_pattern = get_script_tag_pattern(ScriptTag.SEVERITY_ORIGIN)
|
|
26
23
|
|
|
27
24
|
severity_origin_match = severity_origin_pattern.search(file_content)
|
|
28
25
|
if not severity_origin_match:
|
|
@@ -98,11 +98,9 @@ class CheckSolutionText(FilePlugin):
|
|
|
98
98
|
)
|
|
99
99
|
file_content = self.context.file_content
|
|
100
100
|
|
|
101
|
-
if _get_tag_pattern(
|
|
102
|
-
|
|
103
|
-
)
|
|
104
|
-
correct_none_available_pattern, file_content
|
|
105
|
-
):
|
|
101
|
+
if _get_tag_pattern(name=ScriptTag.SOLUTION_TYPE.value, value="NoneAvailable").search(
|
|
102
|
+
file_content
|
|
103
|
+
) and not re.search(correct_none_available_pattern, file_content):
|
|
106
104
|
yield LinterError(
|
|
107
105
|
"The VT with solution type 'NoneAvailable' is using an "
|
|
108
106
|
"incorrect syntax in the solution text. Please use "
|
|
@@ -110,11 +108,9 @@ class CheckSolutionText(FilePlugin):
|
|
|
110
108
|
file=self.context.nasl_file,
|
|
111
109
|
plugin=self.name,
|
|
112
110
|
)
|
|
113
|
-
elif _get_tag_pattern(
|
|
114
|
-
|
|
115
|
-
)
|
|
116
|
-
correct_will_not_fix_pattern, file_content
|
|
117
|
-
):
|
|
111
|
+
elif _get_tag_pattern(name=ScriptTag.SOLUTION_TYPE.value, value="WillNotFix").search(
|
|
112
|
+
file_content
|
|
113
|
+
) and not re.search(correct_will_not_fix_pattern, file_content):
|
|
118
114
|
yield LinterError(
|
|
119
115
|
"The VT with solution type 'WillNotFix' is using an incorrect "
|
|
120
116
|
"syntax in the solution text. Please use one of these "
|
|
@@ -53,8 +53,7 @@ class CheckSolutionType(FileContentPlugin):
|
|
|
53
53
|
|
|
54
54
|
has_severity = True
|
|
55
55
|
cvss_detect = re.search(
|
|
56
|
-
r"script_tag\s*\(name\s*:\s*\"cvss_base\","
|
|
57
|
-
r"\s*value:\s*\"(\d{1,2}\.\d)\"\)",
|
|
56
|
+
r"script_tag\s*\(name\s*:\s*\"cvss_base\"," r"\s*value:\s*\"(\d{1,2}\.\d)\"\)",
|
|
58
57
|
file_content,
|
|
59
58
|
)
|
|
60
59
|
if cvss_detect is not None and cvss_detect.group(1) == "0.0":
|
|
@@ -71,9 +71,7 @@ IGNORE = [
|
|
|
71
71
|
class CheckSpacesBeforeDots(FileContentPlugin):
|
|
72
72
|
name = "check_spaces_before_dots"
|
|
73
73
|
|
|
74
|
-
def check_content(
|
|
75
|
-
self, nasl_file: Path, file_content: str
|
|
76
|
-
) -> Iterator[LinterResult]:
|
|
74
|
+
def check_content(self, nasl_file: Path, file_content: str) -> Iterator[LinterResult]:
|
|
77
75
|
"""
|
|
78
76
|
This plugin checks for excess whitespace before a dot
|
|
79
77
|
in script_tags that have full sentence values
|
|
@@ -103,7 +101,6 @@ class CheckSpacesBeforeDots(FileContentPlugin):
|
|
|
103
101
|
)
|
|
104
102
|
|
|
105
103
|
def fix(self) -> Iterator[LinterResult]:
|
|
106
|
-
|
|
107
104
|
if not self.matches:
|
|
108
105
|
return
|
|
109
106
|
|
|
@@ -114,11 +111,7 @@ class CheckSpacesBeforeDots(FileContentPlugin):
|
|
|
114
111
|
for pos, match_str in self.matches:
|
|
115
112
|
# Replace the match by removing the excess whitespace before the dot
|
|
116
113
|
fixed_str = re.sub(r"\s+\.", ".", match_str)
|
|
117
|
-
file_content = (
|
|
118
|
-
file_content[:pos]
|
|
119
|
-
+ fixed_str
|
|
120
|
-
+ file_content[pos + len(match_str) :]
|
|
121
|
-
)
|
|
114
|
+
file_content = file_content[:pos] + fixed_str + file_content[pos + len(match_str) :]
|
|
122
115
|
|
|
123
116
|
with open(self.context.nasl_file, "w", encoding=CURRENT_ENCODING) as f:
|
|
124
117
|
f.write(file_content)
|
|
@@ -13,8 +13,7 @@ class CheckSpacesInFilename(FilePlugin):
|
|
|
13
13
|
def run(self) -> Iterator[LinterResult]:
|
|
14
14
|
if re.search(r"\s", self.context.nasl_file.name):
|
|
15
15
|
yield LinterError(
|
|
16
|
-
f"The VT {self.context.nasl_file}"
|
|
17
|
-
" contains whitespace in the filename",
|
|
16
|
+
f"The VT {self.context.nasl_file} contains whitespace in the filename",
|
|
18
17
|
file=self.context.nasl_file,
|
|
19
18
|
plugin=self.name,
|
|
20
19
|
)
|
troubadix/plugins/spelling.py
CHANGED
|
@@ -48,9 +48,7 @@ exceptions = [
|
|
|
48
48
|
# Same for a few other files:
|
|
49
49
|
PatternInFileCheck("smtp_AV_42zip_DoS.nasl", r"BA\s+==>\s+BY, BE"),
|
|
50
50
|
PatternInFileCheck("bad_ssh_host_keys.inc", r"ba\s+==>\s+by, be"),
|
|
51
|
-
PatternsInFileCheck(
|
|
52
|
-
"wmi_misc.inc", [r"BA\s+==>\s+BY, BE", r"OD\s+==>\s+OF"]
|
|
53
|
-
),
|
|
51
|
+
PatternsInFileCheck("wmi_misc.inc", [r"BA\s+==>\s+BY, BE", r"OD\s+==>\s+OF"]),
|
|
54
52
|
PatternInFilesCheck(
|
|
55
53
|
["ssl_funcs.inc", "gb_ssl_tls_cert_details.nasl"],
|
|
56
54
|
r"fpr\s+==>\s+for, far, fps",
|
|
@@ -104,9 +102,7 @@ exceptions = [
|
|
|
104
102
|
r"n[iI]n\s+==>\s+inn",
|
|
105
103
|
),
|
|
106
104
|
# False positive in this VT in German example responses.
|
|
107
|
-
PatternInFileCheck(
|
|
108
|
-
"gb_exchange_server_CVE-2021-26855_active.nasl", r"ist\s+==>\s+is"
|
|
109
|
-
),
|
|
105
|
+
PatternInFileCheck("gb_exchange_server_CVE-2021-26855_active.nasl", r"ist\s+==>\s+is"),
|
|
110
106
|
# Mostly a false positive in LSCs because of things like
|
|
111
107
|
# "ALSA: hda" or a codec called "Conexant". There are too
|
|
112
108
|
# many hits to maintain them in codespell.exclude so exclude
|
|
@@ -152,9 +148,7 @@ exceptions = [
|
|
|
152
148
|
r"nam\s+==>\s+name",
|
|
153
149
|
text_pattern_flags=re.IGNORECASE,
|
|
154
150
|
),
|
|
155
|
-
PatternInFileCheck(
|
|
156
|
-
"/netop_infopublic.nasl", r"nam\s+==>\s+name", flags=re.IGNORECASE
|
|
157
|
-
),
|
|
151
|
+
PatternInFileCheck("/netop_infopublic.nasl", r"nam\s+==>\s+name", flags=re.IGNORECASE),
|
|
158
152
|
# Product names used in a few VTs (no re.IGNORECASE is expected)
|
|
159
153
|
PatternsCheck([r"renderD\s+==>\s+rendered", r"VertX\s+==>\s+vertex"]),
|
|
160
154
|
PatternInFileCheck("_vertx_", r"vertx\s+==>\s+vertex"),
|
|
@@ -206,8 +200,7 @@ class CheckSpelling(FilesPlugin):
|
|
|
206
200
|
batch_size = 10_000
|
|
207
201
|
for i in range(0, len(self.context.nasl_files), batch_size):
|
|
208
202
|
files_parameters = [
|
|
209
|
-
str(nasl_file)
|
|
210
|
-
for nasl_file in self.context.nasl_files[i : i + batch_size]
|
|
203
|
+
str(nasl_file) for nasl_file in self.context.nasl_files[i : i + batch_size]
|
|
211
204
|
]
|
|
212
205
|
codespell_arguments = [
|
|
213
206
|
"--hard-encoding-detection",
|
|
@@ -235,9 +228,7 @@ class CheckSpelling(FilesPlugin):
|
|
|
235
228
|
codespell_entries = [
|
|
236
229
|
line
|
|
237
230
|
for line in codespell_output.splitlines()
|
|
238
|
-
if not handle_linguistic_checks(
|
|
239
|
-
*self._parse_codespell_line(line), exceptions
|
|
240
|
-
)
|
|
231
|
+
if not handle_linguistic_checks(*self._parse_codespell_line(line), exceptions)
|
|
241
232
|
]
|
|
242
233
|
|
|
243
234
|
for codespell_entry in codespell_entries:
|
|
@@ -39,15 +39,12 @@ class CheckTrailingSpacesTabs(FilePlugin):
|
|
|
39
39
|
to find special tags
|
|
40
40
|
|
|
41
41
|
"""
|
|
42
|
-
for line_number, line in enumerate(
|
|
43
|
-
self.context.file_content.splitlines(), start=1
|
|
44
|
-
):
|
|
42
|
+
for line_number, line in enumerate(self.context.file_content.splitlines(), start=1):
|
|
45
43
|
if not PATTERN.search(line):
|
|
46
44
|
continue
|
|
47
45
|
|
|
48
46
|
yield LinterError(
|
|
49
|
-
"The VT has one or more trailing spaces "
|
|
50
|
-
f"and/or tabs in line {line_number}!",
|
|
47
|
+
f"The VT has one or more trailing spaces and/or tabs in line {line_number}!",
|
|
51
48
|
file=self.context.nasl_file,
|
|
52
49
|
plugin=self.name,
|
|
53
50
|
)
|
|
@@ -63,9 +63,7 @@ class CheckUsingDisplay(FileContentPlugin):
|
|
|
63
63
|
|
|
64
64
|
# Case 1: Not in any if statement - ERROR
|
|
65
65
|
if not containing_if:
|
|
66
|
-
line_start = (
|
|
67
|
-
comment_free_content.rfind("\n", 0, display_pos) + 1
|
|
68
|
-
)
|
|
66
|
+
line_start = comment_free_content.rfind("\n", 0, display_pos) + 1
|
|
69
67
|
line_end = comment_free_content.find("\n", display_pos)
|
|
70
68
|
if line_end == -1:
|
|
71
69
|
line_end = len(comment_free_content)
|
|
@@ -95,9 +93,7 @@ class CheckUsingDisplay(FileContentPlugin):
|
|
|
95
93
|
yield LinterWarning(
|
|
96
94
|
"VT is using a display() inside an if statement"
|
|
97
95
|
f" but without debug check at line {line}\n"
|
|
98
|
-
+ comment_free_content[
|
|
99
|
-
containing_if.if_start : containing_if.if_end
|
|
100
|
-
],
|
|
96
|
+
+ comment_free_content[containing_if.if_start : containing_if.if_end],
|
|
101
97
|
file=nasl_file,
|
|
102
98
|
plugin=self.name,
|
|
103
99
|
)
|