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
0c42d039
Commit
0c42d039
authored
Nov 22, 2015
by
kelianchun_miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update connect.py
parent
55503c89
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
connect.py
connect.py
+18
-6
No files found.
connect.py
View file @
0c42d039
...
@@ -178,8 +178,6 @@ class Tty(object):
...
@@ -178,8 +178,6 @@ class Tty(object):
VIM_FLAG
=
True
VIM_FLAG
=
True
return
result_command
.
decode
(
'utf8'
,
"ignore"
)
return
result_command
.
decode
(
'utf8'
,
"ignore"
)
else
:
else
:
if
result_command
.
endswith
(
':wq'
)
or
result_command
.
endswith
(
':wq!'
)
or
result_command
.
endswith
(
':q!'
):
VIM_FLAG
=
False
return
''
return
''
@staticmethod
@staticmethod
...
@@ -338,9 +336,12 @@ class SshTty(Tty):
...
@@ -338,9 +336,12 @@ class SshTty(Tty):
log_file_f
,
log_time_f
,
log
=
self
.
get_log
()
log_file_f
,
log_time_f
,
log
=
self
.
get_log
()
old_tty
=
termios
.
tcgetattr
(
sys
.
stdin
)
old_tty
=
termios
.
tcgetattr
(
sys
.
stdin
)
pre_timestamp
=
time
.
time
()
pre_timestamp
=
time
.
time
()
pattern
=
re
.
compile
(
'
\
[.*@.*
\
][
\
$#]'
)
data
=
''
data
=
''
chan_str
=
''
input_mode
=
False
input_mode
=
False
global
VIM_FLAG
try
:
try
:
tty
.
setraw
(
sys
.
stdin
.
fileno
())
tty
.
setraw
(
sys
.
stdin
.
fileno
())
tty
.
setcbreak
(
sys
.
stdin
.
fileno
())
tty
.
setcbreak
(
sys
.
stdin
.
fileno
())
...
@@ -357,6 +358,8 @@ class SshTty(Tty):
...
@@ -357,6 +358,8 @@ class SshTty(Tty):
x
=
self
.
channel
.
recv
(
1024
)
x
=
self
.
channel
.
recv
(
1024
)
if
len
(
x
)
==
0
:
if
len
(
x
)
==
0
:
break
break
if
VIM_FLAG
:
chan_str
+=
x
sys
.
stdout
.
write
(
x
)
sys
.
stdout
.
write
(
x
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
now_timestamp
=
time
.
time
()
now_timestamp
=
time
.
time
()
...
@@ -377,10 +380,19 @@ class SshTty(Tty):
...
@@ -377,10 +380,19 @@ class SshTty(Tty):
input_mode
=
True
input_mode
=
True
if
str
(
x
)
in
[
'
\r
'
,
'
\n
'
,
'
\r\n
'
]:
if
str
(
x
)
in
[
'
\r
'
,
'
\n
'
,
'
\r\n
'
]:
data
=
self
.
deal_command
(
data
,
self
.
ssh
)
if
VIM_FLAG
:
match
=
pattern
.
search
(
chan_str
)
TtyLog
(
log
=
log
,
datetime
=
datetime
.
datetime
.
now
(),
cmd
=
data
)
.
save
()
if
match
:
VIM_FLAG
=
False
data
=
self
.
deal_command
(
data
,
self
.
ssh
)
if
len
(
data
)
>
0
:
TtyLog
(
log
=
log
,
datetime
=
datetime
.
datetime
.
now
(),
cmd
=
data
)
.
save
()
else
:
data
=
self
.
deal_command
(
data
,
self
.
ssh
)
if
len
(
data
)
>
0
:
TtyLog
(
log
=
log
,
datetime
=
datetime
.
datetime
.
now
(),
cmd
=
data
)
.
save
()
data
=
''
data
=
''
chan_str
=
''
input_mode
=
False
input_mode
=
False
if
len
(
x
)
==
0
:
if
len
(
x
)
==
0
:
...
...
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