summaryrefslogtreecommitdiffstats
path: root/src/HTTPParser.py
diff options
context:
space:
mode:
authorAlvaro Neira Ayuso <aneira@soleta.eu>2020-01-14 18:35:47 +0100
committerAlvaro Neira Ayuso <alvaroneay@gmail.com>2020-01-19 19:50:44 +0100
commita9d81adb1f0e77bfae8a462d509206d43809f7a8 (patch)
tree8202689593429cbf906a70d28c0f4761bd471304 /src/HTTPParser.py
parent336b02371df2dcce36fbe41531309c045ecbb4c1 (diff)
Include echo option for returning shell output
This patch adds a new echo option in /shell/run command. In case that the option is set up to true, the server will receive in the response a json with the shell output. Otherwise, the server will receive a response message without json body. A side effect of this change is that the command /shell/output/ disapears.
Diffstat (limited to 'src/HTTPParser.py')
-rw-r--r--src/HTTPParser.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/HTTPParser.py b/src/HTTPParser.py
index 819cd74..c422c12 100644
--- a/src/HTTPParser.py
+++ b/src/HTTPParser.py
@@ -23,6 +23,7 @@ class HTTPParser:
self.type = None
self.profile = None
self.id = None
+ self.echo = None
def parser(self,data):
self.requestLine, self.headersAlone = data.split('\n', 1)
@@ -52,6 +53,10 @@ class HTTPParser:
if "run" in cmd:
self.cmd = jsoncmd["run"]
+ try:
+ self.echo = jsoncmd["echo"]
+ except:
+ pass
if "disk" in cmd:
self.disk = jsoncmd["disk"]
@@ -140,3 +145,6 @@ class HTTPParser:
def getId(self):
return self.id
+
+ def getEcho(self):
+ return self.echo