From 8d2fe2f538bbba08178acea73f206f3ba5de6a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20M=2E=20G=C3=B3mez?= Date: Thu, 5 Mar 2020 08:14:28 +0100 Subject: [PATCH] #962: Fix bug when OGAgent processes script lines; now it's not necessary to use escape characters in script input box. --- src/opengnsys/modules/server/OpenGnSys/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opengnsys/modules/server/OpenGnSys/__init__.py b/src/opengnsys/modules/server/OpenGnSys/__init__.py index d9ea743..4e3c613 100644 --- a/src/opengnsys/modules/server/OpenGnSys/__init__.py +++ b/src/opengnsys/modules/server/OpenGnSys/__init__.py @@ -282,8 +282,8 @@ class OpenGnSysWorker(ServerWorker): logger.debug('Processing script request') # Decoding script script = urllib.unquote(post_params.get('script').decode('base64')).decode('utf8') - script = 'import subprocess;' +\ - ';'.join(['subprocess.check_output({},shell=True)'.format(c) for c in script.split('\n')]) + script = 'import subprocess;{0}'.format( + ';'.join(['subprocess.check_output({0},shell=True)'.format(repr(c)) for c in script.split('\n')])) # Executing script. if post_params.get('client', 'false') == 'false': thr = ScriptExecutorThread(script)