diff options
author | ml8262@student.uni-lj.si <ml8262@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2014-12-22 19:41:55 +0000 |
---|---|---|
committer | ml8262@student.uni-lj.si <ml8262@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2014-12-22 19:41:55 +0000 |
commit | 21164c3c185224c5a4c2f1757c93ca59a1131070 (patch) | |
tree | b238cd0ac7ae8c47b820726db78e85adf2b2d15f /kpov_judge | |
parent | a232f4a3b6c5c0e39cd262cd0e6b3d49ad27e034 (diff) |
Popravil sem params_meta tako da vsebuje tri parametre : (IME_KLJUCA, IME_IMENIKA, HASH). V metodi gen_params se, jim dodelil vrednosti: (IME_KLJUCA=heidi.key , IME_IMENIKA=openvpn , HASH=generiran iz user_id). Ce se kaj ni v redu bi prosil za komentar. Hvala
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@130 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge')
-rw-r--r-- | kpov_judge/tasks/openvpn_simple_smb/task.py | 102 |
1 files changed, 13 insertions, 89 deletions
diff --git a/kpov_judge/tasks/openvpn_simple_smb/task.py b/kpov_judge/tasks/openvpn_simple_smb/task.py index 77b5f64..e1bb9b0 100644 --- a/kpov_judge/tasks/openvpn_simple_smb/task.py +++ b/kpov_judge/tasks/openvpn_simple_smb/task.py @@ -97,62 +97,9 @@ networks = { 'public': False } } - +#Tukaj sem generiral tri parametre, prosil bi če se upoštevajo pri Tasku. params_meta = { - 'IP_SimpleArbiterVPN': { - 'descriptions': { - 'si': 'Naslov SimpleArbiter' - }, - 'w': False, - 'public': True, - 'type': 'IP', - 'generated': True - }, - 'DNS_SimpleArbiterVPN': { - 'descriptions': { - 'si': 'DNS za SimpleArbiter' - }, - 'w': False, - 'public': True, - 'type': 'IP', - 'generated': True - }, - 'IP_VPNClient1': { - 'descriptions': { - 'si': 'Naslov VPNClient1' - }, - 'w': False, - 'public': True, - 'type': 'IP', - 'generated': True - }, - 'DNS_VPNClient1': { - 'descriptions': { - 'si': 'DNS za VPNClient1' - }, - 'w': False, - 'public': True, - 'type': 'IP', - 'generated': True - }, - 'IP_VPNClient2': { - 'descriptions': { - 'si': 'Naslov VPNClient2' - }, - 'w': False, - 'public': True, - 'type': 'IP', - 'generated': True - }, - 'DNS_VPNClient2': { - 'descriptions': { - 'si': 'DNS za VPNClient2' - }, - 'w': False, - 'public': True, - 'type': 'IP', - 'generated': True - } + 'IME_IMENIKA': {}, 'IME_KLJUCA':{}, 'HASH': {} } @@ -306,41 +253,18 @@ def task(IP_SimpleArbiterVPN, DNS_SimpleArbiterVPN, IP_VPNClient1, DNS_VPNClient 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) - 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] = hash - - + #Tukaj sem generiral te tri parametre (ime skupne skrivnosti je heidi ) + #(ime imenika kjer naj bo shranjena skupna skrivnost naj bo openvpn) + #(HASH bo naključno generiran niz iz user_id s katerim se bo preverjalo plagiatorstvo) + params['IME_KLJUCA']="heidi.key" + params['IME_IMENIKA']="openvpn" + hash="" + alpha=["1","2","3","4","5","6","7","8","9","0"] + rnd = random.Random(alpha) + for x in id: + hash+=chr(int(x)+80)+rnd + params['HASH']=hash return params |