#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 time
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
import urllib
|
||||||
|
|
||||||
# Error handler decorator.
|
# Error handler decorator.
|
||||||
def catchBackgroundError(fnc):
|
def catchBackgroundError(fnc):
|
||||||
|
@ -106,10 +107,12 @@ class OpenGnSysWorker(ServerWorker):
|
||||||
if secret != self.random:
|
if secret != self.random:
|
||||||
logger.error('Unauthorized operation.')
|
logger.error('Unauthorized operation.')
|
||||||
raise Exception('Unauthorized operation')
|
raise Exception('Unauthorized operation')
|
||||||
# Executing script
|
# Decoding script.
|
||||||
script = postParams.get('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':
|
if postParams.get('client', 'false') == 'false':
|
||||||
thr = ScriptExecutorThread(script=script.decode('base64'))
|
thr = ScriptExecutorThread(script)
|
||||||
thr.start()
|
thr.start()
|
||||||
else:
|
else:
|
||||||
self.sendScriptMessage(script)
|
self.sendScriptMessage(script)
|
||||||
|
|
Loading…
Reference in New Issue