Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
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
jumpserver
Commits
46245ab4
Commit
46245ab4
authored
Nov 26, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix record bug
parent
2c0d42e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
connect.py
connect.py
+1
-3
log_api.py
jlog/log_api.py
+6
-2
run_websocket.py
run_websocket.py
+1
-2
No files found.
connect.py
View file @
46245ab4
...
@@ -204,7 +204,6 @@ class Tty(object):
...
@@ -204,7 +204,6 @@ class Tty(object):
log
.
save
()
log
.
save
()
log_file_f
.
write
(
'Start at
%
s
\n
'
%
datetime
.
datetime
.
now
())
log_file_f
.
write
(
'Start at
%
s
\n
'
%
datetime
.
datetime
.
now
())
log_time_f
.
write
(
'0.0000 '
)
return
log_file_f
,
log_time_f
,
log
return
log_file_f
,
log_time_f
,
log
def
get_connect_info
(
self
):
def
get_connect_info
(
self
):
...
@@ -326,7 +325,7 @@ class SshTty(Tty):
...
@@ -326,7 +325,7 @@ class SshTty(Tty):
sys
.
stdout
.
write
(
x
)
sys
.
stdout
.
write
(
x
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
now_timestamp
=
time
.
time
()
now_timestamp
=
time
.
time
()
log_time_f
.
write
(
'
%
s
\n
%
s '
%
(
len
(
x
),
round
(
now_timestamp
-
pre_timestamp
,
4
)))
log_time_f
.
write
(
'
%
s
%
s
\n
'
%
(
round
(
now_timestamp
-
pre_timestamp
,
4
),
len
(
x
)))
log_file_f
.
write
(
x
)
log_file_f
.
write
(
x
)
pre_timestamp
=
now_timestamp
pre_timestamp
=
now_timestamp
log_file_f
.
flush
()
log_file_f
.
flush
()
...
@@ -363,7 +362,6 @@ class SshTty(Tty):
...
@@ -363,7 +362,6 @@ class SshTty(Tty):
finally
:
finally
:
termios
.
tcsetattr
(
sys
.
stdin
,
termios
.
TCSADRAIN
,
old_tty
)
termios
.
tcsetattr
(
sys
.
stdin
,
termios
.
TCSADRAIN
,
old_tty
)
log_time_f
.
write
(
'0'
)
log_file_f
.
write
(
'End time is
%
s'
%
datetime
.
datetime
.
now
())
log_file_f
.
write
(
'End time is
%
s'
%
datetime
.
datetime
.
now
())
log_file_f
.
close
()
log_file_f
.
close
()
log_time_f
.
close
()
log_time_f
.
close
()
...
...
jlog/log_api.py
View file @
46245ab4
...
@@ -43,14 +43,18 @@ def scriptToJSON(scriptf, timing=None):
...
@@ -43,14 +43,18 @@ def scriptToJSON(scriptf, timing=None):
scriptf
.
readline
()
# ignore first header line from script file
scriptf
.
readline
()
# ignore first header line from script file
offset
=
0
offset
=
0
for
t
in
timing
:
for
t
in
timing
:
data
=
escapeString
(
scriptf
.
read
(
t
[
1
]))
dt
=
scriptf
.
read
(
t
[
1
])
print
"##
%
s:
%
s"
%
(
t
,
dt
)
data
=
escapeString
(
dt
)
offset
+=
t
[
0
]
offset
+=
t
[
0
]
ret
.
append
((
data
,
offset
))
ret
.
append
((
data
,
offset
))
print
ret
return
dumps
(
ret
)
return
dumps
(
ret
)
def
renderTemplate
(
script_path
,
time_file_path
,
dimensions
=
(
24
,
80
),
templatename
=
DEFAULT_TEMPLATE
):
def
renderTemplate
(
script_path
,
time_file_path
,
dimensions
=
(
24
,
80
),
templatename
=
DEFAULT_TEMPLATE
):
with
copen
(
script_path
,
encoding
=
'utf-8'
,
errors
=
'replace'
)
as
scriptf
:
#with copen(script_path, encoding='utf-8', errors='replace') as scriptf:
with
open
(
script_path
)
as
scriptf
:
with
open
(
time_file_path
)
as
timef
:
with
open
(
time_file_path
)
as
timef
:
timing
=
getTiming
(
timef
)
timing
=
getTiming
(
timef
)
json
=
scriptToJSON
(
scriptf
,
timing
)
json
=
scriptToJSON
(
scriptf
,
timing
)
...
...
run_websocket.py
View file @
46245ab4
...
@@ -312,7 +312,6 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
...
@@ -312,7 +312,6 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
self
.
log
.
is_finished
=
True
self
.
log
.
is_finished
=
True
self
.
log
.
end_time
=
datetime
.
datetime
.
now
()
self
.
log
.
end_time
=
datetime
.
datetime
.
now
()
self
.
log
.
save
()
self
.
log
.
save
()
self
.
log_time_f
.
write
(
'0'
)
self
.
log_time_f
.
close
()
self
.
log_time_f
.
close
()
self
.
close
()
self
.
close
()
except
AttributeError
:
except
AttributeError
:
...
@@ -336,7 +335,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
...
@@ -336,7 +335,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
try
:
try
:
self
.
write_message
(
json
.
dumps
({
'data'
:
data
}))
self
.
write_message
(
json
.
dumps
({
'data'
:
data
}))
now_timestamp
=
time
.
time
()
now_timestamp
=
time
.
time
()
self
.
log_time_f
.
write
(
'
%
s
\n
%
s '
%
(
len
(
data
),
round
(
now_timestamp
-
pre_timestamp
,
4
)))
self
.
log_time_f
.
write
(
'
%
s
%
s
\n
'
%
(
round
(
now_timestamp
-
pre_timestamp
,
4
),
len
(
data
)))
self
.
log_file_f
.
write
(
data
)
self
.
log_file_f
.
write
(
data
)
pre_timestamp
=
now_timestamp
pre_timestamp
=
now_timestamp
self
.
log_file_f
.
flush
()
self
.
log_file_f
.
flush
()
...
...
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