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
b2ccbc3f
Commit
b2ccbc3f
authored
Mar 18, 2016
by
kelianchun_miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pull issue #120
parent
7dcf050d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
connect.py
connect.py
+6
-3
No files found.
connect.py
View file @
b2ccbc3f
...
...
@@ -92,8 +92,8 @@ class Tty(object):
self
.
remote_ip
=
''
self
.
login_type
=
login_type
self
.
vim_flag
=
False
self
.
ps1_pattern
=
re
.
compile
(
'
\
[
.*@.*
\
]
[
\
$#]
\
s'
)
self
.
vim_pattern
=
re
.
compile
(
r'\W
vi[m]+\s.* | \W
fg\s.*'
,
re
.
X
)
self
.
ps1_pattern
=
re
.
compile
(
'
\
[
?.*@.*
\
]?
[
\
$#]
\
s'
)
self
.
vim_pattern
=
re
.
compile
(
r'\W
?vi[m]?\s.* | \W?
fg\s.*'
,
re
.
X
)
self
.
vim_data
=
''
self
.
stream
=
None
self
.
screen
=
None
...
...
@@ -141,6 +141,7 @@ class Tty(object):
:return:返回最后的处理结果
"""
command
=
''
try
:
self
.
stream
.
feed
(
data
)
# 从虚拟屏幕中获取处理后的数据
for
line
in
reversed
(
self
.
screen
.
buffer
):
...
...
@@ -160,6 +161,8 @@ class Tty(object):
self
.
vim_flag
=
True
# 虚拟屏幕清空
self
.
screen
.
reset
()
except
Exception
:
pass
return
command
def
get_log
(
self
):
...
...
@@ -403,7 +406,7 @@ class SshTty(Tty):
# 获取连接的隧道并设置窗口大小 Make a channel and set windows size
global
channel
win_size
=
self
.
get_win_size
()
#self.channel = channel = ssh.invoke_shell(height=win_size[0], width=win_size[1], term='xterm')
#
self.channel = channel = ssh.invoke_shell(height=win_size[0], width=win_size[1], term='xterm')
self
.
channel
=
channel
=
transport
.
open_session
()
channel
.
get_pty
(
term
=
'xterm'
,
height
=
win_size
[
0
],
width
=
win_size
[
1
])
channel
.
invoke_shell
()
...
...
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