diff options
author | gasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2016-10-01 21:46:34 +0000 |
---|---|---|
committer | gasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2016-10-01 21:46:34 +0000 |
commit | fa8934667ad8eae30c81081bbaa868b227c119ed (patch) | |
tree | d2a69178cfb693c0da0ffbefaff2da70a64f52f5 /kpov_judge/tasks/mock_entrance_exam | |
parent | 7210b74d6241a4264532aaaa2e1d771eaca4e073 (diff) |
added a global_params parameter to prepare_disks so that the task_name, username and task_url are pre-entered on the arbiters
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@351 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/tasks/mock_entrance_exam')
-rw-r--r-- | kpov_judge/tasks/mock_entrance_exam/task.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/kpov_judge/tasks/mock_entrance_exam/task.py b/kpov_judge/tasks/mock_entrance_exam/task.py index 96965be..b0c053d 100644 --- a/kpov_judge/tasks/mock_entrance_exam/task.py +++ b/kpov_judge/tasks/mock_entrance_exam/task.py @@ -115,7 +115,7 @@ params_meta = { def task(student_IP, net_prog_name, P_c, P_executable, arg_c, env_c, out_stderr_c, out_stdout_c, P_script, param_gen_seed): - import pxssh + from pexpect import pxssh import random conn = pxssh.pxssh() conn.login(student_IP, 'student', 'vaje') @@ -229,7 +229,7 @@ def task_check(results, params): score += 1 return score, hints -def prepare_disks(templates, params): +def prepare_disks(templates, task_params, global_params): c_source = '''#include<stdio.h> #include<stdlib.h> #include<string.h> @@ -273,7 +273,7 @@ done; }& """ import random d = templates['student-entrance'] - r = random.Random(params['c_destroy_gen_seed']) + r = random.Random(task_params['c_destroy_gen_seed']) destroyed_c_source = c_source[:110] for c in c_source[110:]: i = r.randint(0, 5) @@ -284,10 +284,10 @@ done; }& if i == 3: destroyed_c_source += 'QX' destroyed_c_source += c - d.write(params['P_c'], destroyed_c_source) - d.chown(1000, 1000, params['P_c']) + d.write(task_params['P_c'], destroyed_c_source) + d.chown(1000, 1000, task_params['P_c']) sh_path = r.choice(['/usr/share/doc', '/var/lib', '/usr/local/share', '/etc/alternatives']) - sh_file = sh_path + '/' + params['net_prog_name'] + sh_file = sh_path + '/' + task_params['net_prog_name'] d.write(sh_file, evil_shell_source) d.chmod(0775, sh_file) d.write("/etc/rc.local", """#!/bin/sh -e @@ -295,4 +295,4 @@ export PATH=$PATH:{} {} & exit 0 -""".format(sh_path, params['net_prog_name'])) +""".format(sh_path, task_params['net_prog_name'])) |