From 5ba5607cd4b3bd0aa4eaa30fe00cb69b6c73be56 Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Wed, 10 Jan 2024 11:34:32 +0100 Subject: [PATCH 1/3] signtool: Fix logic on bitness detection --- windows_tools/signtool/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/windows_tools/signtool/__init__.py b/windows_tools/signtool/__init__.py index 4bee7dd..22798c0 100644 --- a/windows_tools/signtool/__init__.py +++ b/windows_tools/signtool/__init__.py @@ -134,11 +134,12 @@ def get_timestamp_server(self): raise ValueError("No online timeserver found") def sign(self, executable, bitness: Union[None, int, str] = None): + if not bitness: possible_bitness = is_64bit_executable(executable) if possible_bitness is not None: bitness = 64 if possible_bitness else 32 - elif bitness in [32, "32", "x86"]: + if bitness in [32, "32", "x86"]: signtool = os.environ.get("SIGNTOOL_X32", self.detect_signtool("x86")) elif bitness in [64, "64", "x64"]: signtool = os.environ.get("SIGNTOOL_X64", self.detect_signtool("x64")) From 050baa309c1e1e73a8d9b7eb5b7b46c29f485b91 Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Wed, 10 Jan 2024 11:38:08 +0100 Subject: [PATCH 2/3] signtool: Update check http function name --- windows_tools/signtool/__init__.py | 10 +++++----- windows_tools/signtool/requirements.txt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/windows_tools/signtool/__init__.py b/windows_tools/signtool/__init__.py index 22798c0..f722994 100644 --- a/windows_tools/signtool/__init__.py +++ b/windows_tools/signtool/__init__.py @@ -15,18 +15,18 @@ __intname__ = "windows_tools.signtool" __author__ = "Orsiris de Jong" -__copyright__ = "Copyright (C) 2020-2023 Orsiris de Jong" +__copyright__ = "Copyright (C) 2020-2024 Orsiris de Jong" __description__ = "Windows authenticode signature tool" __licence__ = "BSD 3 Clause" -__version__ = "0.4.0" -__build__ = "2023112601" +__version__ = "0.4.1" +__build__ = "2024011001" import os from typing import Optional, Union from command_runner import command_runner from ofunctions.file_utils import get_paths_recursive -from ofunctions.network import test_http_internet +from ofunctions.network import check_http_internet from windows_tools.bitness import is_64bit, is_64bit_executable # Basic PATHS where signtool.exe should reside when Windows SDK is installed @@ -128,7 +128,7 @@ def get_timestamp_server(self): "http://timestamp.globalsign.com/scripts/timstamp.dll", ] for server in ts_servers: - if test_http_internet([server]): + if check_http_internet([server]): self.authority_timestamp_url = server return True raise ValueError("No online timeserver found") diff --git a/windows_tools/signtool/requirements.txt b/windows_tools/signtool/requirements.txt index f35b2a1..6c0444f 100644 --- a/windows_tools/signtool/requirements.txt +++ b/windows_tools/signtool/requirements.txt @@ -3,4 +3,4 @@ ofunctions.network>=1.3.2 command_runner>=1.2.1 windows_tools.bitness>=0.2.0 ofunctions.file_utils -ofunctions.network \ No newline at end of file +ofunctions.network>=1.6.0 \ No newline at end of file From 99b838fa25afcba4c235db3dd736fb07349e8817 Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Wed, 10 Jan 2024 11:38:28 +0100 Subject: [PATCH 3/3] Reformat files with black --- windows_tools/antivirus/__init__.py | 2 +- windows_tools/signtool/__init__.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/windows_tools/antivirus/__init__.py b/windows_tools/antivirus/__init__.py index 5c1a987..ca5e56f 100644 --- a/windows_tools/antivirus/__init__.py +++ b/windows_tools/antivirus/__init__.py @@ -55,7 +55,7 @@ "malwarebytes", "vipre", "sentinel ?one", - "cybereason" + "cybereason", ] diff --git a/windows_tools/signtool/__init__.py b/windows_tools/signtool/__init__.py index f722994..4a790f7 100644 --- a/windows_tools/signtool/__init__.py +++ b/windows_tools/signtool/__init__.py @@ -134,7 +134,6 @@ def get_timestamp_server(self): raise ValueError("No online timeserver found") def sign(self, executable, bitness: Union[None, int, str] = None): - if not bitness: possible_bitness = is_64bit_executable(executable) if possible_bitness is not None: