summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/mock_entrance_exam
diff options
context:
space:
mode:
authorgasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-10-26 20:29:07 +0000
committergasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-10-26 20:29:07 +0000
commit173d160b19811eb77fdd36c9c0eacf90b65a83f3 (patch)
tree39be79cb274af05b233a2154ea5f1bcbe762f246 /kpov_judge/tasks/mock_entrance_exam
parent4a191a4775f01f66bf7610c38f11517ec4c3a547 (diff)
Fixed web program after first exam
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@342 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/tasks/mock_entrance_exam')
-rw-r--r--kpov_judge/tasks/mock_entrance_exam/task.py35
1 files changed, 8 insertions, 27 deletions
diff --git a/kpov_judge/tasks/mock_entrance_exam/task.py b/kpov_judge/tasks/mock_entrance_exam/task.py
index 46fc7da..1ee2d3f 100644
--- a/kpov_judge/tasks/mock_entrance_exam/task.py
+++ b/kpov_judge/tasks/mock_entrance_exam/task.py
@@ -5,25 +5,7 @@
# - switch to a real SSH/SFTP client to properly handle filenames
instructions = {
- 'si':u"""
-Ustvari dva navidezna računalnika - simpleArbiter in Student.
-
-Poskrbi, da bosta oba na istem omrežju in da bo imel Student naslov {student_IP}. Obenem mora biti
-simpleArbiter povezan na Internet. Računajte, da se na studentGUI ob zagonu zažene program {net_prog_name},
-ki vam spreminja nastavitve mrežne kartice.
-
-V domačem imeniku uporabnika student (geslo je "vaje") obstaja datoteka {P_c} v programskem jeziku C. Z uporabo gcc ga prevedite v program z imenom {P_executable}. Izvorna koda je namenoma pokvarjena tako, da so vanjo vrinjeni nepotrebni znaki. Pred prevajanjem jo morate popraviti.
-
-Napišite skripto ali program {P_script} v domačem imeniku uporabnika student, ki:
-- požene {P_c} z argumentom {arg_c} in mu na standardni vhod pripelje vrednost spremenljivke {env_c}
-- vse, kar {P_c} izpiše na stderr, spravi v datoteko {out_stderr_c}.
-- vse vrstice, ki jih {P_c} izpiše na stdout in vsebujejo zaporedje znakov "ma", zapiše v {out_stdout_c}.
-
-
-Lastnik vseh ustvarjenih datotek mora biti uporabnik student. Gesla uporabnika student
-ne smete spreminjati.
-
-""",
+ 'si': u'Navodil ni.',
'en': u'''
''',
}
@@ -87,7 +69,7 @@ params_meta = {
},
'out_stderr_c': {
'descriptions': { 'si': 'Datoteka z napakami', 'en': 'File to store errors',
- }, 'w': True, 'public': True, 'type': 'filename', 'generated': True,
+ }, 'w': False, 'public': True, 'type': 'filename', 'generated': True,
},
'P_script': {
'descriptions': { 'si': 'Ime skripte', 'en': 'Filename of the script',
@@ -116,7 +98,7 @@ def task(student_IP, net_prog_name,
conn = pxssh.pxssh()
conn.login(student_IP, 'student', 'vaje')
results = dict()
- r = random.Random(param_gen_seed)
+ r = random.Random(int(param_gen_seed))
env_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in xrange(11)])
arg_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in xrange(13)])
@@ -167,23 +149,22 @@ def task_check(results, params):
arg_len = len(arg)
env_len = len(var)
for i in xrange(100):
- s_out += chr(20 + (ord(arg[i % arg_len]) ^ ord(var[i % env_len]) % 64))
+ s_out += chr(32 + ((ord(arg[i % arg_len]) ^ ord(var[i % env_len])) % 64))
r += ord(arg[i % arg_len]) + ord(var[i % env_len]) + i;
if (i % 20 == 0):
s_out += "RAUS\r\n";
if (i % 31 == 0):
s_out += 'ma'
- s_err += chr(r % 32 + ord('A'));
+ s_err += chr((r % 32) + ord('A'));
if (i % 23 == 0):
s_err += "PATACIS\r\n"
retval = r % 16
s_err += '\r\n'
s_out += '\r\n'
return(s_out, s_err, retval)
-
score = 0
hints = []
- r = random.Random(params['param_gen_seed'])
+ r = random.Random(int(params['param_gen_seed']))
env_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in xrange(11)])
arg_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in xrange(13)])
stdin_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in xrange(17)])
@@ -191,6 +172,7 @@ def task_check(results, params):
params['arg_c'], env_val
)
expected_script_stderr = 'cat {}\r\n'.format(params['out_stderr_c']) + expected_script_stderr
+ # hints += [expected_script_stderr, results['script_run'], results['script_stderr'], params['arg_c'], env_val]
if expected_script_stderr != results['script_stderr']:
hints += ['wrong script stderr']
else:
@@ -239,7 +221,7 @@ int main(int argc, char **argv){
env_len = strlen(var);
r = 0;
for (i = 0; i<100; i++){
- printf("%c", 20 + (arg[i % arg_len] ^ var[i % env_len] % 64));
+ printf("%c", 32 + (arg[i % arg_len] ^ var[i % env_len]) % 64);
r += (int)arg[i % arg_len] + (int)var[i % env_len] + i;
if (i % 20 == 0){
printf("RAUS\\n");
@@ -279,7 +261,6 @@ done
destroyed_c_source += 'QX'
destroyed_c_source += c
d.write(params['P_c'], destroyed_c_source)
- print params['P_c']
d.chown(1000, 1000, params['P_c'])
sh_path ='/usr/local/bin/' + params['net_prog_name']
d.write(sh_path, evil_shell_source)