From 5d2cd458e033fddb0197c74d5c0e656d7cc122ec Mon Sep 17 00:00:00 2001 From: "ml8262@student.uni-lj.si" Date: Wed, 10 Dec 2014 19:35:00 +0000 Subject: V funkciji gen params sem naredil generator dodatnega parametra ki bo unikaten za vse uporabnike git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@23 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- kpov_judge/tasks/openvpn_simple_smb/task.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'kpov_judge/tasks') diff --git a/kpov_judge/tasks/openvpn_simple_smb/task.py b/kpov_judge/tasks/openvpn_simple_smb/task.py index 2e812eb..e4744c3 100644 --- a/kpov_judge/tasks/openvpn_simple_smb/task.py +++ b/kpov_judge/tasks/openvpn_simple_smb/task.py @@ -89,6 +89,19 @@ def task(IP_NM, DNS_NM, IP_static, DNS_static): return results def gen_params(user_id, params_meta): + alpha = "abcdefghijklmnoprstuvzxyqw" + alphaupp = "ABCDEFGHIJKLMNOPRSTUVZQWXY" + alpha2 = ['$','?','!',"%","&"] + alpha3 = ['IT','DH','JF','PO','LZ'] + temp = datetime.datetime.now().strftime("%Y%m%d%H%M%S") + hash = "" + for x in temp: + for i in x: + if int(i)<5: + hash+=random.choice(alpha)+alpha2[int(i)] + else: + hash+=random.choice(alphaupp)+alpha3[int(i)-5] + hash+=":"+temp params = dict() r = random.Random(user_id) # IP_NM, DNS_NM, IP_static, DNS_static) @@ -97,6 +110,7 @@ def gen_params(user_id, params_meta): params['DNS_NM'] = r.choice(dns_servers) params['IP_NM'], params['IP_static'] = kpov_random_helpers.IPv4_addr_gen(r, net, 2) params['DNS_static'] = r.choice(dns_servers) + params[user_id]=hash return params def task_check(results, params): -- cgit v1.2.1