diff --git a/eddn.py b/eddn.py index ddfc9900..0443c78d 100644 --- a/eddn.py +++ b/eddn.py @@ -11,6 +11,7 @@ import re import requests from sys import platform import time +import uuid if platform != 'win32': from fcntl import lockf, LOCK_EX, LOCK_NB @@ -33,7 +34,6 @@ class EDDN: UPLOAD = 'http://eddn-gateway.elite-markets.net:8080/upload/' REPLAYPERIOD = 400 # Roughly two messages per second, accounting for send delays [ms] REPLAYFLUSH = 20 # Update log on disk roughly every 10 seconds - salt = 'SDC Harry Potter' def __init__(self, parent): self.parent = parent @@ -78,10 +78,15 @@ class EDDN: replayfile = None def send(self, cmdr, msg): + salt = config.get('salt') + if not salt: + salt = uuid.uuid4().hex + config.set('salt', salt) + msg['header'] = { 'softwareName' : '%s [%s]' % (applongname, platform=='darwin' and "Mac OS" or system()), 'softwareVersion' : appversion, - 'uploaderID' : config.getint('anonymous') and hashlib.md5(cmdr.encode('utf-8')+EDDN.salt.encode('utf-8')).hexdigest() or cmdr.encode('utf-8'), + 'uploaderID' : config.getint('anonymous') and hashlib.sha1(cmdr.encode('utf-8') + salt).hexdigest() or cmdr.encode('utf-8'), } if not msg['message'].get('timestamp'): # already present in journal messages msg['message']['timestamp'] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(config.getint('querytime') or int(time.time())))