Commit c8b6f615 authored by ibuler's avatar ibuler

Merge branch 'dev' of github.com:jumpserver/coco into dev

parents eb62a381 15cfc4e7
This diff is collapsed.
......@@ -71,6 +71,7 @@ class Server:
Because we don't want to using python dynamic feature, such asset
have the chan and system_user attr.
"""
# Todo: Server name is not very suitable
def __init__(self, chan, asset, system_user):
self.chan = chan
......@@ -219,7 +220,7 @@ class WSProxy:
data = self.child.recv(BUF_SIZE)
if len(data) == 0:
self.close()
self.ws.write_message(json.dumps({"data": data.decode("utf-8")}))
self.ws.emit("data", data.decode("utf-8"))
def auto_forward(self):
thread = threading.Thread(target=self.forward, args=())
......
......@@ -73,18 +73,33 @@ class CommandRecorder(metaclass=abc.ABCMeta):
class ServerReplayRecorder(ReplayRecorder):
filelist = dict()
def record_replay(self, data_set):
"""
:param data_set:
[{
"session": session.id,
"data": data,
"timestamp": time.time()
},...]
:return:
"""
# Todo: <liuzheng712@gmail.com>
super().record_replay(data_set)
for data in data_set:
try:
ServerReplayRecorder.filelist[data["session"]].write(str(data) + '\n')
except KeyError:
logger.error("session ({})file does not exist!".format(data["session"]))
def session_start(self, session_id):
ServerReplayRecorder.filelist[session_id] = open('logs/' + session_id + '.log', 'a')
print("When session {} start exec".format(session_id))
def session_end(self, session_id):
ServerReplayRecorder.filelist[session_id].close()
# Todo: upload the file
print("When session {} end start".format(session_id))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment