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
f71c8551
Commit
f71c8551
authored
May 11, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix passwd input (#232)
修复记录敏感密码bug
parent
8526437c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
connect.py
connect.py
+8
-12
No files found.
connect.py
View file @
f71c8551
...
@@ -305,7 +305,6 @@ class SshTty(Tty):
...
@@ -305,7 +305,6 @@ class SshTty(Tty):
old_tty
=
termios
.
tcgetattr
(
sys
.
stdin
)
old_tty
=
termios
.
tcgetattr
(
sys
.
stdin
)
pre_timestamp
=
time
.
time
()
pre_timestamp
=
time
.
time
()
data
=
''
data
=
''
input_str
=
''
input_mode
=
False
input_mode
=
False
try
:
try
:
tty
.
setraw
(
sys
.
stdin
.
fileno
())
tty
.
setraw
(
sys
.
stdin
.
fileno
())
...
@@ -325,8 +324,7 @@ class SshTty(Tty):
...
@@ -325,8 +324,7 @@ class SshTty(Tty):
x
=
self
.
channel
.
recv
(
10240
)
x
=
self
.
channel
.
recv
(
10240
)
if
len
(
x
)
==
0
:
if
len
(
x
)
==
0
:
break
break
if
self
.
vim_flag
:
self
.
vim_data
+=
x
index
=
0
index
=
0
len_x
=
len
(
x
)
len_x
=
len
(
x
)
while
index
<
len_x
:
while
index
<
len_x
:
...
@@ -347,11 +345,11 @@ class SshTty(Tty):
...
@@ -347,11 +345,11 @@ class SshTty(Tty):
pre_timestamp
=
now_timestamp
pre_timestamp
=
now_timestamp
log_file_f
.
flush
()
log_file_f
.
flush
()
if
input_mode
and
not
self
.
is_output
(
x
):
if
self
.
vim_flag
:
self
.
vim_data
+=
x
elif
input_mode
:
data
+=
x
data
+=
x
input_str
=
''
except
socket
.
timeout
:
except
socket
.
timeout
:
pass
pass
...
@@ -362,11 +360,7 @@ class SshTty(Tty):
...
@@ -362,11 +360,7 @@ class SshTty(Tty):
pass
pass
termlog
.
recoder
=
True
termlog
.
recoder
=
True
input_mode
=
True
input_mode
=
True
input_str
+=
x
if
self
.
is_output
(
str
(
x
)):
if
str
(
x
)
in
[
'
\r
'
,
'
\n
'
,
'
\r\n
'
]:
# 这个是用来处理用户的复制操作
if
input_str
!=
x
:
data
+=
input_str
if
self
.
vim_flag
:
if
self
.
vim_flag
:
match
=
self
.
vim_end_pattern
.
findall
(
self
.
vim_data
)
match
=
self
.
vim_end_pattern
.
findall
(
self
.
vim_data
)
if
match
:
if
match
:
...
@@ -376,11 +370,13 @@ class SshTty(Tty):
...
@@ -376,11 +370,13 @@ class SshTty(Tty):
else
:
else
:
self
.
vim_end_flag
=
True
self
.
vim_end_flag
=
True
else
:
else
:
# 如果len(str(x)) > 1 说明是复制输入的
if
len
(
str
(
x
))
>
1
:
data
=
x
data
=
self
.
deal_command
(
data
)[
0
:
200
]
data
=
self
.
deal_command
(
data
)[
0
:
200
]
if
len
(
data
)
>
0
:
if
len
(
data
)
>
0
:
TtyLog
(
log
=
log
,
datetime
=
datetime
.
datetime
.
now
(),
cmd
=
data
)
.
save
()
TtyLog
(
log
=
log
,
datetime
=
datetime
.
datetime
.
now
(),
cmd
=
data
)
.
save
()
data
=
''
data
=
''
input_str
=
''
self
.
vim_data
=
''
self
.
vim_data
=
''
input_mode
=
False
input_mode
=
False
...
...
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