check-msdefender 1.1.10__py3-none-any.whl → 1.1.13__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.
- check_msdefender/__init__.py +1 -1
- check_msdefender/services/products_service.py +62 -12
- {check_msdefender-1.1.10.dist-info → check_msdefender-1.1.13.dist-info}/METADATA +1 -1
- {check_msdefender-1.1.10.dist-info → check_msdefender-1.1.13.dist-info}/RECORD +7 -7
- {check_msdefender-1.1.10.dist-info → check_msdefender-1.1.13.dist-info}/WHEEL +0 -0
- {check_msdefender-1.1.10.dist-info → check_msdefender-1.1.13.dist-info}/entry_points.txt +0 -0
- {check_msdefender-1.1.10.dist-info → check_msdefender-1.1.13.dist-info}/licenses/LICENSE +0 -0
check_msdefender/__init__.py
CHANGED
|
@@ -6,6 +6,12 @@ from datetime import datetime
|
|
|
6
6
|
from check_msdefender.core.exceptions import ValidationError
|
|
7
7
|
from check_msdefender.core.logging_config import get_verbose_logger
|
|
8
8
|
|
|
9
|
+
class DetailObject:
|
|
10
|
+
def __init__(self, software: str, data: str, score: int):
|
|
11
|
+
self.software = software
|
|
12
|
+
self.data = data
|
|
13
|
+
self.score = score
|
|
14
|
+
self.paths: list[str] = []
|
|
9
15
|
|
|
10
16
|
class ProductsService:
|
|
11
17
|
"""Service for checking installed products on machines."""
|
|
@@ -60,6 +66,7 @@ class ProductsService:
|
|
|
60
66
|
cve_id = vulnerability.get("cveId", "Unknown")
|
|
61
67
|
cvss_score = vulnerability.get("cvssScore", 0)
|
|
62
68
|
disk_paths = vulnerability.get("diskPaths", [])
|
|
69
|
+
registry_paths = vulnerability.get("registryPaths", [])
|
|
63
70
|
severity = vulnerability.get("vulnerabilitySeverityLevel", "Unknown")
|
|
64
71
|
|
|
65
72
|
software_key = f"{software_name}-{software_version}-{software_vendor}"
|
|
@@ -71,12 +78,15 @@ class ProductsService:
|
|
|
71
78
|
"vendor": software_vendor,
|
|
72
79
|
"cves": [],
|
|
73
80
|
"paths": set(),
|
|
81
|
+
"registryPaths": set(),
|
|
74
82
|
"max_cvss": 0,
|
|
75
83
|
"severities": set(),
|
|
76
84
|
}
|
|
77
85
|
|
|
78
|
-
|
|
86
|
+
cve_info = {"cve_id": cve_id, "severity": severity}
|
|
87
|
+
software_vulnerabilities[software_key]["cves"].append(cve_info)
|
|
79
88
|
software_vulnerabilities[software_key]["paths"].update(disk_paths)
|
|
89
|
+
software_vulnerabilities[software_key]["registryPaths"].update(registry_paths)
|
|
80
90
|
software_vulnerabilities[software_key]["max_cvss"] = max(
|
|
81
91
|
software_vulnerabilities[software_key]["max_cvss"], cvss_score
|
|
82
92
|
)
|
|
@@ -107,36 +117,76 @@ class ProductsService:
|
|
|
107
117
|
|
|
108
118
|
# Create details for output
|
|
109
119
|
details = []
|
|
120
|
+
total_score = 0
|
|
110
121
|
if software_vulnerabilities:
|
|
111
122
|
summary_line = f"{len(products)} total CVEs (Critical: {critical_count}, High: {high_count}, Medium: {medium_count}, Low: {low_count}), {len(vulnerable_software)} vulnerable software"
|
|
112
123
|
details.append(summary_line)
|
|
113
124
|
|
|
114
|
-
|
|
115
|
-
|
|
125
|
+
detail_objects = []
|
|
126
|
+
|
|
127
|
+
# Add software details
|
|
128
|
+
for software in list(software_vulnerabilities.values()):
|
|
129
|
+
score = 0
|
|
130
|
+
|
|
116
131
|
cve_count = len(software["cves"])
|
|
117
|
-
unique_cves = list(set(software["cves"]))
|
|
132
|
+
unique_cves = list(set(cve["cve_id"] for cve in software["cves"]))
|
|
118
133
|
cve_list = ", ".join(unique_cves[:5]) # Show first 5 CVEs
|
|
119
|
-
|
|
134
|
+
severities = ", ".join(software["severities"]) # Show first 5 CVEs
|
|
135
|
+
for cve in software["cves"]:
|
|
136
|
+
severity = cve["severity"].lower()
|
|
137
|
+
if severity == "critical":
|
|
138
|
+
score += 100
|
|
139
|
+
elif severity == "high":
|
|
140
|
+
score += 10
|
|
141
|
+
elif severity == "medium":
|
|
142
|
+
score += 5
|
|
143
|
+
elif severity == "low":
|
|
144
|
+
score += 1
|
|
145
|
+
|
|
120
146
|
if len(unique_cves) > 5:
|
|
121
147
|
cve_list += f".. (+{len(unique_cves) - 5} more)"
|
|
122
148
|
|
|
123
|
-
|
|
124
|
-
f"{software['name']} {software['version']} ({software['vendor']})
|
|
125
|
-
f"{
|
|
149
|
+
detail_object = DetailObject(
|
|
150
|
+
software=f"{software['name']} {software['version']} ({software['vendor']})",
|
|
151
|
+
data=f"{score} ({cve_count}: {severities}) weaknesses ({cve_list})",
|
|
152
|
+
score=score
|
|
126
153
|
)
|
|
127
154
|
|
|
155
|
+
total_score += score
|
|
156
|
+
|
|
128
157
|
# Add paths (limit to 4)
|
|
129
158
|
for path in list(software["paths"])[:4]:
|
|
130
|
-
|
|
159
|
+
detail_object.paths.append(f" - {path}")
|
|
160
|
+
|
|
161
|
+
# Indicate if more paths exist
|
|
162
|
+
if (len(software["paths"]) > 4):
|
|
163
|
+
detail_object.paths.append(f" - .. (+{len(software['paths']) - 4} more)")
|
|
164
|
+
|
|
165
|
+
# Add registry paths if available (limit to 4)
|
|
166
|
+
for registry_path in list(software["registryPaths"])[:4]:
|
|
167
|
+
detail_object.paths.append(f" - {registry_path}")
|
|
168
|
+
|
|
169
|
+
# Indicate if more registry paths exist
|
|
170
|
+
if (len(software["registryPaths"]) > 4):
|
|
171
|
+
detail_object.paths.append(f" - .. (+{len(software['registryPaths']) - 4} more)")
|
|
172
|
+
|
|
173
|
+
# Collect detail objects for sorting
|
|
174
|
+
detail_objects.append(detail_object)
|
|
175
|
+
|
|
176
|
+
# Sort detail objects by score descending
|
|
177
|
+
detail_objects.sort(key=lambda x: x.score, reverse=True)
|
|
178
|
+
|
|
179
|
+
# Limit to top 10
|
|
180
|
+
for detail_object in detail_objects[:10]:
|
|
181
|
+
details.append(f"{detail_object.software} {detail_object.data}")
|
|
182
|
+
details.extend(detail_object.paths)
|
|
131
183
|
|
|
132
184
|
# Determine the value based on severity:
|
|
133
185
|
# - Critical vulnerabilities trigger critical threshold
|
|
134
186
|
# - High/Medium vulnerabilities trigger warning threshold
|
|
135
187
|
# - Low vulnerabilities or no vulnerabilities are OK
|
|
136
|
-
|
|
137
|
-
value = (critical_count * 100) + (high_count *10) + (medium_count*5) + (low_count*1)
|
|
138
188
|
result = {
|
|
139
|
-
"value":
|
|
189
|
+
"value": total_score,
|
|
140
190
|
"details": details,
|
|
141
191
|
"vulnerable_count": len(vulnerable_software),
|
|
142
192
|
"critical_count": critical_count,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
check_msdefender-1.1.
|
|
2
|
-
check_msdefender-1.1.
|
|
3
|
-
check_msdefender-1.1.
|
|
4
|
-
check_msdefender-1.1.
|
|
5
|
-
check_msdefender/__init__.py,sha256=
|
|
1
|
+
check_msdefender-1.1.13.dist-info/METADATA,sha256=0Q-iA8dDNV1SNQtUQrErNSWYtN9g4m6HBm4Kg5VJ5Iw,14799
|
|
2
|
+
check_msdefender-1.1.13.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
check_msdefender-1.1.13.dist-info/entry_points.txt,sha256=OqVzHI1PaD9V22g0K7BhA2nYv4O-pH8mcLzuGdsk5rM,79
|
|
4
|
+
check_msdefender-1.1.13.dist-info/licenses/LICENSE,sha256=kW3DwIsKc9HVYdS4f4tI6sLo-EPqBQbz-WmuvHU4Nak,1065
|
|
5
|
+
check_msdefender/__init__.py,sha256=flO_r0jW8XydeZP3cNFvpdRHm3iCT45ypdkNB8EXrRU,161
|
|
6
6
|
check_msdefender/__main__.py,sha256=TuNsRSdnkQm9OdBTAwD5aB2zV_Irc50WgylVWhrfnLY,124
|
|
7
7
|
check_msdefender/check_msdefender.py,sha256=OO4Tg2DBW28AT-2LOH-qJM2pE5TPcF615BF7HjyZsmA,137
|
|
8
8
|
check_msdefender/cli/__init__.py,sha256=NWaS5ZI9_252AcReugF_WGPMOvQ_B7sC_s3pSrGujcI,291
|
|
@@ -31,6 +31,6 @@ check_msdefender/services/lastseen_service.py,sha256=LiNVeUbAoMzowMvE90P7zCtKFHB
|
|
|
31
31
|
check_msdefender/services/machines_service.py,sha256=KLRwltpYtwg_qtW6BGIxlH-PB9LcnEyW-i3C4RGSD30,3238
|
|
32
32
|
check_msdefender/services/models.py,sha256=CDmQ5vU0-GawIalqXjXNk3rry6gsyjv6eSlW2NiXwQ0,979
|
|
33
33
|
check_msdefender/services/onboarding_service.py,sha256=RIOsvALCoKV0YqnCHKYRkelSPrO-F-6vNBLlto4MpiI,2686
|
|
34
|
-
check_msdefender/services/products_service.py,sha256=
|
|
34
|
+
check_msdefender/services/products_service.py,sha256=AqzBJuAg-bAmku8ziGqkoUe_bRkrVpi0nifaLklIxQc,8881
|
|
35
35
|
check_msdefender/services/vulnerabilities_service.py,sha256=LuRRQlFt-K82tGUhLCx_QCOp4CbBgSp7fktmeSSoa9o,6838
|
|
36
|
-
check_msdefender-1.1.
|
|
36
|
+
check_msdefender-1.1.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|