troubadix 25.9.2__py3-none-any.whl → 25.10.7__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/plugins/badwords.py +3 -0
- troubadix/plugins/grammar.py +11 -2
- troubadix/plugins/script_add_preference_type.py +43 -22
- {troubadix-25.9.2.dist-info → troubadix-25.10.7.dist-info}/METADATA +4 -2
- {troubadix-25.9.2.dist-info → troubadix-25.10.7.dist-info}/RECORD +9 -9
- {troubadix-25.9.2.dist-info → troubadix-25.10.7.dist-info}/WHEEL +1 -1
- {troubadix-25.9.2.dist-info → troubadix-25.10.7.dist-info}/entry_points.txt +0 -0
- {troubadix-25.9.2.dist-info → troubadix-25.10.7.dist-info/licenses}/LICENSE +0 -0
troubadix/__version__.py
CHANGED
troubadix/plugins/badwords.py
CHANGED
|
@@ -43,6 +43,7 @@ _IGNORE_FILES = [
|
|
|
43
43
|
"http_func.inc",
|
|
44
44
|
"misc_func.inc",
|
|
45
45
|
"OpenVAS_detect.nasl",
|
|
46
|
+
"gb_greenbone_os_consolidation.nasl",
|
|
46
47
|
]
|
|
47
48
|
|
|
48
49
|
EXCEPTIONS = [
|
|
@@ -79,6 +80,8 @@ EXCEPTIONS = [
|
|
|
79
80
|
"OpenVAS / Greenbone Vulnerability Manager",
|
|
80
81
|
"openvas_1808149858",
|
|
81
82
|
"OSPD-OpenVAS",
|
|
83
|
+
"OPENVAS SCAN",
|
|
84
|
+
"openvas_scan",
|
|
82
85
|
"evil.zip -> openvas.jsp",
|
|
83
86
|
'url = "/openvas.jsp";',
|
|
84
87
|
'if( "OpenVAS RCE Test" >< buf )',
|
troubadix/plugins/grammar.py
CHANGED
|
@@ -210,14 +210,23 @@ class CheckGrammar(FilePlugin):
|
|
|
210
210
|
|
|
211
211
|
for match in pattern.finditer(self.context.file_content):
|
|
212
212
|
if match:
|
|
213
|
+
|
|
214
|
+
# nb: No strip() here for so that the exclusions can be handled
|
|
215
|
+
# more strict with e.g. leading or trailing newlines.
|
|
216
|
+
full_line = match.group(0)
|
|
217
|
+
|
|
213
218
|
if handle_linguistic_checks(
|
|
214
|
-
str(self.context.nasl_file),
|
|
219
|
+
str(self.context.nasl_file), full_line, exceptions
|
|
215
220
|
):
|
|
216
221
|
continue
|
|
217
222
|
|
|
223
|
+
stripped_line = full_line.strip()
|
|
224
|
+
stripped_hit = match.group(1).strip()
|
|
225
|
+
|
|
218
226
|
yield LinterError(
|
|
219
227
|
"VT/Include has the following grammar problem:"
|
|
220
|
-
f" {
|
|
228
|
+
f"\n- Hit: {stripped_hit}"
|
|
229
|
+
f"\n- Full line: {stripped_line}",
|
|
221
230
|
file=self.context.nasl_file,
|
|
222
231
|
plugin=self.name,
|
|
223
232
|
)
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
# pylint: disable=fixme
|
|
19
19
|
|
|
20
|
+
import re
|
|
20
21
|
from enum import Enum
|
|
21
22
|
from pathlib import Path
|
|
22
23
|
from typing import Iterator
|
|
@@ -27,6 +28,10 @@ from troubadix.helper.patterns import (
|
|
|
27
28
|
)
|
|
28
29
|
from troubadix.plugin import FileContentPlugin, LinterError, LinterResult
|
|
29
30
|
|
|
31
|
+
TYPE_PATTERN = re.compile(
|
|
32
|
+
r'type\s*:\s*(?P<quote>[\'"])(?P<type>[^\'"]+)(?P=quote)'
|
|
33
|
+
)
|
|
34
|
+
|
|
30
35
|
|
|
31
36
|
class ValidType(Enum):
|
|
32
37
|
CHECKBOX = "checkbox"
|
|
@@ -36,6 +41,9 @@ class ValidType(Enum):
|
|
|
36
41
|
ENTRY = "entry"
|
|
37
42
|
|
|
38
43
|
|
|
44
|
+
VALID_TYPES = {t.value for t in ValidType}
|
|
45
|
+
|
|
46
|
+
|
|
39
47
|
class CheckScriptAddPreferenceType(FileContentPlugin):
|
|
40
48
|
name = "check_script_add_preference_type"
|
|
41
49
|
|
|
@@ -65,30 +73,43 @@ class CheckScriptAddPreferenceType(FileContentPlugin):
|
|
|
65
73
|
if "script_add_preference" not in file_content:
|
|
66
74
|
return
|
|
67
75
|
|
|
76
|
+
# Primary regex to capture all script_add_preference calls
|
|
68
77
|
preferences_matches = _get_special_script_tag_pattern(
|
|
69
78
|
name=SpecialScriptTag.ADD_PREFERENCE.value,
|
|
70
|
-
value=r'type\s*:\s*(?P<quote>[\'"])(?P<type>[^\'"]+)'
|
|
71
|
-
r"(?P=quote)\s*[^)]*",
|
|
72
79
|
).finditer(file_content)
|
|
73
80
|
|
|
81
|
+
# Secondary regex to extract type from the captured value (parameter list)
|
|
74
82
|
for preferences_match in preferences_matches:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
params_content = preferences_match.group("value")
|
|
84
|
+
type_match = TYPE_PATTERN.search(params_content)
|
|
85
|
+
|
|
86
|
+
if not type_match:
|
|
87
|
+
yield LinterError(
|
|
88
|
+
"script_add_preference call is missing a 'type' "
|
|
89
|
+
f"parameter in '{preferences_match.group(0)}'",
|
|
90
|
+
file=nasl_file,
|
|
91
|
+
plugin=self.name,
|
|
92
|
+
)
|
|
93
|
+
continue
|
|
94
|
+
|
|
95
|
+
pref_type = type_match.group("type")
|
|
96
|
+
if pref_type in VALID_TYPES:
|
|
97
|
+
continue
|
|
98
|
+
|
|
99
|
+
# nb: This exists since years and it is currently
|
|
100
|
+
# unclear if we can change it so
|
|
101
|
+
# we're excluding it here for now.
|
|
102
|
+
if (
|
|
103
|
+
"ssh_authorization_init.nasl" in nasl_file.name
|
|
104
|
+
and pref_type == "sshlogin"
|
|
105
|
+
):
|
|
106
|
+
continue
|
|
107
|
+
|
|
108
|
+
yield LinterError(
|
|
109
|
+
"VT is using an invalid or misspelled type "
|
|
110
|
+
f"({pref_type}) in "
|
|
111
|
+
f"{preferences_match.group(0)} \n"
|
|
112
|
+
f"Allowed are: {sorted(VALID_TYPES)}",
|
|
113
|
+
file=nasl_file,
|
|
114
|
+
plugin=self.name,
|
|
115
|
+
)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: troubadix
|
|
3
|
-
Version: 25.
|
|
3
|
+
Version: 25.10.7
|
|
4
4
|
Summary: A linting and QA check tool for NASL files
|
|
5
5
|
License: GPL-3.0-or-later
|
|
6
|
+
License-File: LICENSE
|
|
6
7
|
Author: Greenbone
|
|
7
8
|
Author-email: info@greenbone.net
|
|
8
9
|
Requires-Python: >=3.10,<4.0
|
|
@@ -16,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
16
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
22
|
Requires-Dist: chardet (>=4,<6)
|
|
21
23
|
Requires-Dist: charset-normalizer (>=3.2.0,<4.0.0)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
troubadix/__init__.py,sha256=K7sIXXDrC7YRb7BvIpdQ6ZfG_QkT0qUH_wAlHROVRfM,716
|
|
2
|
-
troubadix/__version__.py,sha256=
|
|
2
|
+
troubadix/__version__.py,sha256=URKTfluCYWyv6hpNgwKzTwfbDB-zbsbURt4HvY-BXM4,104
|
|
3
3
|
troubadix/argparser.py,sha256=-H07Jhqh68_M4Mbjq9qJjTr3MShy_N2pxl2qHA6cfRU,7481
|
|
4
4
|
troubadix/codespell/codespell.additions,sha256=SJPlIo8vEKEOTftY6ZBSXzcfyv6y9aFAXl9FdpcMxD0,561
|
|
5
5
|
troubadix/codespell/codespell.exclude,sha256=W1dHEbKuXZbiLMRLhUPIzhCV1ptHqPLuaB6VsJLxn64,147965
|
|
@@ -14,7 +14,7 @@ troubadix/helper/remove_comments.py,sha256=zjhXPQXgKaEOparAdu4aBXcJlEul8LbNaP3uL
|
|
|
14
14
|
troubadix/helper/text_utils.py,sha256=gBX0box9VtgA0CMfE0u2Vvi1IuOopxUfCQFYn_1wVjE,2543
|
|
15
15
|
troubadix/plugin.py,sha256=3fQPj3Qe_hgwHerlYE4hbdzYMzRU557NxJ-UwtE9mOI,3525
|
|
16
16
|
troubadix/plugins/__init__.py,sha256=7NqTzddmptQZJ_s1yxpamVo0Y8zohAWlEQU2lf103_Y,8745
|
|
17
|
-
troubadix/plugins/badwords.py,sha256=
|
|
17
|
+
troubadix/plugins/badwords.py,sha256=ppTJT7yl6kPo51PT-mHxpbmuKMJpBgEKzLDU0sLktig,5014
|
|
18
18
|
troubadix/plugins/copyright_text.py,sha256=jYsLWmTbT_A78XQQxQFK-5kMMHkh3xdvlh7mEF2dZGU,3583
|
|
19
19
|
troubadix/plugins/copyright_year.py,sha256=XzM9MHVzOXwNLwHpfuaWj8PUOmswr56SBVOLBdvxjd4,5478
|
|
20
20
|
troubadix/plugins/creation_date.py,sha256=PRM5z_7cgQhRQ7Kx7ufF8E8LzVNGP5hLSeH25UWJEn8,2403
|
|
@@ -30,7 +30,7 @@ troubadix/plugins/duplicated_script_tags.py,sha256=UPBR2jbU15JLKJlVk1e2GFREH5Wj5
|
|
|
30
30
|
troubadix/plugins/encoding.py,sha256=zNzqNpP39TUwOklnc8OJ3OIUelAN_hvnuBYoa3Pz764,2104
|
|
31
31
|
troubadix/plugins/forking_nasl_functions.py,sha256=IUtCrTK_sGDx79jAPS8lF_aN8zSG2AkzfC6duTMvJOw,6069
|
|
32
32
|
troubadix/plugins/get_kb_on_services.py,sha256=oFmcjiF7ZD3x5tEbJEoZNn80y1qUzNgeSZNsogSqaZ0,3401
|
|
33
|
-
troubadix/plugins/grammar.py,sha256=
|
|
33
|
+
troubadix/plugins/grammar.py,sha256=hd5Qqamem9Iy64UMmdv5lEIfinS1vGDw_1CYNPmOsvg,10231
|
|
34
34
|
troubadix/plugins/http_links_in_tags.py,sha256=F4fm74M3CbmWOJoCyDdEO-bKQahFsHL6vs4ZynhHEkc,7325
|
|
35
35
|
troubadix/plugins/if_statement_syntax.py,sha256=5BRJwCCghvZn1AfvYzmk8l9S7aRqbVaLHhSKod_Q9zw,1429
|
|
36
36
|
troubadix/plugins/illegal_characters.py,sha256=B6q_RU85AxCjLry56Oc-RhMSpnJU8mTrxclRzi1FVFU,4406
|
|
@@ -46,7 +46,7 @@ troubadix/plugins/overlong_script_tags.py,sha256=LKJQxX9s2fkExkM0MOIqYZGOKbEe9et
|
|
|
46
46
|
troubadix/plugins/prod_svc_detect_in_vulnvt.py,sha256=AnHF5jPNz4wEr-etZ2fkJNqqMH2he-9ofOdzWJyPeK4,4292
|
|
47
47
|
troubadix/plugins/qod.py,sha256=OMEjZR3fbimLX4F3LsMZZn4IZi32j4soMYp1uQFv5Sc,4164
|
|
48
48
|
troubadix/plugins/reporting_consistency.py,sha256=yp4FQ8T6gVPzLDF5334mGG5m8n9x8c2I_ApfHzZpVRA,4024
|
|
49
|
-
troubadix/plugins/script_add_preference_type.py,sha256=
|
|
49
|
+
troubadix/plugins/script_add_preference_type.py,sha256=PHySUVWqI8dG51xI0CIzaB2a83GicCryPtbcugE8jgE,3643
|
|
50
50
|
troubadix/plugins/script_calls_empty_values.py,sha256=XdtqTGWI3k_3eId-XAgxwXLxucENqC5CIQJG8Ncn1_M,2512
|
|
51
51
|
troubadix/plugins/script_calls_recommended.py,sha256=GHnfCKBlmutfCXrkvvujvDR7TJDxr2Dx2KZDMa1z_TU,3180
|
|
52
52
|
troubadix/plugins/script_category.py,sha256=EsFoR6fKjnJNNJb2gLkftwXDhJ3RCfa5g8796N-jxX8,2184
|
|
@@ -108,8 +108,8 @@ troubadix/standalone_plugins/no_solution.py,sha256=p_-az9Igl4GH6HnhLLYbYlWIiEP64
|
|
|
108
108
|
troubadix/standalone_plugins/util.py,sha256=JTXGmi-_BJouTNe6QzEosLlXUt9jKW-3fz4db05RJJw,696
|
|
109
109
|
troubadix/standalone_plugins/version_updated.py,sha256=6YHF0OjL5NWszQdsSh7XzlSji1e6Uaqwu_Y6m3R0mvI,4203
|
|
110
110
|
troubadix/troubadix.py,sha256=5__Jz3bYSrya4aG6RCBWxqnsDepXfwXZ3v0bjCzEFi0,6039
|
|
111
|
-
troubadix-25.
|
|
112
|
-
troubadix-25.
|
|
113
|
-
troubadix-25.
|
|
114
|
-
troubadix-25.
|
|
115
|
-
troubadix-25.
|
|
111
|
+
troubadix-25.10.7.dist-info/METADATA,sha256=BXZnOZiPoSlgxZB2ig4wxRvucT7ehJ-0tSynVzr2np4,4536
|
|
112
|
+
troubadix-25.10.7.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
113
|
+
troubadix-25.10.7.dist-info/entry_points.txt,sha256=ETEPBi4fKv3o7hzkzceX4838G6g5_5wRdEddYot8N6A,920
|
|
114
|
+
troubadix-25.10.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
115
|
+
troubadix-25.10.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|