From 9c51bbe5016495c714789f5df01806a6d366e11a Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sat, 6 Oct 2018 23:56:03 +0200 Subject: Rename kpov_random_helpers to kpov_util --- kpov_judge/tasks/ldap_search/task.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'kpov_judge/tasks/ldap_search/task.py') diff --git a/kpov_judge/tasks/ldap_search/task.py b/kpov_judge/tasks/ldap_search/task.py index 886bf07..43704e3 100644 --- a/kpov_judge/tasks/ldap_search/task.py +++ b/kpov_judge/tasks/ldap_search/task.py @@ -1,7 +1,7 @@ #!/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 # Poveži se na strežnik LDAP prek spletnega vmesnika. Ustvari uporabnika z danim imenom in geslom. # Napiši skripto, ki izpiše podatke o tem uporabniku z ldapsearch. # @@ -118,7 +118,7 @@ def task(LDAP_IP, DOMAIN, LDAP_USERNAME, LDAP_PASSWORD, BIND_USERNAME, BIND_PASS s = "ldapmodify -D {BIND_DN} -w {BIND_PASSWORD} -h {LDAP_IP}".format( **locals()) modify = pexpect.spawn(s) - FORTUNE = kpov_random_helpers.hostname_gen(random.Random(str(LDAP_USERNAME))) + FORTUNE = kpov_util.hostname_gen(random.Random(str(LDAP_USERNAME))) results['fortune'] = FORTUNE s1 = """ dn: cn={LDAP_USERNAME},ou=Users,{FULLDOMAIN} @@ -138,11 +138,11 @@ description: {FORTUNE} def gen_params(user_id, params_meta): params = dict() r = random.Random(user_id) - params['DOMAIN'] = kpov_random_helpers.hostname_gen(r) - params['LDAP_USERNAME'] = kpov_random_helpers.username_gen(r) - params['LDAP_PASSWORD'] = kpov_random_helpers.alnum_gen(r, 6) - params['BIND_USERNAME'] = kpov_random_helpers.username_gen(r) - params['BIND_PASSWORD'] = kpov_random_helpers.alnum_gen(r, 6) + params['DOMAIN'] = kpov_util.hostname_gen(r) + params['LDAP_USERNAME'] = kpov_util.username_gen(r) + params['LDAP_PASSWORD'] = kpov_util.alnum_gen(r, 6) + params['BIND_USERNAME'] = kpov_util.username_gen(r) + params['BIND_PASSWORD'] = kpov_util.alnum_gen(r, 6) return params def task_check(results, params): @@ -164,7 +164,7 @@ objectClass: organization\r score += 2 else: hints += ["LDAP_USERNAME missing in: " + s + str(results['ldapsearch_before'])] - fortune = kpov_random_helpers.hostname_gen(random.Random(str(params['LDAP_USERNAME']))) + fortune = kpov_util.hostname_gen(random.Random(str(params['LDAP_USERNAME']))) s = ".*cn: {0}.*description: {1}.*".format( re.escape(params['LDAP_USERNAME']), re.escape(fortune)) if re.match(s, results['ldapsearch_after'], re.DOTALL): -- cgit v1.2.1 From 3091fc2877600f7926ed6a596c316183499125f8 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 7 Oct 2018 19:11:49 +0200 Subject: Remove coding: lines Python 3 source is utf-8 by default. --- kpov_judge/tasks/ldap_search/task.py | 1 - 1 file changed, 1 deletion(-) (limited to 'kpov_judge/tasks/ldap_search/task.py') diff --git a/kpov_judge/tasks/ldap_search/task.py b/kpov_judge/tasks/ldap_search/task.py index 43704e3..da9f913 100644 --- a/kpov_judge/tasks/ldap_search/task.py +++ b/kpov_judge/tasks/ldap_search/task.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # kpov_util should be imported by add_assignment.py # Poveži se na strežnik LDAP prek spletnega vmesnika. Ustvari uporabnika z danim imenom in geslom. -- cgit v1.2.1 From dbf585c2a59dbcb7f6d803d5756826b562cd7f43 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 7 Oct 2018 19:38:40 +0200 Subject: Fix or remove hashbangs --- kpov_judge/tasks/ldap_search/task.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'kpov_judge/tasks/ldap_search/task.py') diff --git a/kpov_judge/tasks/ldap_search/task.py b/kpov_judge/tasks/ldap_search/task.py index da9f913..92a7223 100644 --- a/kpov_judge/tasks/ldap_search/task.py +++ b/kpov_judge/tasks/ldap_search/task.py @@ -1,9 +1,8 @@ -#!/usr/bin/env python - # kpov_util should be imported by add_assignment.py + # Poveži se na strežnik LDAP prek spletnega vmesnika. Ustvari uporabnika z danim imenom in geslom. # Napiši skripto, ki izpiše podatke o tem uporabniku z ldapsearch. -# + # TODO: finish this! instructions = { 'si':""" -- cgit v1.2.1