From fd9e768bd6860049870528a5041d5f0048859e2f Mon Sep 17 00:00:00 2001 From: tchbla <148860078+tchbla@users.noreply.github.com> Date: Tue, 28 Jul 2026 10:40:28 +0200 Subject: [PATCH 1/5] fix: replace deprecated distutils.version.StrictVersion for python 3.13 compat distutils was removed in Python 3.13, causing an ImportError on import. replace with a local _parse_version() helper using tuple comparison. --- DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py b/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py index 80e77ae25ce..b460ea65ed1 100644 --- a/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py +++ b/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py @@ -15,7 +15,8 @@ import re import argparse import sys -from distutils.version import StrictVersion +def _parse_version(v): + return tuple(int(x) for x in v.split('.')) SCRIPT_VERSION = 2.51 PY3 = sys.version_info.major == 3 @@ -298,7 +299,7 @@ def is_agent_version_updated(): This function tess whether the agent on the machine is running with this updated agent version. """ global IS_AGENT_VERSION_UPDATED - IS_AGENT_VERSION_UPDATED = StrictVersion(UPDATED_AGENT_VERSION) <= StrictVersion(AGENT_VERSION) + IS_AGENT_VERSION_UPDATED = _parse_version(UPDATED_AGENT_VERSION) <= _parse_version(AGENT_VERSION) @staticmethod def print_arc_version(): @@ -588,7 +589,7 @@ def verify_selinux_state(self): command_to_run = "sudo getenforce 2> /dev/null; if [ $? != 0 ]; then echo 'Disabled'; fi" result_keywords_array = ["Enforcing"] command_object = CommandVerification(command_name, command_to_run, result_keywords_array) - if StrictVersion(AGENT_VERSION) < StrictVersion(AGENT_MIN_HARDENING_VERSION): + if _parse_version(AGENT_VERSION) < _parse_version(AGENT_MIN_HARDENING_VERSION): command_object.run_full_test(True) if not command_object.is_successful: print_error(self.SELINUX_RUNNING_ERROR_MESSAGE) From 93bff0035918e71f4350e97ea81a141716406eaa Mon Sep 17 00:00:00 2001 From: tchbla <148860078+tchbla@users.noreply.github.com> Date: Tue, 28 Jul 2026 11:05:23 +0200 Subject: [PATCH 2/5] Update Sentinel_AMA_troubleshoot.py version to 2.52 --- DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py b/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py index b460ea65ed1..287c0992a4f 100644 --- a/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py +++ b/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py @@ -18,7 +18,7 @@ def _parse_version(v): return tuple(int(x) for x in v.split('.')) -SCRIPT_VERSION = 2.51 +SCRIPT_VERSION = 2.52 PY3 = sys.version_info.major == 3 # GENERAL SCRIPT CONSTANTS From f93aee565f1787e8b66846d4e22842920629e50b Mon Sep 17 00:00:00 2001 From: tchbla <148860078+tchbla@users.noreply.github.com> Date: Tue, 28 Jul 2026 12:05:50 +0200 Subject: [PATCH 3/5] fix: use portable shebang for Python interpreter Replace hardcoded `/usr/local/bin/python3` shebang with the portable `#!/usr/bin/env python3` form. The hardcoded path assumes a specific Python installation location, which breaks on systems where Python is installed elsewhere (e.g. via pyenv, conda, or OS package managers). Using `env` resolves `python3` from `$PATH`, correctly handling virtual environments and cross-platform installations. --- DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py b/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py index 287c0992a4f..1035c935c1c 100644 --- a/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py +++ b/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py @@ -1,4 +1,4 @@ -#! /usr/local/bin/python3 +#!/usr/bin/env python3 # ---------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # ---------------------------------------------------------------------------- From 6b7a72fe0fab48cedd6665b0998f2257b380410d Mon Sep 17 00:00:00 2001 From: David Date: Fri, 31 Jul 2026 11:22:55 +0200 Subject: [PATCH 4/5] fix: normalize _parse_version tuple to preserve StrictVersion semantics Pad to three components so "1.2" == "1.2.0" as StrictVersion did. Also add two blank lines before the function definition (PEP 8 E302). --- DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py b/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py index 1035c935c1c..122c8a33554 100644 --- a/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py +++ b/DataConnectors/Syslog/Sentinel_AMA_troubleshoot.py @@ -15,8 +15,11 @@ import re import argparse import sys + + def _parse_version(v): - return tuple(int(x) for x in v.split('.')) + parts = tuple(int(x) for x in v.split('.')) + return parts + (0,) * (3 - len(parts)) SCRIPT_VERSION = 2.52 PY3 = sys.version_info.major == 3 From fa17dedbe346c6c096a065b1baaad62adccc749d Mon Sep 17 00:00:00 2001 From: David Date: Fri, 31 Jul 2026 11:26:03 +0200 Subject: [PATCH 5/5] fix: replace distutils.util.strtobool removed in Python 3.12 Inline equivalent _strtobool helper preserving original behavior including ValueError on unrecognized values. --- .../InspectGetDetections/__init__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Solutions/ESET Inspect/Data Connectors/InspectGetDetections/__init__.py b/Solutions/ESET Inspect/Data Connectors/InspectGetDetections/__init__.py index ba3b8376575..03bc97595d4 100644 --- a/Solutions/ESET Inspect/Data Connectors/InspectGetDetections/__init__.py +++ b/Solutions/ESET Inspect/Data Connectors/InspectGetDetections/__init__.py @@ -19,12 +19,20 @@ import logging import os import re -from distutils.util import strtobool import azure.functions as func from datacollector import post_data from esetinspect import Inspect + +def _strtobool(val): + val = val.lower() + if val in ('y', 'yes', 't', 'true', 'on', '1'): + return True + if val in ('n', 'no', 'f', 'false', 'off', '0'): + return False + raise ValueError(f"invalid truth value {val!r}") + # Hack to keep the EI object cached (preventing multiple logins). # See: https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-functions/functions-reference-python.md#global-variables ei = None @@ -47,8 +55,8 @@ def main( base_url = os.environ["baseUrl"] username = os.environ["eiUsername"] password = os.environ["eiPassword"] - domain = bool(strtobool(os.environ["domainLogin"])) - verify = bool(strtobool(os.environ["verifySsl"])) + domain = bool(_strtobool(os.environ["domainLogin"])) + verify = bool(_strtobool(os.environ["verifySsl"])) start_from_id = int(os.environ["startFromID"]) workspace_id = os.environ["workspaceId"] workspace_key = os.environ["workspaceKey"]