summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/mock_entrance_exam
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks/mock_entrance_exam')
-rw-r--r--kpov_judge/tasks/mock_entrance_exam/task.py14
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']))