From 7d5777a7d4f14cade5f888cf7a81785160e22b18 Mon Sep 17 00:00:00 2001 From: Zhihao Ma Date: Thu, 2 Jan 2025 10:38:18 -0500 Subject: [PATCH] remove file log handlers change several logging levels --- bin/pyntlm_auth/log.py | 5 ----- bin/pyntlm_auth/rpc.py | 12 ++++++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/bin/pyntlm_auth/log.py b/bin/pyntlm_auth/log.py index d611b35a2ad..b31f38648c9 100644 --- a/bin/pyntlm_auth/log.py +++ b/bin/pyntlm_auth/log.py @@ -10,15 +10,10 @@ def init_logging(): console_handler = logging.StreamHandler() console_handler.setLevel(default_logging_level) - # file_handler = logging.FileHandler("app.log") - # file_handler.setLevel(default_logging_level) - formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s', datefmt="%Y-%m-%d %H:%M:%S") console_handler.setFormatter(formatter) - # file_handler.setFormatter(formatter) logger.addHandler(console_handler) - # logger.addHandler(file_handler) return logger diff --git a/bin/pyntlm_auth/rpc.py b/bin/pyntlm_auth/rpc.py index d149987bb73..159b10856bf 100644 --- a/bin/pyntlm_auth/rpc.py +++ b/bin/pyntlm_auth/rpc.py @@ -95,15 +95,15 @@ def init_secure_connection(): except NTSTATUSError as e: error_code = e.args[0] error_message = e.args[1] - log.warning(f"Error in init secure connection: NTError: {hex(error_code)}, {error_message}.") + log.error(f"Error in init secure connection: NTError: {hex(error_code)}, {error_message}.") if error_code == 0xc0000001: - log.warning("Did you give the wrong 'workstation' parameter in domain configuration ?") + log.error("Did you give the wrong 'workstation' parameter in domain configuration ?") if error_code == 0xc0000022: - log.warning("Are you using a wrong password for a machine account?") - log.warning("If you are in a cluster, did you re-used the machine account and reset with another password?") + log.error("Are you using a wrong password for a machine account?") + log.error("If you are in a cluster, did you re-used the machine account and reset with another password?") if error_code == 0xc0000122: - log.warning(f"This is usually due to a incorrect AD FQDN. The current AD FQDN you are using is: {server_name}") + log.error(f"This is usually due to a incorrect AD FQDN. The current AD FQDN you are using is: {server_name}") log.debug("Parameter used in establish secure channel are:") log.debug(f" lp.netbios_name: {netbios_name}") @@ -119,7 +119,7 @@ def init_secure_connection(): except Exception as e: error_code = e.args[0] error_message = e.args[1] - log.warning(f"Error in init secure connection: ErrCode: {error_code}, {error_message}.") + log.error(f"Error in init secure connection: ErrCode: {error_code}, {error_message}.") return global_vars.s_secure_channel_connection, global_vars.s_machine_cred, error_code, error_message