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
ba5e90ab
Commit
ba5e90ab
authored
Mar 24, 2016
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
357aea16
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
10 deletions
+17
-10
views.py
jlog/views.py
+1
-1
run_server.py
run_server.py
+7
-1
webterminal.js
static/js/webterminal.js
+9
-8
No files found.
jlog/views.py
View file @
ba5e90ab
...
@@ -183,7 +183,7 @@ class TermLogRecorder(object):
...
@@ -183,7 +183,7 @@ class TermLogRecorder(object):
self
.
user
=
None
self
.
user
=
None
self
.
recoderStartTime
=
time
.
time
()
self
.
recoderStartTime
=
time
.
time
()
self
.
__init_screen_stream
()
self
.
__init_screen_stream
()
self
.
recoder
=
Tru
e
self
.
recoder
=
Fals
e
self
.
commands
=
[]
self
.
commands
=
[]
self
.
_lists
=
None
self
.
_lists
=
None
self
.
file
=
None
self
.
file
=
None
...
...
run_server.py
View file @
ba5e90ab
...
@@ -35,10 +35,12 @@ except ImportError:
...
@@ -35,10 +35,12 @@ except ImportError:
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
'jumpserver.settings'
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
'jumpserver.settings'
from
jumpserver.settings
import
IP
,
PORT
from
jumpserver.settings
import
IP
,
PORT
define
(
"port"
,
default
=
PORT
,
help
=
"run on the given port"
,
type
=
int
)
define
(
"port"
,
default
=
PORT
,
help
=
"run on the given port"
,
type
=
int
)
define
(
"host"
,
default
=
IP
,
help
=
"run port on given host"
,
type
=
str
)
define
(
"host"
,
default
=
IP
,
help
=
"run port on given host"
,
type
=
str
)
from
jlog.views
import
TermLogRecorder
from
jlog.views
import
TermLogRecorder
def
django_request_support
(
func
):
def
django_request_support
(
func
):
@functools.wraps
(
func
)
@functools.wraps
(
func
)
def
_deco
(
*
args
,
**
kwargs
):
def
_deco
(
*
args
,
**
kwargs
):
...
@@ -46,6 +48,7 @@ def django_request_support(func):
...
@@ -46,6 +48,7 @@ def django_request_support(func):
response
=
func
(
*
args
,
**
kwargs
)
response
=
func
(
*
args
,
**
kwargs
)
request_finished
.
send_robust
(
func
)
request_finished
.
send_robust
(
func
)
return
response
return
response
return
_deco
return
_deco
...
@@ -83,6 +86,7 @@ def require_auth(role='user'):
...
@@ -83,6 +86,7 @@ def require_auth(role='user'):
logger
.
warning
(
'Websocket: Request auth failed.'
)
logger
.
warning
(
'Websocket: Request auth failed.'
)
return
_deco2
return
_deco2
return
_deco
return
_deco
...
@@ -340,6 +344,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
...
@@ -340,6 +344,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
self
.
term
.
remote_ip
=
self
.
request
.
remote_ip
self
.
term
.
remote_ip
=
self
.
request
.
remote_ip
self
.
ssh
=
self
.
term
.
get_connection
()
self
.
ssh
=
self
.
term
.
get_connection
()
self
.
channel
=
self
.
ssh
.
invoke_shell
(
term
=
'xterm'
)
self
.
channel
=
self
.
ssh
.
invoke_shell
(
term
=
'xterm'
)
self
.
channel
.
resize_pty
(
80
,
24
)
WebTerminalHandler
.
tasks
.
append
(
MyThread
(
target
=
self
.
forward_outbound
))
WebTerminalHandler
.
tasks
.
append
(
MyThread
(
target
=
self
.
forward_outbound
))
WebTerminalHandler
.
clients
.
append
(
self
)
WebTerminalHandler
.
clients
.
append
(
self
)
...
@@ -421,7 +426,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
...
@@ -421,7 +426,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
self
.
termlog
.
write
(
data
)
self
.
termlog
.
write
(
data
)
self
.
termlog
.
recoder
=
False
self
.
termlog
.
recoder
=
False
now_timestamp
=
time
.
time
()
now_timestamp
=
time
.
time
()
self
.
log_time_f
.
write
(
'
%
s
%
s
\n
'
%
(
round
(
now_timestamp
-
pre_timestamp
,
4
),
len
(
data
)))
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
()
...
@@ -481,6 +486,7 @@ def main():
...
@@ -481,6 +486,7 @@ def main():
tornado
.
ioloop
.
IOLoop
.
instance
()
.
start
()
tornado
.
ioloop
.
IOLoop
.
instance
()
.
start
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
# tornado.options.parse_command_line()
# tornado.options.parse_command_line()
# app = Application()
# app = Application()
...
...
static/js/webterminal.js
View file @
ba5e90ab
...
@@ -104,13 +104,13 @@ $(document).ready(function () {
...
@@ -104,13 +104,13 @@ $(document).ready(function () {
$
(
'#ssh'
).
show
();
$
(
'#ssh'
).
show
();
var
term_client
=
openTerminal
(
options
);
var
term_client
=
openTerminal
(
options
);
console
.
log
(
rowHeight
);
console
.
log
(
rowHeight
);
// by liuzheng712 because it will bring record bug
window
.
onresize
=
function
()
{
//
window.onresize = function () {
var
geom
=
resize
();
//
var geom = resize();
console
.
log
(
geom
);
//
console.log(geom);
term_client
.
term
.
resize
(
geom
.
cols
,
geom
.
rows
);
//
term_client.term.resize(geom.cols, geom.rows);
term_client
.
client
.
send
({
'resize'
:
{
'rows'
:
geom
.
rows
,
'cols'
:
geom
.
cols
}});
//
term_client.client.send({'resize': {'rows': geom.rows, 'cols': geom.cols}});
$
(
'#ssh'
).
show
();
//
$('#ssh').show();
}
//
}
});
});
\ No newline at end of file
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