From aec982694e1e6016ff04fd653746cb266374324a Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Thu, 22 Dec 2016 14:02:00 +0000 Subject: Added hints to radius_mysql_pam git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@375 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- kpov_judge/tasks/radius_mysql_pam/task.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'kpov_judge/tasks/radius_mysql_pam') diff --git a/kpov_judge/tasks/radius_mysql_pam/task.py b/kpov_judge/tasks/radius_mysql_pam/task.py index 7ea4b0c..04d4097 100644 --- a/kpov_judge/tasks/radius_mysql_pam/task.py +++ b/kpov_judge/tasks/radius_mysql_pam/task.py @@ -169,6 +169,7 @@ def task_check(results, params): # print "Test OK" score += 2 else: + hints.append('radtest output incorrect') print (results['Test_RadiusServer'], s) # Testiranje podatkovne base mysql s = "Welcome to the MySQL monitor.*Type 'help;' or '\\\\h' for help\\. Type '\\\\c' to clear the current input statement\\.\r\n" @@ -176,36 +177,42 @@ def task_check(results, params): # print "mysql_login OK" score += 1 else: + hints.append("mysql connection string incorrect") print (results['mysql_login'], s) s = " USE {MYSQL_DB_NAME}\r\nReading table information.*Database changed\r\n".format(**params) if re.search(s, results['database_connect'], flags=re.DOTALL): # print "database_connect OK" score += 1 else: + hints.append('mysql table information string incorrect') print (results['database_connect'],) s = " SELECT UserName, Value FROM radcheck;\r\n.*{RADIUS_USERNAME} *| *{RADIUS_PASSWORD}".format(**params) if re.search(s, results['select_from_users'], flags=re.DOTALL): # print "select_from_users OK" score += 2 else: + hints.append'mysql user entry in table check failed') print (results['select_from_users'], ) s = "Sending Access-Request of id [0-9]+ to {0} port 1812\r\n\tUser-Name = \"{1}\"\r\n\tUser-Password = \"{2}\".*Access-Accept packet from host {0}".format(params['IP_RS'], MYSQL_TEST_USER, MYSQL_TEST_PASSWORD) if re.search(s, results['radtest_OK'], flags=re.DOTALL): # print "radtest_OK OK" score += 2 else: + hints.append('radtest output incorrect') print (s, results['radtest_OK']) - s = "Sending Access-Request of id [0-9]+ to {0} port 1812\r\n\tUser-Name = \"{1}\"\r\n\tUser-Password = \"Flügzeug\".*rad_recv: Access-Reject packet from host {0}".format(params['IP_RS'], MYSQL_TEST_USER) + s = u"Sending Access-Request of id [0-9]+ to {0} port 1812\r\n\tUser-Name = \"{1}\"\r\n\tUser-Password = \"Flügzeug\".*rad_recv: Access-Reject packet from host {0}".format(params['IP_RS'], MYSQL_TEST_USER) if re.search(s, results['radtest_NOK'], flags=re.DOTALL): # print "radtest_NOK OK" score += 1 else: + hints.append('radtest negative output incorrect') print (results['radtest_NOK'], s) s = "{RADIUS_USERNAME}@.*:~\\$".format(**params) if re.search(s, results['login_test'], flags=re.DOTALL): # print "login_test OK" score += 1 else: + hints.append('login test failed') print (results['login_test'],s) return score, hints -- cgit v1.2.1