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

            packet.reset();
            buf.putByte((byte)Session.SSH_MSG_CHANNEL_REQUEST);
            buf.putInt(channel.getRecipient());
            buf.putString(StringAux.getBytes("signal"));
            buf.putByte((byte)(waitForReply() ? 1 : 0));
            buf.putString(StringAux.getBytes(signal));
            session.write(packet);
        }
Example #2
0
        public void request(Session session, AChannel channel)
        {
            Packet packet = session.packet;
            Buffer buf    = session.buf;

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

            // byte      SSH_MSG_CHANNEL_REQUEST(98)
            // uint32 recipient channel
            // string request type        // "x11-req"
            // boolean want reply         // 0
            // boolean   single connection
            // string    x11 authentication protocol // "MIT-MAGIC-COOKIE-1".
            // string    x11 authentication cookie
            // uint32    x11 screen number
            packet.reset();
            buf.putByte((byte)Session.SSH_MSG_CHANNEL_REQUEST);
            buf.putInt(channel.getRecipient());
            buf.putString(StringAux.getBytes("x11-req"));
            buf.putByte((byte)(waitForReply() ? 1 : 0));
            buf.putByte((byte)0);
            buf.putString(StringAux.getBytes("MIT-MAGIC-COOKIE-1"));
            buf.putString(ChannelX11.getFakedCookie(session));
            buf.putInt(0);
            session.write(packet);
        }
Example #4
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.getBytesUTF8("subsystem"));
            buf.putByte((byte)(waitForReply() ? 1 : 0));
            buf.putString(StringAux.getBytesUTF8(subsystem));
            session.write(packet);

            if (reply)
            {
                while (channel.reply == -1)
                {
                    try {
                        ThreadAux.Sleep(10);
                    }
                    catch (System.Exception) {
                    }
                }
                if (channel.reply == 0)
                {
                    throw new SshClientException("failed to send subsystem request");
                }
            }
        }