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
1e8d930e
Commit
1e8d930e
authored
Dec 22, 2014
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
del import module
parent
e4c6823e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
connect.py
connect.py
+6
-7
No files found.
connect.py
View file @
1e8d930e
...
...
@@ -6,11 +6,10 @@ import os
import
select
import
time
import
paramiko
import
sys
import
struct
import
fcntl
import
signal
import
socket
try
:
import
termios
...
...
@@ -117,8 +116,8 @@ def connect(username, password, host, port):
"""
Connect server.
"""
ps1
=
"'[
\
u@
%
s
\
W]
\
$
'
\n
"
%
host
ps1
=
"PS1='[
\
u@
%
s
\
W]
\
$ '
\n
"
%
host
login_msg
=
"clear;echo -e '
\\
033[32mLogin
%
s done. Enjoy it.
\\
033[0m
'
\n
"
%
host
# Make a ssh connection
ssh
=
paramiko
.
SSHClient
()
...
...
@@ -141,9 +140,9 @@ def connect(username, password, host, port):
except
:
pass
#
Modify PS1
channel
.
send
(
'PS1=
%
s'
%
ps1
)
channel
.
send
(
"clear;echo -e '
\\
033[32mLogin
%
s done. Enjoy it.
\\
033[0m'
\n
"
%
host
)
#
set PS1 and msg it
channel
.
send
(
ps1
)
channel
.
send
(
login_msg
)
# Make ssh interactive tunnel
posix_shell
(
channel
,
username
,
host
)
...
...
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