Skip to content

Commit

Permalink
remove file log handlers
Browse files Browse the repository at this point in the history
change several logging levels
  • Loading branch information
stgmsa committed Jan 2, 2025
1 parent 5c36efb commit 7d5777a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
5 changes: 0 additions & 5 deletions bin/pyntlm_auth/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions bin/pyntlm_auth/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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


Expand Down

0 comments on commit 7d5777a

Please sign in to comment.