From 9a9f636562382da1bd910a4f740f314629bf3808 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Sat, 26 Aug 2023 16:13:51 +0200 Subject: [PATCH] improved logging --- tnc/data_handler.py | 6 ++++++ tnc/helpers.py | 3 ++- tnc/static.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tnc/data_handler.py b/tnc/data_handler.py index 4d33f80a..6b147c8f 100644 --- a/tnc/data_handler.py +++ b/tnc/data_handler.py @@ -921,8 +921,14 @@ class DATA: # check if hmac signing enabled if TNC.enable_hmac: + self.log.info( + "[TNC] [HMAC] Enabled", + ) # now check if we have valid hmac signature - returns salt or bool salt_found = helpers.search_hmac_salt(self.dxcallsign, self.mycallsign, data_frame_crc, data_frame, token_iters=100) + self.log.info( + "[TNC] [HMAC] Salt found", salt=salt_found + ) if salt_found: # hmac digest received self.arq_process_received_data_frame(data_frame, snr, signed=True) diff --git a/tnc/helpers.py b/tnc/helpers.py index 4deb7ece..25dd4a39 100644 --- a/tnc/helpers.py +++ b/tnc/helpers.py @@ -531,6 +531,7 @@ def get_hmac_salt(dxcallsign: bytes, mycallsign: bytes): return False def search_hmac_salt(dxcallsign: bytes, mycallsign: bytes, search_token, data_frame, token_iters): + filename = f"freedata_hmac_STATION_{dxcallsign.decode('utf-8')}_REMOTE_{mycallsign.decode('utf-8')}.txt" if sys.platform == "linux": @@ -570,7 +571,7 @@ def search_hmac_salt(dxcallsign: bytes, mycallsign: bytes, search_token, data_fr if search_token == search_digest: token_position = len(token_list) - _ delete_last_line_from_hmac_list(filepath, token_position) - log.warning( + log.info( "[TNC] [HMAC] Signature found", expected=search_token, ) return True diff --git a/tnc/static.py b/tnc/static.py index ec1efceb..57d481a2 100644 --- a/tnc/static.py +++ b/tnc/static.py @@ -129,7 +129,7 @@ class TCIParam: @dataclass class TNC: - version = "0.10.3-alpha.1-hmac-exp2" + version = "0.10.3-alpha.1-hmac-exp3" host: str = "0.0.0.0" port: int = 3000 SOCKET_TIMEOUT: int = 1 # seconds