diff options
Diffstat (limited to 'kpov_judge/tasks')
-rw-r--r-- | kpov_judge/tasks/rename_grep_network/task.py | 42 | ||||
-rw-r--r-- | kpov_judge/tasks/vlc_stream_rtp/task.py | 20 |
2 files changed, 34 insertions, 28 deletions
diff --git a/kpov_judge/tasks/rename_grep_network/task.py b/kpov_judge/tasks/rename_grep_network/task.py index 91ace1a..ce3661b 100644 --- a/kpov_judge/tasks/rename_grep_network/task.py +++ b/kpov_judge/tasks/rename_grep_network/task.py @@ -12,7 +12,7 @@ instructions = { 'si': u""" Ustvari dva navidezna računalnika s slikama diskov - SimpleArbiterExam s sliko diska simpleArbiterDhcp in -SmallStudent s slikama diska student-entrance4 +SmallStudent s slikama diska student-entrance3 in smallstudent-personal. Drugi razdelek na sliki smallstudent-personal priklopi na imenik {mntdir} @@ -26,12 +26,11 @@ Na SmallStudent ustvari uporabnika {testuser} z geslom {passwd}. Na smallstudent-personal je nekje skrita datoteka, ki vsebuje niz {magicstr}. -Skopiraj jo v domači imenik {testuser} in preimenuj tako, da vse znake 'O' v imenu zamenjaš s 'K'. -V kopiji zamenjaj vse pojavitve številke "12" z "dvanajst". -Pazi, da nobena druga datoteka v domačem imeniku v svojem imenu ne bo vsebovala "K". +Skopiraj jo v domači imenik {testuser} in preimenuj tako, da vse znake 'O' v imenu zamenjaš z 'I'. +Pazi, da nobena druga datoteka v domačem imeniku v svojem imenu ne bo vsebovala "I". Poskrbi, da bo lastnik {testuser}, skupina pa naj ostane nespremenjena. -Brati naj jo ima pravico samo lastnik, pisati lastnik in ostali, poganjati le skupina. +Brati naj jo ima pravico samo lastnik, pisati lastnik in skupina, poganjati nihče. """, 'en': u''' ''', @@ -60,7 +59,7 @@ computers = { 'SmallStudent': { 'disks': [ { - 'name': 'student-entrance3', + 'name': 'student-entrance4', # 'parts': [{'dev': 'sda1', 'path': '/'}], }, { @@ -223,22 +222,23 @@ def task_check(results, params): score = 0 hidden_contents = params['magicstr'] r = random.Random(params['rndseed']) - dstfile = "".join([r.choice("qQoOp") for i in range(64)]) + "K.txt" - dstfile = dstfile.replace('O', 'K') + dstfile = "".join([r.choice("qQoOp") for i in range(64)]) + "I.txt" + dstfile = dstfile.replace('O', 'I') for i in range(1000): start = "".join([r.choice(["po", "p0", "no", "ko", "fo", "qo"]) for i in range(20)]) - mid = "".join([r.choice("1lIi") + r.choice("zZ2") for i in range(60)]) + mid = "".join([r.choice("uiasdfghjkyxcvbnm1234567890ASDFGHJKYZXCVBNM") for i in range(60)]) + end = r.choice(["lz", "1z", "Iz", "iz", "l2", "I2", "12"]) #if start[:2] == "po" and end == "lz": # start = "po" # mid = "kaka" - x = start + mid + x = start + mid + end hidden_contents += x + "\r\n" - #expected_contents = hidden_contents - expected_contents = re.sub(r"12", - r"dvanajst", - hidden_contents, - re.MULTILINE) - expected_contents = "cat ~/*K*.txt\r\n".format(dstfile) + expected_contents + expected_contents = hidden_contents + #expected_contents = re.sub(r"^po.*lz\r$", + # r"pokakalz\r", + # hidden_contents, + # re.MULTILINE) + expected_contents = "cat ~/*I*.txt\r\n".format(dstfile) + expected_contents if results["dst_file_contents"] == expected_contents: score += 3 else: @@ -252,7 +252,7 @@ def task_check(results, params): hints += ["wrong file contents\n" + str(diff_pos[1])] #hints += ["wrong file contents"] params['dstfile'] = dstfile - expected_dst_ls = u"ls -l ~/\\*K\\*.txt\r\n-rw---x-w- 1 {testuser} bilbo .*{dstfile}\r\n".format(**params) + expected_dst_ls = u"ls -l ~/\\*I\\*.txt\r\n-rw--w---- 1 {testuser} bilbo .*{dstfile}\r\n".format(**params) if re.match(expected_dst_ls, results["dst_ls"]): score += 2 else: @@ -284,10 +284,10 @@ def prepare_disks(templates, task_params, global_params): r = random.Random(task_params['rndseed']) dstfile = "".join([r.choice("qQoOp") for i in range(64)]) + "I.txt" for i in range(1000): - - start = "".join([r.choice(["po", "p0", "no", "ko", "fo", "qo"]) for i in range(20)]) - mid = "".join([r.choice("1lIi") + r.choice("zZ2") for i in range(60)]) - hidden_contents += start + mid + "\n" + x = "".join([r.choice(["po", "p0", "no", "ko", "fo", "qo"]) for i in range(20)]) + x += "".join([r.choice("uiasdfghjkyxcvbnm1234567890ASDFGHJKYZXCVBNM") for i in range(60)]) + x += r.choice(["lz", "1z", "Iz", "iz", "l2", "I2", "12"]) + hidden_contents += x + "\n" # create hidden file dir_list = ['Qlipper', 'Thunar', 'blender', 'autostart', 'kazam', 'mc', 'netsurf', 'pulse', 'qupzilla', 'radare2', 'teamviewer', 'texstudio', 'vlc'] ending_list = ['rc', '.conf', '', '.txt'] diff --git a/kpov_judge/tasks/vlc_stream_rtp/task.py b/kpov_judge/tasks/vlc_stream_rtp/task.py index ea9b905..39b315f 100644 --- a/kpov_judge/tasks/vlc_stream_rtp/task.py +++ b/kpov_judge/tasks/vlc_stream_rtp/task.py @@ -79,6 +79,7 @@ def task(NASLOV, TOK): results['ps'] = pexpect.run('ps xa') results['tcpdump_hex'] = pexpect.run('sudo /usr/sbin/tcpdump -x -c 2 dst host 239.255.255.255 and port 9875'.format(NASLOV)) results['tcpdump'] = pexpect.run('sudo /usr/sbin/tcpdump -c 8 dst host {}'.format(NASLOV)) + # print("HAHA") return results def gen_params(user_id, params_meta): @@ -95,14 +96,19 @@ def task_check(results, params): import re score = 0 hints = [] - packs = results['tcpdump_hex'].split('> 239.255.255.255.9875: UDP, length') - p1 = packs[1] - p1_l = p1.split('\n') - p1_d = p1_l[1:-1] p1_s = "" - for i in p1_d: - p1_s = p1_s + "".join([j.strip() for j in i.split(' ')[1:]]) - sname = "".join([hex(ord(i))[2:] for i in params['TOK']]) + sname = "" + try: + packs = results['tcpdump_hex'].split('> 239.255.255.255.9875: UDP, length') + p1 = packs[1] + p1_l = p1.split('\n') + p1_d = p1_l[1:-1] + p1_s = "" + for i in p1_d: + p1_s = p1_s + "".join([j.strip() for j in i.split(' ')[1:]]) + sname = "".join([hex(ord(i))[2:] for i in params['TOK']]) + except: + hints.append("problem parsing RTP stream capture result") if p1_s.find(sname) > 2: score += 5 else: |