improved logging

This commit is contained in:
DJ2LS 2023-08-08 08:27:22 +02:00
parent 1bdf070dfe
commit cb813ba402
2 changed files with 5 additions and 4 deletions

View file

@ -497,7 +497,8 @@ def bool_to_string(state):
def get_hmac_salt(dxcallsign: bytes, mycallsign: bytes):
filename = f"freedata_hmac_STATION_{dxcallsign.decode('utf-8')}_REMOTE_{mycallsign.decode('utf-8')}.txt"
print(f"looking for file {filename}")
log.info("[SCK] [HMAC] File lookup", file=filename)
try:
with open(filename, "r") as file:
line = file.readlines()

View file

@ -782,11 +782,11 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
binarydata = base64.b64decode(base64data)
# check if hmac hash is provided
try:
print("looking for hmac salt...")
log.info("[SCK] [HMAC] Looking for salt/token", local=mycallsign, remote=dxcallsign)
hmac_salt = helpers.get_hmac_salt(dxcallsign, mycallsign)
print(f" ... {hmac_salt}")
log.info("[SCK] [HMAC] Salt found", local=mycallsign, remote=dxcallsign, salt=hmac_salt)
except Exception:
print("no hmac salt found...")
log.warning("[SCK] [HMAC] No salt/token found")
hmac_salt = ''
DATA_QUEUE_TRANSMIT.put(
["ARQ_RAW", binarydata, arq_uuid, mycallsign, dxcallsign, attempts, hmac_salt]