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
01d6f751
Commit
01d6f751
authored
9 years ago
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决实时监控特殊字符,使用term.js
parent
9a897e0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
32 deletions
+45
-32
connect.py
connect.py
+2
-2
log_online.html
templates/jlog/log_online.html
+43
-30
No files found.
connect.py
View file @
01d6f751
...
...
@@ -430,8 +430,8 @@ class Jtty(object):
time
.
sleep
(
1
)
tmp
=
channel
.
recv
(
1024
)
#print 'ok'+tmp+'ok'
SSH_TTY
=
re
.
search
(
r'(?<=/dev/).*'
,
tmp
)
.
group
()
.
strip
()
#
SSH_TTY = re.search(r'(?<=/dev/).*', tmp).group().strip()
SSH_TTY
=
''
channel
.
send
(
'clear
\n
'
)
# Make ssh interactive tunnel
self
.
posix_shell
(
ssh
)
...
...
This diff is collapsed.
Click to expand it.
templates/jlog/log_online.html
View file @
01d6f751
{% extends 'base.html' %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<style>
{% block self_head_css_js %}
<style>
.terminal
{
border
:
#000
solid
5px
;
font-family
:
"Monaco"
,
"DejaVu Sans Mono"
,
"Liberation Mono"
,
monospace
;
font-size
:
11px
;
color
:
#f0f0f0
;
background
:
rgba
(
0
,
0
,
0
,
0.6
);
width
:
600px
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.6
)
2px
2px
20px
;
}
.reverse-video
{
color
:
#000
;
background
:
#f0f0f0
;
}
.bootstrap-dialog-body
{
background-color
:
rgba
(
0
,
0
,
0
,
0
);
}
...
...
@@ -12,7 +26,7 @@
background-color
:
rgba
(
0
,
0
,
0
,
1
);
}
.modal-content
{
background-color
:
rgba
(
0
,
0
,
0
,
0.6
)
;
background-color
:
#000
;
}
.modal-dialog
{
background-color
:
rgba
(
0
,
0
,
0
,
0
);
...
...
@@ -24,7 +38,12 @@
.modal-header
{
background-color
:
#FFFFFF
;
}
</style>
</style>
<script
src=
"/static/js/term.js"
></script>
{% endblock %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
...
...
@@ -104,8 +123,6 @@
{
#
window
.
open
(
'/jlog/monitor/'
,
'监控'
,
'height=500, width=910, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no'
);
#
}
{
#
})
#
}
{
#
});
#
}
function
init
(
obj
){
var
file_path
=
obj
.
attr
(
'file_path'
);
var
wsUri
=
'{{ web_monitor_uri }}'
;
...
...
@@ -121,31 +138,27 @@
var
username
=
obj
.
closest
(
'tr'
).
find
(
'#username'
).
text
();
var
ip
=
obj
.
closest
(
'tr'
).
find
(
'#ip'
).
text
();
BootstrapDialog
.
show
({
message
:
function
(){
var
tag
=
$
(
'<pre id="log" style="height: 500px;overflow: auto;background-color: rgba(0, 0, 0, 0);line-height: 0.8; border: none"></pre>'
);
{
#
document
.
cookie
.
split
(
'; '
).
forEach
(
function
(
obj
){
#
}
{
#
var
info
=
obj
.
split
(
'='
);
#
}
{
#
if
(
info
.
length
==
2
){
#
}
{
#
if
(
info
[
0
]
==
'username'
){
#
}
{
#
username
=
info
[
1
];
#
}
{
#
}
else
if
(
info
[
0
]
==
'seed'
){
#
}
{
#
seed
=
info
[
1
];
#
}
{
#
}
#
}
{
#
}
#
}
{
#
});
#
}
BootstrapDialog
.
show
({
message
:
function
(){
//服务器端认证
{
#
socket
.
send
(
'login'
,
{
userid
:
message
.
id
,
filename
:
message
.
filename
,
username
:
username
,
seed
:
seed
});
#
}
socket
.
onmessage
=
function
(
evt
){
var
control_regx
=
/
\x
1B
\[([
0-9
]{1,3}((
;
[
0-9
]{1,3})
*
)?)?[
m|K
]
/g
;
var
newline_regx
=
/
\n
|
\r
|
(\r\n)
|
(\u
0085
)
|
(\u
2028
)
|
(\u
2029
)
/g
;
{
#
if
(
option
==
'new'
)
{
#
}
tag
.
append
(
evt
.
data
.
replace
(
newline_regx
,
'<br />'
).
replace
(
control_regx
,
''
));
{
#
}
else
if
(
option
==
'exist'
)
{
#
}
{
#
tag
.
append
(
'<pre>'
+
exsit_message
+
'</pre>'
);
#
}
{
#
}
#
}
tag
.
animate
({
scrollTop
:
tag
[
0
].
scrollHeight
},
1
);
};
var
term
=
new
Terminal
({
cols
:
80
,
rows
:
24
,
screenKeys
:
false
});
var
tag
=
$
(
'<div id="term" style="height:500px; overflow: auto;background-color: rgba(0, 0, 0, 0);border: none"></div>'
);
term
.
open
();
term
.
resize
(
80
,
24
);
window
.
setTimeout
(
function
(){
$
(
'.terminal'
).
detach
().
appendTo
(
'#term'
);
socket
.
onmessage
=
function
(
evt
){
term
.
write
(
evt
.
data
);
}},
1000
);
tag
[
0
].
style
.
color
=
"#00FF00"
;
return
tag
[
0
];
...
...
@@ -158,7 +171,7 @@
$
(
document
).
ready
(
function
(){
$
(
'.monitor'
).
click
(
function
(){
init
(
$
(
this
))
init
(
$
(
this
))
;
});
$
(
'.log_command'
).
on
(
'click'
,
function
(){
...
...
This diff is collapsed.
Click to expand it.
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