troubadix 25.2.4__py3-none-any.whl → 25.3.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/plugins/creation_date.py +49 -35
- {troubadix-25.2.4.dist-info → troubadix-25.3.0.dist-info}/METADATA +1 -1
- {troubadix-25.2.4.dist-info → troubadix-25.3.0.dist-info}/RECORD +7 -7
- {troubadix-25.2.4.dist-info → troubadix-25.3.0.dist-info}/LICENSE +0 -0
- {troubadix-25.2.4.dist-info → troubadix-25.3.0.dist-info}/WHEEL +0 -0
- {troubadix-25.2.4.dist-info → troubadix-25.3.0.dist-info}/entry_points.txt +0 -0
troubadix/__version__.py
CHANGED
|
@@ -52,45 +52,59 @@ class CheckCreationDate(FileContentPlugin):
|
|
|
52
52
|
# Example: "2017-11-29 13:56:41 +0100 (Wed, 29 Nov 2017)"
|
|
53
53
|
match = tag_pattern.search(file_content)
|
|
54
54
|
|
|
55
|
-
if match:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
match.group("value")[27:43], "%a, %d %b %Y"
|
|
63
|
-
)
|
|
64
|
-
week_day_parsed = date_right.strftime("%a")
|
|
65
|
-
except ValueError:
|
|
66
|
-
yield LinterError(
|
|
67
|
-
"False or incorrectly formatted creation_date.",
|
|
68
|
-
file=nasl_file,
|
|
69
|
-
plugin=self.name,
|
|
70
|
-
)
|
|
71
|
-
return
|
|
55
|
+
if not match:
|
|
56
|
+
yield LinterError(
|
|
57
|
+
"False or incorrectly formatted creation_date.",
|
|
58
|
+
file=nasl_file,
|
|
59
|
+
plugin=self.name,
|
|
60
|
+
)
|
|
61
|
+
return
|
|
72
62
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
formatted_date = week_day_parsed
|
|
84
|
-
yield LinterError(
|
|
85
|
-
f"Wrong day of week. Please change it from '{week_day_str}"
|
|
86
|
-
f"' to '{formatted_date}'.",
|
|
87
|
-
file=nasl_file,
|
|
88
|
-
plugin=self.name,
|
|
89
|
-
)
|
|
90
|
-
else:
|
|
63
|
+
try:
|
|
64
|
+
date_left = datetime.strptime(
|
|
65
|
+
match.group("value")[:25], "%Y-%m-%d %H:%M:%S %z"
|
|
66
|
+
)
|
|
67
|
+
# 2017-11-29 13:56:41 +0100 (error if no timezone)
|
|
68
|
+
date_right = datetime.strptime(
|
|
69
|
+
match.group("value")[27:43], "%a, %d %b %Y"
|
|
70
|
+
)
|
|
71
|
+
week_day_parsed = date_right.strftime("%a")
|
|
72
|
+
except ValueError:
|
|
91
73
|
yield LinterError(
|
|
92
74
|
"False or incorrectly formatted creation_date.",
|
|
93
75
|
file=nasl_file,
|
|
94
76
|
plugin=self.name,
|
|
95
77
|
)
|
|
96
78
|
return
|
|
79
|
+
|
|
80
|
+
week_day_str = match.group("value")[27:30]
|
|
81
|
+
# Wed, 29 Nov 2017
|
|
82
|
+
if date_left.date() != date_right.date():
|
|
83
|
+
yield LinterError(
|
|
84
|
+
"The creation_date consists of two different dates.",
|
|
85
|
+
file=nasl_file,
|
|
86
|
+
plugin=self.name,
|
|
87
|
+
)
|
|
88
|
+
# Check correct weekday
|
|
89
|
+
elif week_day_str != week_day_parsed:
|
|
90
|
+
formatted_date = week_day_parsed
|
|
91
|
+
yield LinterError(
|
|
92
|
+
f"Wrong day of week. Please change it from '{week_day_str}"
|
|
93
|
+
f"' to '{formatted_date}'.",
|
|
94
|
+
file=nasl_file,
|
|
95
|
+
plugin=self.name,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
last_modification_pattern = get_script_tag_pattern(
|
|
99
|
+
ScriptTag.LAST_MODIFICATION
|
|
100
|
+
)
|
|
101
|
+
if match := last_modification_pattern.search(file_content):
|
|
102
|
+
last_modification = datetime.strptime(
|
|
103
|
+
match.group("value")[:25], "%Y-%m-%d %H:%M:%S %z"
|
|
104
|
+
)
|
|
105
|
+
if date_left > last_modification:
|
|
106
|
+
yield LinterError(
|
|
107
|
+
"The creation_date must not be greater than the last modification date.",
|
|
108
|
+
file=nasl_file,
|
|
109
|
+
plugin=self.name,
|
|
110
|
+
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
troubadix/__init__.py,sha256=K7sIXXDrC7YRb7BvIpdQ6ZfG_QkT0qUH_wAlHROVRfM,716
|
|
2
|
-
troubadix/__version__.py,sha256=
|
|
2
|
+
troubadix/__version__.py,sha256=T57z7f4UeEhry1NQ5y60deY0bPMjh-zM6UsjFP1BeN4,103
|
|
3
3
|
troubadix/argparser.py,sha256=OFLyj2gUOdVUrN_DSyzSlhhkV0ti77naUvDcGVNUjtU,6929
|
|
4
4
|
troubadix/codespell/codespell.additions,sha256=NAYnQF79kdk4YhU_h8fpjAVVkqBm778aPHPPP7FEkZY,504
|
|
5
5
|
troubadix/codespell/codespell.exclude,sha256=x7I4HG9cvG5QZuMJXtAiVavjQBpr-wtxPrrYoUDknnY,145525
|
|
@@ -13,7 +13,7 @@ troubadix/plugins/__init__.py,sha256=V5fHMg2qVWIYKVZJqHKpzgrQ5x87Pz5u-h-CxOx7Dls
|
|
|
13
13
|
troubadix/plugins/badwords.py,sha256=k1A1d2pdXzie87FGGXrykP2BgdZbY5QtmQItupHtNyw,4701
|
|
14
14
|
troubadix/plugins/copyright_text.py,sha256=jYsLWmTbT_A78XQQxQFK-5kMMHkh3xdvlh7mEF2dZGU,3583
|
|
15
15
|
troubadix/plugins/copyright_year.py,sha256=XzM9MHVzOXwNLwHpfuaWj8PUOmswr56SBVOLBdvxjd4,5478
|
|
16
|
-
troubadix/plugins/creation_date.py,sha256=
|
|
16
|
+
troubadix/plugins/creation_date.py,sha256=TyYnbCdmuBuPYNE79Y5hnoQUr5BIOnvJwpHovu8xE98,3793
|
|
17
17
|
troubadix/plugins/cve_format.py,sha256=Ue6b9RzuQZWOdBd6y5ruqdEq2zyRb2_FSUQScnjHOUQ,3400
|
|
18
18
|
troubadix/plugins/cvss_format.py,sha256=GrZfZxkxSh9OVixmBBnHQ4NzF9nN2tCK1vepz_-U60g,2309
|
|
19
19
|
troubadix/plugins/dependencies.py,sha256=eW6uOThTF8WfBbkZYAZ3BW34_WJ87IAETJLe1dcEO2Q,4118
|
|
@@ -93,8 +93,8 @@ troubadix/standalone_plugins/last_modification.py,sha256=iwT11m5O1UXXZl6XaxQ0umd
|
|
|
93
93
|
troubadix/standalone_plugins/no_solution.py,sha256=81r20kP8otRob2NTaCea-sgVRIM6ARvhddFdibsG6Ao,8877
|
|
94
94
|
troubadix/standalone_plugins/version_updated.py,sha256=RlzVuXgFOvcjrRTOhiTYlmzV4vvcn7ntCz0lDTjePMU,4316
|
|
95
95
|
troubadix/troubadix.py,sha256=5__Jz3bYSrya4aG6RCBWxqnsDepXfwXZ3v0bjCzEFi0,6039
|
|
96
|
-
troubadix-25.
|
|
97
|
-
troubadix-25.
|
|
98
|
-
troubadix-25.
|
|
99
|
-
troubadix-25.
|
|
100
|
-
troubadix-25.
|
|
96
|
+
troubadix-25.3.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
97
|
+
troubadix-25.3.0.dist-info/METADATA,sha256=6O9FulgAgFVOrc3pgYp1GTqY-NO4Nt5BMCdmHVncaOk,4421
|
|
98
|
+
troubadix-25.3.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
99
|
+
troubadix-25.3.0.dist-info/entry_points.txt,sha256=LplOk4nzKrS4B8Jz0SPkQLPlIDesdraCO8Vp_eoycpc,737
|
|
100
|
+
troubadix-25.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|