Ejemplo n.º 1
0
        /**
         * transmits channel data
         */
        public void Transmit(byte[] data)
        {
            SSH1DataWriter wr = new SSH1DataWriter();

            if (_type == ChannelType.Shell)
            {
                wr.WriteAsString(data);
                SSH1Packet p = SSH1Packet.FromPlainPayload(PacketType.SSH_CMSG_STDIN_DATA, wr.ToByteArray());
                Transmit(p);
            }
            else
            {
                wr.Write(_remoteID);
                wr.WriteAsString(data);
                SSH1Packet p = SSH1Packet.FromPlainPayload(PacketType.SSH_MSG_CHANNEL_DATA, wr.ToByteArray());
                Transmit(p);
            }
        }
Ejemplo n.º 2
0
        /**
         * creates a packet as the input of shell
         */
        static SSH1Packet AsStdinString(byte[] input)
        {
            SSH1DataWriter w = new SSH1DataWriter();

            w.WriteAsString(input);
            SSH1Packet p = SSH1Packet.FromPlainPayload(PacketType.SSH_CMSG_STDIN_DATA, w.ToByteArray());

            return(p);
        }
Ejemplo n.º 3
0
 /**
 * transmits channel data
 */
 public void Transmit(byte[] data, int offset, int length)
 {
     SSH1DataWriter wr = new SSH1DataWriter();
     if(_type==ChannelType.Shell) {
         wr.WriteAsString(data, offset, length);
         SSH1Packet p = SSH1Packet.FromPlainPayload(PacketType.SSH_CMSG_STDIN_DATA, wr.ToByteArray());
         Transmit(p);
     }
     else {
         wr.Write(_remoteID);
         wr.WriteAsString(data, offset, length);
         SSH1Packet p = SSH1Packet.FromPlainPayload(PacketType.SSH_MSG_CHANNEL_DATA, wr.ToByteArray());
         Transmit(p);
     }
 }
Ejemplo n.º 4
0
 /**
 * creates a packet as the input of shell
 */
 static SSH1Packet AsStdinString(byte[] input)
 {
     SSH1DataWriter w = new SSH1DataWriter();
     w.WriteAsString(input);
     SSH1Packet p = SSH1Packet.FromPlainPayload(PacketType.SSH_CMSG_STDIN_DATA, w.ToByteArray());
     return p;
 }