/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, 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(unchecked((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("x11-req")); buf.PutByte(unchecked((byte)(WaitForReply() ? 1 : 0))); buf.PutByte(unchecked((byte)0)); buf.PutString(Util.Str2byte("MIT-MAGIC-COOKIE-1")); buf.PutString(ChannelX11.GetFakedCookie(session)); buf.PutInt(0); Write(packet); session.x11_forwarding = true; }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, 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(unchecked ((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("x11-req")); buf.PutByte(unchecked ((byte)(WaitForReply() ? 1 : 0))); buf.PutByte(unchecked ((byte)0)); buf.PutString(Util.Str2byte("MIT-MAGIC-COOKIE-1")); buf.PutString(ChannelX11.GetFakedCookie(session)); buf.PutInt(0); Write(packet); session.x11_forwarding = true; }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, 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(unchecked ((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("window-change")); buf.PutByte(unchecked ((byte)(WaitForReply() ? 1 : 0))); buf.PutInt(width_columns); buf.PutInt(height_rows); buf.PutInt(width_pixels); buf.PutInt(height_pixels); Write(packet); }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, channel); Buffer buf = new Buffer(); Packet packet = new Packet(buf); packet.Reset(); buf.PutByte(unchecked((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("subsystem")); buf.PutByte(unchecked((byte)(WaitForReply() ? 1 : 0))); buf.PutString(Util.Str2byte(subsystem)); Write(packet); }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, channel); Buffer buf = new Buffer(); Packet packet = new Packet(buf); packet.Reset(); buf.PutByte(unchecked ((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("subsystem")); buf.PutByte(unchecked ((byte)(WaitForReply() ? 1 : 0))); buf.PutString(Util.Str2byte(subsystem)); Write(packet); }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, 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(unchecked((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("shell")); buf.PutByte(unchecked((byte)(WaitForReply() ? 1 : 0))); Write(packet); }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, channel); SetReply(false); Buffer buf = new Buffer(); Packet packet = new Packet(buf); // byte SSH_MSG_CHANNEL_REQUEST(98) // uint32 recipient channel // string request type // "*****@*****.**" // boolean want reply // 0 packet.Reset(); buf.PutByte(unchecked((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("*****@*****.**")); buf.PutByte(unchecked((byte)(WaitForReply() ? 1 : 0))); Write(packet); session.agent_forwarding = true; }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, 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(unchecked ((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("shell")); buf.PutByte(unchecked ((byte)(WaitForReply() ? 1 : 0))); Write(packet); }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, channel); Buffer buf = new Buffer(); Packet packet = new Packet(buf); packet.Reset(); buf.PutByte(unchecked((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("pty-req")); buf.PutByte(unchecked((byte)(WaitForReply() ? 1 : 0))); buf.PutString(Util.Str2byte(ttype)); buf.PutInt(tcol); buf.PutInt(trow); buf.PutInt(twp); buf.PutInt(thp); buf.PutString(terminal_mode); Write(packet); }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, channel); Buffer buf = new Buffer(); Packet packet = new Packet(buf); packet.Reset(); buf.PutByte(unchecked ((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("pty-req")); buf.PutByte(unchecked ((byte)(WaitForReply() ? 1 : 0))); buf.PutString(Util.Str2byte(ttype)); buf.PutInt(tcol); buf.PutInt(trow); buf.PutInt(twp); buf.PutInt(thp); buf.PutString(terminal_mode); Write(packet); }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, channel); SetReply(false); Buffer buf = new Buffer(); Packet packet = new Packet(buf); // byte SSH_MSG_CHANNEL_REQUEST(98) // uint32 recipient channel // string request type // "*****@*****.**" // boolean want reply // 0 packet.Reset(); buf.PutByte(unchecked ((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("*****@*****.**")); buf.PutByte(unchecked ((byte)(WaitForReply() ? 1 : 0))); Write(packet); session.agent_forwarding = true; }
/// <exception cref="System.Exception"></exception> internal override void DoRequest(Session session, Channel channel) { base.DoRequest(session, 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(unchecked((byte)Session.SSH_MSG_CHANNEL_REQUEST)); buf.PutInt(channel.GetRecipient()); buf.PutString(Util.Str2byte("window-change")); buf.PutByte(unchecked((byte)(WaitForReply() ? 1 : 0))); buf.PutInt(width_columns); buf.PutInt(height_rows); buf.PutInt(width_pixels); buf.PutInt(height_pixels); Write(packet); }
//System.err.println("updatekeys: "+e); /// <exception cref="System.Exception"></exception> internal virtual void Write(Packet packet, Channel c, int length) { long t = GetTimeout(); while (true) { if (in_kex) { if (t > 0L && (Runtime.CurrentTimeMillis() - kex_start_time) > t) { throw new JSchException("timeout in wating for rekeying process."); } try { Sharpen.Thread.Sleep(10); } catch (Exception) { } continue; } lock (c) { if (c.rwsize >= length) { c.rwsize -= length; break; } } if (c.close || !c.IsConnected()) { throw new IOException("channel is broken"); } bool sendit = false; int s = 0; byte command = 0; int recipient = -1; lock (c) { if (c.rwsize > 0) { long len = c.rwsize; if (len > length) { len = length; } if (len != length) { s = packet.Shift((int)len, (c2smac != null ? c2smac.GetBlockSize() : 0)); } command = packet.buffer.GetCommand(); recipient = c.GetRecipient(); length -= (int)len; c.rwsize -= len; sendit = true; } } if (sendit) { _write(packet); if (length == 0) { return; } packet.Unshift(command, recipient, s, length); } lock (c) { if (in_kex) { continue; } if (c.rwsize >= length) { c.rwsize -= length; break; } try { c.notifyme++; Sharpen.Runtime.Wait(c, 100); } catch (Exception) { } finally { c.notifyme--; } } } _write(packet); }