summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks')
-rw-r--r--kpov_judge/tasks/custom_rdate/task.py54
1 files changed, 31 insertions, 23 deletions
diff --git a/kpov_judge/tasks/custom_rdate/task.py b/kpov_judge/tasks/custom_rdate/task.py
index 561c7d1..515792d 100644
--- a/kpov_judge/tasks/custom_rdate/task.py
+++ b/kpov_judge/tasks/custom_rdate/task.py
@@ -76,12 +76,11 @@ computers = {
networks = { 'net1': {'public': False}, 'test-net': {'public': True} }
-# TODO: (polz) pick the parameters you need! ASAP!
+# Tu sem dolocil parametre
params_meta = {
- 'IP_NM': {'descriptions': {'si': 'Naslov maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True},
- 'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True},
- 'IP_static': {'descriptions': {'si': 'Naslov maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True},
- 'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'Ime':{}
+ 'Datum':{}
+ 'Sifra':{}
}
def task(IP_NM, DNS_NM, IP_static, DNS_static):
@@ -105,28 +104,37 @@ def task(IP_NM, DNS_NM, IP_static, DNS_static):
sA.logout()
sB.logout()
return results
+
+
+#Dolocil sem tri parametre in sicer jih lahko vidite v prams_meta,
+#zato prosim da jih upostevate v naslednih nalogah.
-import datetime
-import random
def gen_params(user_id, params_meta):
- # TODO: (polz) tole nima smisla. Za začetek datetime in random
- # ne bosta importana v test_task.py, kjer se bo tale koda izvajala.
- # Prosim, s kolegi se pogovorite in si izmislite, katere parametre bi
- # lahko uporabili.
- 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)
+ import socket
+ import struct
+ import datetime
+
params = dict()
r = random.Random(user_id)
- 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
+ params['Ime'] = "guliver"
+
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect(("ntp1.arnes.si",37))
+
+ podatek = s.recv(4)
+ stevilka = struct.unpack("!I",podatek)
+ stevilka = stevilka[0]
+ t = datetime.date(year=1850,month=1,day=1)
+ t = t + datetime.timedelta(seconds=stevilka)
+ params['Datum'] = t
+
+ rez = ""
+ crke = "ABCDEFGHIJKLMNOPRSTUVZXYQ"
+ c = random.Random(crke)
+ for x in user_id:
+ rez += x + c.choice()
+
+ params['Sifra'] = rez
return params
def task_check(results, params):