diff options
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 |