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
91576bf7
Commit
91576bf7
authored
Dec 15, 2017
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
560b6de4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
httpd.py
coco/httpd.py
+9
-0
No files found.
coco/httpd.py
View file @
91576bf7
...
@@ -47,12 +47,17 @@ class BaseWebSocketHandler:
...
@@ -47,12 +47,17 @@ class BaseWebSocketHandler:
return
True
return
True
def
close
(
self
):
def
close
(
self
):
try
:
self
.
ssh
.
close
()
except
:
pass
pass
pass
class
SSHws
(
Namespace
,
BaseWebSocketHandler
):
class
SSHws
(
Namespace
,
BaseWebSocketHandler
):
def
ssh_with_password
(
self
):
def
ssh_with_password
(
self
):
self
.
ssh
=
paramiko
.
SSHClient
()
self
.
ssh
=
paramiko
.
SSHClient
()
self
.
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
self
.
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
self
.
ssh
.
connect
(
"127.0.0.1"
,
22
,
"liuzheng"
,
"liuzheng"
)
self
.
ssh
.
connect
(
"127.0.0.1"
,
22
,
"liuzheng"
,
"liuzheng"
)
self
.
chan
=
self
.
ssh
.
invoke_shell
(
term
=
'xterm'
,
width
=
self
.
cols
,
height
=
self
.
rows
)
self
.
chan
=
self
.
ssh
.
invoke_shell
(
term
=
'xterm'
,
width
=
self
.
cols
,
height
=
self
.
rows
)
...
@@ -95,6 +100,10 @@ class SSHws(Namespace, BaseWebSocketHandler):
...
@@ -95,6 +100,10 @@ class SSHws(Namespace, BaseWebSocketHandler):
system_user
=
username
system_user
=
username
if
system_user
:
if
system_user
:
self
.
forwarder
.
proxy
(
self
.
asset
,
system_user
)
self
.
forwarder
.
proxy
(
self
.
asset
,
system_user
)
else
:
self
.
close
()
else
:
self
.
close
()
def
on_resize
(
self
,
message
):
def
on_resize
(
self
,
message
):
self
.
request
.
meta
[
'width'
]
=
message
.
get
(
'cols'
,
80
)
self
.
request
.
meta
[
'width'
]
=
message
.
get
(
'cols'
,
80
)
...
...
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