From 5f451899c4aa56caf40d4d9e100498abe1d28cbc Mon Sep 17 00:00:00 2001 From: "mj7196@student.uni-lj.si" Date: Wed, 10 Dec 2014 19:03:59 +0000 Subject: Funkcijo gen_params sem spremenil tako, da sem generiral nakljucen string crk in stevilk, katere pa sem dobil preko datuma, in je tako to lahko enolicna cifra vedno drugacna. git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@22 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- kpov_judge/tasks/custom_rdate/task.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'kpov_judge') diff --git a/kpov_judge/tasks/custom_rdate/task.py b/kpov_judge/tasks/custom_rdate/task.py index ae3804c..304ed1a 100644 --- a/kpov_judge/tasks/custom_rdate/task.py +++ b/kpov_judge/tasks/custom_rdate/task.py @@ -79,15 +79,23 @@ def task(IP_NM, DNS_NM, IP_static, DNS_static): sB.logout() return results +import datetime +import random def gen_params(user_id, params_meta): + crke = "ABCDEFGHIJKLMNOPRSTUVZXYQW" + time = datetime.datetime.now().strftime("%Y%m%d%H%M%S) + sifra = "" + for x in time: + for i in x: + sifra+=random.choice(crke) + i + random.choice(crke) params = dict() r = random.Random(user_id) - # IP_NM, DNS_NM, IP_static, DNS_static) dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220'] net = kpov_random_helpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) 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] = sifra return params def task_check(results, params): -- cgit v1.2.1