summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/radius_mysql_pam
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-06 23:56:03 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-07 01:55:26 +0200
commit9c51bbe5016495c714789f5df01806a6d366e11a (patch)
tree19be73e896838cfbe3e87b04bd63c9fdd930c27e /kpov_judge/tasks/radius_mysql_pam
parente33085889f26c76587fdab2ad600ed336dc028b5 (diff)
Rename kpov_random_helpers to kpov_util
Diffstat (limited to 'kpov_judge/tasks/radius_mysql_pam')
-rw-r--r--kpov_judge/tasks/radius_mysql_pam/task.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/kpov_judge/tasks/radius_mysql_pam/task.py b/kpov_judge/tasks/radius_mysql_pam/task.py
index a3f86f7..1a11ef8 100644
--- a/kpov_judge/tasks/radius_mysql_pam/task.py
+++ b/kpov_judge/tasks/radius_mysql_pam/task.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# kpov_random_helpers should be imported by add_assignment.py
+# kpov_util should be imported by add_assignment.py
instructions = {
'si':"""
@@ -105,9 +105,9 @@ def task(IP_RS, RADIUS_SECRET, RADIUS_USERNAME, RADIUS_PASSWORD, MYSQL_DB_NAME,
peer_user = 'student'
peer_passwd = 'vaje'
r = random.Random(MYSQL_SEED)
- MYSQL_TEST_USER = kpov_random_helpers.username_gen(r)
- MYSQL_TEST_PASSWORD = kpov_random_helpers.alnum_gen(r, 7)
- RADIUS_NEW_PASSWORD = kpov_random_helpers.alnum_gen(r, 7)
+ MYSQL_TEST_USER = kpov_util.username_gen(r)
+ MYSQL_TEST_PASSWORD = kpov_util.alnum_gen(r, 7)
+ RADIUS_NEW_PASSWORD = kpov_util.alnum_gen(r, 7)
# Testiranje radius strtežnika
results['Test_RadiusServer'] = pexpect.run('radtest {0} {1} {2} 1812 {3}'.format(
RADIUS_USERNAME, RADIUS_PASSWORD, IP_RS, RADIUS_SECRET))
@@ -144,12 +144,12 @@ def task(IP_RS, RADIUS_SECRET, RADIUS_USERNAME, RADIUS_PASSWORD, MYSQL_DB_NAME,
def gen_params(user_id, params_meta):
params = dict()
r = random.Random(user_id)
- params['RADIUS_SECRET'] = kpov_random_helpers.alnum_gen(r, 8)
- params['RADIUS_PASSWORD'] = kpov_random_helpers.alnum_gen(r, 8)
- params['RADIUS_USERNAME'] = kpov_random_helpers.username_gen(r)
- params['MYSQL_ADMIN_USER'] = kpov_random_helpers.alnum_gen(r, 6)
- params['MYSQL_ADMIN_PASSWORD'] = kpov_random_helpers.alnum_gen(r, 6)
- params['MYSQL_DB_NAME'] = kpov_random_helpers.alnum_gen(r, 4)
+ params['RADIUS_SECRET'] = kpov_util.alnum_gen(r, 8)
+ params['RADIUS_PASSWORD'] = kpov_util.alnum_gen(r, 8)
+ params['RADIUS_USERNAME'] = kpov_util.username_gen(r)
+ params['MYSQL_ADMIN_USER'] = kpov_util.alnum_gen(r, 6)
+ params['MYSQL_ADMIN_PASSWORD'] = kpov_util.alnum_gen(r, 6)
+ params['MYSQL_DB_NAME'] = kpov_util.alnum_gen(r, 4)
params['MYSQL_SEED'] = str(r.random())
return params
@@ -159,9 +159,9 @@ def task_check(results, params):
score = 0
hints = []
r = random.Random(params['MYSQL_SEED'])
- MYSQL_TEST_USER = kpov_random_helpers.username_gen(r)
- MYSQL_TEST_PASSWORD = kpov_random_helpers.alnum_gen(r, 7)
- RADIUS_NEW_PASSWORD = kpov_random_helpers.alnum_gen(r, 7)
+ MYSQL_TEST_USER = kpov_util.username_gen(r)
+ MYSQL_TEST_PASSWORD = kpov_util.alnum_gen(r, 7)
+ RADIUS_NEW_PASSWORD = kpov_util.alnum_gen(r, 7)
s = r"Sent Access-Request Id [0-9]+ from ([0-9]|\.)+:[0-9]+ to {IP_RS}:1812 length [0-9]+\r\n\tUser-Name = \"{RADIUS_USERNAME}\"\r\n\tUser-Password = \"{RADIUS_PASSWORD}\".*Access-Accept Id [0-9]+ from {IP_RS}".format(**params)
#with open('test.pickle', 'w') as f:
# pickle.dump({'pattern': s, 'res': results['Test_RadiusServer']}, f)