From 5493256ec6b31df5f05ec98d03b741a4f9c6de79 Mon Sep 17 00:00:00 2001 From: iandioch Date: Thu, 20 Apr 2017 00:47:48 +0100 Subject: [PATCH] Create random dir for binaries --- dipla/client/client_factory.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dipla/client/client_factory.py b/dipla/client/client_factory.py index f8c91d1..d184773 100644 --- a/dipla/client/client_factory.py +++ b/dipla/client/client_factory.py @@ -8,6 +8,10 @@ from dipla.shared.statistics import StatisticsUpdater from logging import FileHandler import multiprocessing +import hashlib +import string +import random +import os class ClientFactory: @@ -89,4 +93,13 @@ def _create_verify_inputs_service(client): @staticmethod def _create_binary_receiver(client): - return BinaryReceiverService(client, './binary') + m = hashlib.md5() + path = None + while True: + m.update(random.choice(string.ascii_letters).encode('utf-8')) + path = '.dipla_' + m.hexdigest() + if not os.path.isdir(path): + os.mkdir(path) + break + path += '/' + return BinaryReceiverService(client, path)