Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shrapnel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
shrapnel
Commits
c12d3ab9
Commit
c12d3ab9
authored
May 09, 2013
by
Sam Rushing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Interactive_Session_Server: fleshed out a bit
parent
e1b2bc69
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
coro/ssh/connection/interactive_session.py
coro/ssh/connection/interactive_session.py
+20
-9
No files found.
coro/ssh/connection/interactive_session.py
View file @
c12d3ab9
...
@@ -30,6 +30,8 @@ import channel
...
@@ -30,6 +30,8 @@ import channel
from
coro.ssh.util
import
packet
as
ssh_packet
from
coro.ssh.util
import
packet
as
ssh_packet
from
connect
import
*
from
connect
import
*
from
coro
import
write_stderr
as
W
class
Interactive_Session
(
channel
.
Channel
):
class
Interactive_Session
(
channel
.
Channel
):
name
=
'session'
name
=
'session'
...
@@ -58,25 +60,34 @@ class Interactive_Session_Client(Interactive_Session):
...
@@ -58,25 +60,34 @@ class Interactive_Session_Client(Interactive_Session):
class
Interactive_Session_Server
(
Interactive_Session
):
class
Interactive_Session_Server
(
Interactive_Session
):
def
handle_request
(
self
,
request_type
,
want_reply
,
type_specific_packet_data
):
def
handle_request
(
self
,
request_type
,
want_reply
,
type_specific_packet_data
):
W
(
'interactive_session_server: handle_request %r %r %r
\
n
'
%
(
request_type
,
want_reply
,
type_specific_packet_data
))
if
self
.
request_handlers
.
has_key
(
request_type
):
if
self
.
request_handlers
.
has_key
(
request_type
):
f
=
self
.
request_handlers
[
request_type
]
self
.
request_handlers
[
request_type
]
(
self
,
want_reply
,
type_specific_packet_data
)
f
(
want_reply
,
type_specific_packet_data
)
else
:
else
:
if
want_reply
:
if
want_reply
:
packet
=
ssh_packet
.
pack_payload
(
SSH_MSG_CHANNEL_FAILURE_PAYLOAD
,
(
self
.
remote_channel
.
channel_id
,))
packet
=
ssh_packet
.
pack_payload
(
SSH_MSG_CHANNEL_FAILURE_PAYLOAD
,
(
self
.
remote_channel
.
channel_id
,))
self
.
transport
.
send_packet
(
packet
)
self
.
transport
.
send_packet
(
packet
)
def
handle_pty_request
(
self
,
want_reply
,
type_specific_packet_data
):
def
handle_pty_request
(
self
,
want_reply
,
type_specific_packet_data
):
term
,
width_char
,
height_char
,
width_pixels
,
height_pixels
,
modes
=
ssh_packet
.
unpack_payload
(
PTY_CHANNEL_REQUEST_PAYLOAD
,
type_specific_packet_data
)
term
,
width_char
,
height_char
,
width_pixels
,
height_pixels
,
modes
=
ssh_packet
.
unpack_payload
(
PTY_CHANNEL_REQUEST_PAYLOAD
,
type_specific_packet_data
)
# XXX: NOT FINISHED
# XXX do some PTY crap here
self
.
send_channel_request_failure
()
def
handle_x11_request
(
self
,
want_reply
,
type_specific_packet_data
):
def
handle_x11_request
(
self
,
want_reply
,
type_specific_packet_data
):
single_connection
,
auth_protocol
,
auth_cookie
,
screen_number
=
ssh_packet
.
unpack_payload
(
X11_CHANNEL_REQUEST_PAYLOAD
,
type_specific_packet_data
)
single_connection
,
auth_protocol
,
auth_cookie
,
screen_number
=
ssh_packet
.
unpack_payload
(
X11_CHANNEL_REQUEST_PAYLOAD
,
type_specific_packet_data
)
# XXX: NOT FINISHED
# XXX fantasize about doing X11 forwarding here? I think not.
self
.
send_channel_request_failure
()
def
handle_shell_request
(
self
,
want_reply
,
type_specific_packet_data
):
# XXX whatever, sure, it worked.
self
.
send_channel_request_success
()
request_handlers
=
{
'pty-req'
:
handle_pty_request
,
request_handlers
=
{
'pty-req'
:
handle_pty_request
,
'x11-req'
:
handle_x11_request
,
'x11-req'
:
handle_x11_request
,
'shell'
:
handle_shell_request
,
# exec :
# subsystem :
}
}
PTY_CHANNEL_REQUEST_PAYLOAD
=
(
ssh_packet
.
STRING
,
# TERM environment variable value (e.g., vt100)
PTY_CHANNEL_REQUEST_PAYLOAD
=
(
ssh_packet
.
STRING
,
# TERM environment variable value (e.g., vt100)
...
...
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