Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
coco
Commits
c8b6f615
Commit
c8b6f615
authored
Dec 17, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of github.com:jumpserver/coco into dev
parents
eb62a381
15cfc4e7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
httpd.py
coco/httpd.py
+0
-0
models.py
coco/models.py
+2
-1
record.py
coco/record.py
+15
-0
No files found.
coco/httpd.py
View file @
c8b6f615
This diff is collapsed.
Click to expand it.
coco/models.py
View file @
c8b6f615
...
...
@@ -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
=
())
...
...
coco/record.py
View file @
c8b6f615
...
...
@@ -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
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment