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
7806db1d
Commit
7806db1d
authored
Dec 22, 2014
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
catch excepition
parent
3382b67b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
connect.py
connect.py
+11
-1
No files found.
connect.py
View file @
7806db1d
...
...
@@ -10,6 +10,7 @@ import sys
import
struct
import
fcntl
import
signal
import
socket
try
:
import
termios
...
...
@@ -112,7 +113,16 @@ def connect(username, password, host, port):
ssh
=
paramiko
.
SSHClient
()
ssh
.
load_system_host_keys
()
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
ssh
.
connect
(
host
,
port
=
port
,
username
=
username
,
password
=
password
,
compress
=
True
)
try
:
ssh
.
connect
(
host
,
port
=
port
,
username
=
username
,
password
=
password
,
compress
=
True
)
except
paramiko
.
ssh_exception
.
AuthenticationException
:
print
'Password Error, Please Correct it.'
time
.
sleep
(
2
)
sys
.
exit
()
except
socket
.
error
:
print
'Connect SSH Socket Port Error, Please Correct it.'
time
.
sleep
(
2
)
sys
.
exit
()
# Make a channel and set windows size
global
channel
...
...
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