#718: Soportar comando Ejecutar Script en agente de sistema operativo.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5134 a21b9725-9963-47de-94b9-378ad31fedc9oglive
parent
4c0ad234ee
commit
157e9e72a0
|
@ -45,6 +45,7 @@ import platform
|
|||
import time
|
||||
import random
|
||||
import string
|
||||
import urllib
|
||||
|
||||
# Error handler decorator.
|
||||
def catchBackgroundError(fnc):
|
||||
|
@ -106,10 +107,12 @@ class OpenGnSysWorker(ServerWorker):
|
|||
if secret != self.random:
|
||||
logger.error('Unauthorized operation.')
|
||||
raise Exception('Unauthorized operation')
|
||||
# Executing script
|
||||
script = postParams.get('script')
|
||||
# Decoding script.
|
||||
script = urllib.unquote(postParams.get('script').decode('base64')).decode('utf8')
|
||||
script = 'import subprocess; subprocess.check_output("""{}""",shell=True)'.format(script)
|
||||
# Executing script.
|
||||
if postParams.get('client', 'false') == 'false':
|
||||
thr = ScriptExecutorThread(script=script.decode('base64'))
|
||||
thr = ScriptExecutorThread(script)
|
||||
thr.start()
|
||||
else:
|
||||
self.sendScriptMessage(script)
|
||||
|
|
Loading…
Reference in New Issue