diff options
Diffstat (limited to 'kpov_judge/tasks')
-rw-r--r-- | kpov_judge/tasks/rename_grep_network/task.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/kpov_judge/tasks/rename_grep_network/task.py b/kpov_judge/tasks/rename_grep_network/task.py index ce761db..91ace1a 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-entrance3 +SmallStudent s slikama diska student-entrance4 in smallstudent-personal. Drugi razdelek na sliki smallstudent-personal priklopi na imenik {mntdir} @@ -26,11 +26,12 @@ 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š z 'I'. -Pazi, da nobena druga datoteka v domačem imeniku v svojem imenu ne bo vsebovala "I". +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". Poskrbi, da bo lastnik {testuser}, skupina pa naj ostane nespremenjena. -Brati naj jo ima pravico samo lastnik, pisati lastnik in skupina, poganjati nihče. +Brati naj jo ima pravico samo lastnik, pisati lastnik in ostali, poganjati le skupina. """, 'en': u''' ''', @@ -60,11 +61,11 @@ computers = { 'disks': [ { 'name': 'student-entrance3', - 'parts': [{'dev': 'a1', 'path': '/'}], + # 'parts': [{'dev': 'sda1', 'path': '/'}], }, { 'name': 'smallstudent-personal', - 'parts': [{'dev': 'b1', 'path': '/media'}, {'dev': 'b2', 'path': '/mnt'}] + 'parts': [{'dev': 'sdb1', 'path': '/media'}, {'dev': 'sdb2', 'path': '/mnt'}] } ], 'network_interfaces': [ @@ -222,23 +223,22 @@ 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)]) + "I.txt" - dstfile = dstfile.replace('O', 'I') + dstfile = "".join([r.choice("qQoOp") for i in range(64)]) + "K.txt" + dstfile = dstfile.replace('O', 'K') for i in range(1000): start = "".join([r.choice(["po", "p0", "no", "ko", "fo", "qo"]) for i in range(20)]) - mid = "".join([r.choice("uiasdfghjkyxcvbnm1234567890ASDFGHJKYZXCVBNM") for i in range(60)]) - end = r.choice(["lz", "1z", "Iz", "iz", "l2", "I2", "12"]) + mid = "".join([r.choice("1lIi") + r.choice("zZ2") for i in range(60)]) #if start[:2] == "po" and end == "lz": # start = "po" # mid = "kaka" - x = start + mid + end + x = start + mid hidden_contents += x + "\r\n" - 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 + #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 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 ~/\\*I\\*.txt\r\n-rw--w---- 1 {testuser} bilbo .*{dstfile}\r\n".format(**params) + expected_dst_ls = u"ls -l ~/\\*K\\*.txt\r\n-rw---x-w- 1 {testuser} bilbo .*{dstfile}\r\n".format(**params) if re.match(expected_dst_ls, results["dst_ls"]): score += 2 else: @@ -263,7 +263,7 @@ def task_check(results, params): "/dev/sdb2 on {mntdir} type ext4".format(**params), "sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)", "proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)", - "udev on /dev type devtmpfs (rw,nosuid,relatime,size=500680k,nr_inodes=125170,mode=755)", + "udev on /dev type devtmpfs (rw,nosuid,relatime", "/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)",] if all([results["mnt"].find(expected_mnt) > -1 for expected_mnt in expected_mnts]): score += 3 @@ -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): - 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" + + 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" # create hidden file dir_list = ['Qlipper', 'Thunar', 'blender', 'autostart', 'kazam', 'mc', 'netsurf', 'pulse', 'qupzilla', 'radare2', 'teamviewer', 'texstudio', 'vlc'] ending_list = ['rc', '.conf', '', '.txt'] |