summaryrefslogtreecommitdiff
path: root/kpov_judge
diff options
context:
space:
mode:
authorml8262@student.uni-lj.si <ml8262@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2014-12-10 19:35:00 +0000
committerml8262@student.uni-lj.si <ml8262@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2014-12-10 19:35:00 +0000
commit5d2cd458e033fddb0197c74d5c0e656d7cc122ec (patch)
tree105c787ea1e79844f2b0b913aec453bd39894071 /kpov_judge
parent5f451899c4aa56caf40d4d9e100498abe1d28cbc (diff)
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
Diffstat (limited to 'kpov_judge')
-rw-r--r--kpov_judge/tasks/openvpn_simple_smb/task.py14
1 files changed, 14 insertions, 0 deletions
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):