Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create random dir for binaries #279

Merged
merged 1 commit into from
Apr 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion dipla/client/client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)