Example #1
0
        public void request(Session session, AChannel channel)
        {
            Buffer buf    = new Buffer();
            Packet packet = new Packet(buf);

            // send
            // byte     SSH_MSG_CHANNEL_REQUEST(98)
            // uint32 recipient channel
            // string request type       // "shell"
            // boolean want reply        // 0
            packet.reset();
            buf.putByte((byte)Session.SSH_MSG_CHANNEL_REQUEST);
            buf.putInt(channel.getRecipient());
            buf.putString(StringAux.getBytes("shell"));
            buf.putByte((byte)(waitForReply() ? 1 : 0));
            session.write(packet);
        }
Example #2
0
        public void request(Session session, AChannel channel)
        {
            Buffer buf    = new Buffer();
            Packet packet = new Packet(buf);

            bool reply = waitForReply();

            if (reply)
            {
                channel.reply = -1;
            }

            packet.reset();
            buf.putByte((byte)Session.SSH_MSG_CHANNEL_REQUEST);
            buf.putInt(channel.getRecipient());
            buf.putString(StringAux.getBytes("subsystem"));
            buf.putByte((byte)(waitForReply() ? 1 : 0));
            buf.putString(StringAux.getBytes("sftp"));
            session.write(packet);

            if (reply)
            {
                while (channel.reply == -1)
                {
                    try {
                        System.Threading.Thread.Sleep(10);
                    }
                    catch                    //(Exception ee)
                    {
                    }
                }
                if (channel.reply == 0)
                {
                    throw new SshClientException("failed to send sftp request");
                }
            }
        }
        public void request(Session session, AChannel channel)
        {
            Buffer buf    = new Buffer();
            Packet packet = new Packet(buf);

            //byte      SSH_MSG_CHANNEL_REQUEST
            //uint32    recipient_channel
            //string    "window-change"
            //boolean   FALSE
            //uint32    terminal width, columns
            //uint32    terminal height, rows
            //uint32    terminal width, pixels
            //uint32    terminal height, pixels
            packet.reset();
            buf.putByte((byte)Session.SSH_MSG_CHANNEL_REQUEST);
            buf.putInt(channel.getRecipient());
            buf.putString(StringAux.getBytes("window-change"));
            buf.putByte((byte)(waitForReply() ? 1 : 0));
            buf.putInt(width_columns);
            buf.putInt(height_rows);
            buf.putInt(width_pixels);
            buf.putInt(height_pixels);
            session.write(packet);
        }