summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/basic_network_gcc
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-09-26 16:23:29 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-09-26 16:23:29 +0200
commit03c9d6d8441e3293b058fed270866419781b734c (patch)
treea456f12f5c26c836685c6e47c95cfe2897e43723 /kpov_judge/tasks/basic_network_gcc
parent3938c69f3e1586c1ffbcae5395414ca8480e6ba4 (diff)
Run 2to3
Some stuff is broken now.
Diffstat (limited to 'kpov_judge/tasks/basic_network_gcc')
-rw-r--r--kpov_judge/tasks/basic_network_gcc/task.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/kpov_judge/tasks/basic_network_gcc/task.py b/kpov_judge/tasks/basic_network_gcc/task.py
index eeb7d1c..ae690f0 100644
--- a/kpov_judge/tasks/basic_network_gcc/task.py
+++ b/kpov_judge/tasks/basic_network_gcc/task.py
@@ -8,7 +8,7 @@
# - switch to a real SSH/SFTP client to properly handle filenames
instructions = {
- 'si': u'''
+ 'si': '''
Postavite dva navidezna računalnika - SimpleArbiter in Student.
Oba naj bosta povezana na internet. Poleg tega mora biti
Student na naslovu {student_IP} dostopen s SimpleArbiter.
@@ -31,7 +31,7 @@ Napišite skripto ali program {P_script} v domačem imeniku uporabnika student,
Lastnik vseh ustvarjenih datotek mora biti uporabnik student.
Gesla uporabnika student (vaje) ne smete spreminjati.''',
- 'en': u'''
+ 'en': '''
''',
}
@@ -124,10 +124,10 @@ def task(student_IP, net_prog_name,
conn.login(student_IP, 'student', 'vaje')
results = dict()
r = random.Random(int(param_gen_seed))
- env_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in xrange(11)])
+ env_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(11)])
- arg_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in xrange(13)])
- stdin_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in xrange(17)])
+ arg_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(13)])
+ stdin_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(17)])
conn.sendline('ls -l {}'.format(P_script))
conn.prompt()
results['script_ls'] = conn.before
@@ -157,8 +157,8 @@ def gen_params(user_id, params_meta):
r = random.Random(user_id+'evil cornholio')
params = kpov_random_helpers.default_gen(user_id, params_meta)
homedir = '/home/student/'
- params['env_c'] = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ') for i in xrange(5)])
- params['P_c'] = "".join([r.choice('abcdefghijklmnoprst') for i in xrange(5)]) + ".c"
+ params['env_c'] = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ') for i in range(5)])
+ params['P_c'] = "".join([r.choice('abcdefghijklmnoprst') for i in range(5)]) + ".c"
params['param_gen_seed'] = str(r.randint(0, 2**24))
params['c_destroy_gen_seed'] = str(r.randint(0, 2**24))
dest_net = kpov_random_helpers.IPv4_subnet_gen(r, '10.0.2.128/26', 26)
@@ -175,7 +175,7 @@ def task_check(results, params):
r = 0
arg_len = len(arg)
env_len = len(var)
- for i in xrange(100):
+ for i in range(100):
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 % 17 == 0):
@@ -192,9 +192,9 @@ def task_check(results, params):
score = 0
hints = []
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)])
+ env_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(11)])
+ arg_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(13)])
+ stdin_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(17)])
expected_script_stdout, expected_script_stderr, rval = test_out_gen(
params['arg_c'], env_val
)
@@ -292,7 +292,7 @@ done; }&
sh_path = r.choice(['/usr/share/doc', '/var/lib', '/usr/local/share', '/etc/alternatives'])
sh_file = sh_path + '/' + params['net_prog_name']
d.write(sh_file, evil_shell_source)
- d.chmod(0775, sh_file)
+ d.chmod(0o775, sh_file)
d.write("/etc/rc.local", """#!/bin/sh -e
export PATH=$PATH:{}
{} &