Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
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
coco
Commits
a50b4303
Unverified
Commit
a50b4303
authored
6 years ago
by
老广
Committed by
GitHub
6 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #165 from jumpserver/dev
[Bugfix] 修复连接telnet资产失败,直接退出coco连接的bug (#164)
parents
88164e5a
18c46fc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
connection.py
coco/connection.py
+9
-3
No files found.
coco/connection.py
View file @
a50b4303
...
...
@@ -48,7 +48,7 @@ class SSHConnection:
if
asset
.
domain
:
sock
=
self
.
get_proxy_sock_v2
(
asset
)
if
not
sock
:
error
=
'Connect gateway failed
;
'
error
=
'Connect gateway failed
.
'
logger
.
error
(
error
)
try
:
...
...
@@ -86,7 +86,8 @@ class SSHConnection:
system_user
.
username
,
asset
.
ip
,
asset
.
port
,
password_short
,
key_fingerprint
,
))
return
None
,
None
,
error
+
'
\n
'
+
str
(
e
)
error
+=
'
\r\n
'
+
str
(
e
)
if
error
else
str
(
e
)
return
None
,
None
,
error
return
ssh
,
sock
,
None
def
get_transport
(
self
,
asset
,
system_user
):
...
...
@@ -166,7 +167,12 @@ class TelnetConnection:
logger
.
debug
(
'Get telnet server socket. {}'
.
format
(
self
.
client
.
user
))
self
.
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
sock
.
settimeout
(
10
)
self
.
sock
.
connect
((
self
.
asset
.
ip
,
self
.
asset
.
port
))
try
:
self
.
sock
.
connect
((
self
.
asset
.
ip
,
self
.
asset
.
port
))
except
Exception
as
e
:
msg
=
'Connect telnet server failed.
\r\n
{}'
.
format
(
e
)
logger
.
error
(
msg
)
return
None
,
msg
# Send SGA and ECHO options to Telnet Server
self
.
sock
.
send
(
telnetlib
.
IAC
+
telnetlib
.
DO
+
telnetlib
.
SGA
)
self
.
sock
.
send
(
telnetlib
.
IAC
+
telnetlib
.
DO
+
telnetlib
.
ECHO
)
...
...
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