From 49b779dcaf03e3598d2709b321e20ea029b25163 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Wed, 1 Oct 2014 23:04:51 +0100 Subject: Convert to gradle build system --- .../ssh2/packets/PacketChannelAuthAgentReq.java | 33 ---- .../packets/PacketChannelOpenConfirmation.java | 66 -------- .../ssh2/packets/PacketChannelOpenFailure.java | 66 -------- .../ssh2/packets/PacketChannelTrileadPing.java | 35 ---- .../ssh2/packets/PacketChannelWindowAdjust.java | 57 ------- src/com/trilead/ssh2/packets/PacketDisconnect.java | 57 ------- .../packets/PacketGlobalCancelForwardRequest.java | 42 ----- .../ssh2/packets/PacketGlobalForwardRequest.java | 41 ----- .../ssh2/packets/PacketGlobalTrileadPing.java | 32 ---- src/com/trilead/ssh2/packets/PacketIgnore.java | 59 ------- src/com/trilead/ssh2/packets/PacketKexDHInit.java | 31 ---- src/com/trilead/ssh2/packets/PacketKexDHReply.java | 53 ------ .../trilead/ssh2/packets/PacketKexDhGexGroup.java | 50 ------ .../trilead/ssh2/packets/PacketKexDhGexInit.java | 33 ---- .../trilead/ssh2/packets/PacketKexDhGexReply.java | 56 ------- .../ssh2/packets/PacketKexDhGexRequest.java | 39 ----- .../ssh2/packets/PacketKexDhGexRequestOld.java | 34 ---- src/com/trilead/ssh2/packets/PacketKexInit.java | 165 ------------------- src/com/trilead/ssh2/packets/PacketNewKeys.java | 46 ------ .../ssh2/packets/PacketOpenDirectTCPIPChannel.java | 56 ------- .../ssh2/packets/PacketOpenSessionChannel.java | 62 -------- .../trilead/ssh2/packets/PacketServiceAccept.java | 61 ------- .../trilead/ssh2/packets/PacketServiceRequest.java | 52 ------ .../ssh2/packets/PacketSessionExecCommand.java | 39 ----- .../ssh2/packets/PacketSessionPtyRequest.java | 57 ------- .../ssh2/packets/PacketSessionPtyResize.java | 40 ----- .../ssh2/packets/PacketSessionStartShell.java | 36 ----- .../packets/PacketSessionSubsystemRequest.java | 40 ----- .../ssh2/packets/PacketSessionX11Request.java | 53 ------ .../trilead/ssh2/packets/PacketUserauthBanner.java | 60 ------- .../ssh2/packets/PacketUserauthFailure.java | 53 ------ .../ssh2/packets/PacketUserauthInfoRequest.java | 84 ---------- .../ssh2/packets/PacketUserauthInfoResponse.java | 35 ---- .../packets/PacketUserauthRequestInteractive.java | 42 ----- .../ssh2/packets/PacketUserauthRequestNone.java | 61 ------- .../packets/PacketUserauthRequestPassword.java | 67 -------- .../packets/PacketUserauthRequestPublicKey.java | 65 -------- src/com/trilead/ssh2/packets/Packets.java | 149 ----------------- src/com/trilead/ssh2/packets/TypesReader.java | 177 --------------------- src/com/trilead/ssh2/packets/TypesWriter.java | 169 -------------------- 40 files changed, 2453 deletions(-) delete mode 100644 src/com/trilead/ssh2/packets/PacketChannelAuthAgentReq.java delete mode 100644 src/com/trilead/ssh2/packets/PacketChannelOpenConfirmation.java delete mode 100644 src/com/trilead/ssh2/packets/PacketChannelOpenFailure.java delete mode 100644 src/com/trilead/ssh2/packets/PacketChannelTrileadPing.java delete mode 100644 src/com/trilead/ssh2/packets/PacketChannelWindowAdjust.java delete mode 100644 src/com/trilead/ssh2/packets/PacketDisconnect.java delete mode 100644 src/com/trilead/ssh2/packets/PacketGlobalCancelForwardRequest.java delete mode 100644 src/com/trilead/ssh2/packets/PacketGlobalForwardRequest.java delete mode 100644 src/com/trilead/ssh2/packets/PacketGlobalTrileadPing.java delete mode 100644 src/com/trilead/ssh2/packets/PacketIgnore.java delete mode 100644 src/com/trilead/ssh2/packets/PacketKexDHInit.java delete mode 100644 src/com/trilead/ssh2/packets/PacketKexDHReply.java delete mode 100644 src/com/trilead/ssh2/packets/PacketKexDhGexGroup.java delete mode 100644 src/com/trilead/ssh2/packets/PacketKexDhGexInit.java delete mode 100644 src/com/trilead/ssh2/packets/PacketKexDhGexReply.java delete mode 100644 src/com/trilead/ssh2/packets/PacketKexDhGexRequest.java delete mode 100644 src/com/trilead/ssh2/packets/PacketKexDhGexRequestOld.java delete mode 100644 src/com/trilead/ssh2/packets/PacketKexInit.java delete mode 100644 src/com/trilead/ssh2/packets/PacketNewKeys.java delete mode 100644 src/com/trilead/ssh2/packets/PacketOpenDirectTCPIPChannel.java delete mode 100644 src/com/trilead/ssh2/packets/PacketOpenSessionChannel.java delete mode 100644 src/com/trilead/ssh2/packets/PacketServiceAccept.java delete mode 100644 src/com/trilead/ssh2/packets/PacketServiceRequest.java delete mode 100644 src/com/trilead/ssh2/packets/PacketSessionExecCommand.java delete mode 100644 src/com/trilead/ssh2/packets/PacketSessionPtyRequest.java delete mode 100644 src/com/trilead/ssh2/packets/PacketSessionPtyResize.java delete mode 100644 src/com/trilead/ssh2/packets/PacketSessionStartShell.java delete mode 100644 src/com/trilead/ssh2/packets/PacketSessionSubsystemRequest.java delete mode 100644 src/com/trilead/ssh2/packets/PacketSessionX11Request.java delete mode 100644 src/com/trilead/ssh2/packets/PacketUserauthBanner.java delete mode 100644 src/com/trilead/ssh2/packets/PacketUserauthFailure.java delete mode 100644 src/com/trilead/ssh2/packets/PacketUserauthInfoRequest.java delete mode 100644 src/com/trilead/ssh2/packets/PacketUserauthInfoResponse.java delete mode 100644 src/com/trilead/ssh2/packets/PacketUserauthRequestInteractive.java delete mode 100644 src/com/trilead/ssh2/packets/PacketUserauthRequestNone.java delete mode 100644 src/com/trilead/ssh2/packets/PacketUserauthRequestPassword.java delete mode 100644 src/com/trilead/ssh2/packets/PacketUserauthRequestPublicKey.java delete mode 100644 src/com/trilead/ssh2/packets/Packets.java delete mode 100644 src/com/trilead/ssh2/packets/TypesReader.java delete mode 100644 src/com/trilead/ssh2/packets/TypesWriter.java (limited to 'src/com/trilead/ssh2/packets') diff --git a/src/com/trilead/ssh2/packets/PacketChannelAuthAgentReq.java b/src/com/trilead/ssh2/packets/PacketChannelAuthAgentReq.java deleted file mode 100644 index 95fa396..0000000 --- a/src/com/trilead/ssh2/packets/PacketChannelAuthAgentReq.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.trilead.ssh2.packets; - -/** - * PacketGlobalAuthAgent. - * - * @author Kenny Root, kenny@the-b.org - * @version $Id$ - */ -public class PacketChannelAuthAgentReq -{ - byte[] payload; - - public int recipientChannelID; - - public PacketChannelAuthAgentReq(int recipientChannelID) - { - this.recipientChannelID = recipientChannelID; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST); - tw.writeUINT32(recipientChannelID); - tw.writeString("auth-agent-req@openssh.com"); - tw.writeBoolean(true); // want reply - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketChannelOpenConfirmation.java b/src/com/trilead/ssh2/packets/PacketChannelOpenConfirmation.java deleted file mode 100644 index bd2ea3f..0000000 --- a/src/com/trilead/ssh2/packets/PacketChannelOpenConfirmation.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketChannelOpenConfirmation. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketChannelOpenConfirmation.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketChannelOpenConfirmation -{ - byte[] payload; - - public int recipientChannelID; - public int senderChannelID; - public int initialWindowSize; - public int maxPacketSize; - - public PacketChannelOpenConfirmation(int recipientChannelID, int senderChannelID, int initialWindowSize, - int maxPacketSize) - { - this.recipientChannelID = recipientChannelID; - this.senderChannelID = senderChannelID; - this.initialWindowSize = initialWindowSize; - this.maxPacketSize = maxPacketSize; - } - - public PacketChannelOpenConfirmation(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_CHANNEL_OPEN_CONFIRMATION) - throw new IOException( - "This is not a SSH_MSG_CHANNEL_OPEN_CONFIRMATION! (" - + packet_type + ")"); - - recipientChannelID = tr.readUINT32(); - senderChannelID = tr.readUINT32(); - initialWindowSize = tr.readUINT32(); - maxPacketSize = tr.readUINT32(); - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_CHANNEL_OPEN_CONFIRMATION packet!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_OPEN_CONFIRMATION); - tw.writeUINT32(recipientChannelID); - tw.writeUINT32(senderChannelID); - tw.writeUINT32(initialWindowSize); - tw.writeUINT32(maxPacketSize); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketChannelOpenFailure.java b/src/com/trilead/ssh2/packets/PacketChannelOpenFailure.java deleted file mode 100644 index 1370355..0000000 --- a/src/com/trilead/ssh2/packets/PacketChannelOpenFailure.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketChannelOpenFailure. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketChannelOpenFailure.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketChannelOpenFailure -{ - byte[] payload; - - public int recipientChannelID; - public int reasonCode; - public String description; - public String languageTag; - - public PacketChannelOpenFailure(int recipientChannelID, int reasonCode, String description, - String languageTag) - { - this.recipientChannelID = recipientChannelID; - this.reasonCode = reasonCode; - this.description = description; - this.languageTag = languageTag; - } - - public PacketChannelOpenFailure(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_CHANNEL_OPEN_FAILURE) - throw new IOException( - "This is not a SSH_MSG_CHANNEL_OPEN_FAILURE! (" - + packet_type + ")"); - - recipientChannelID = tr.readUINT32(); - reasonCode = tr.readUINT32(); - description = tr.readString(); - languageTag = tr.readString(); - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_CHANNEL_OPEN_FAILURE packet!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_OPEN_FAILURE); - tw.writeUINT32(recipientChannelID); - tw.writeUINT32(reasonCode); - tw.writeString(description); - tw.writeString(languageTag); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketChannelTrileadPing.java b/src/com/trilead/ssh2/packets/PacketChannelTrileadPing.java deleted file mode 100644 index c337930..0000000 --- a/src/com/trilead/ssh2/packets/PacketChannelTrileadPing.java +++ /dev/null @@ -1,35 +0,0 @@ - -package com.trilead.ssh2.packets; - -/** - * PacketChannelTrileadPing. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketChannelTrileadPing.java,v 1.1 2008/03/03 07:01:36 - * cplattne Exp $ - */ -public class PacketChannelTrileadPing -{ - byte[] payload; - - public int recipientChannelID; - - public PacketChannelTrileadPing(int recipientChannelID) - { - this.recipientChannelID = recipientChannelID; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST); - tw.writeUINT32(recipientChannelID); - tw.writeString("trilead-ping"); - tw.writeBoolean(true); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketChannelWindowAdjust.java b/src/com/trilead/ssh2/packets/PacketChannelWindowAdjust.java deleted file mode 100644 index 37ec081..0000000 --- a/src/com/trilead/ssh2/packets/PacketChannelWindowAdjust.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketChannelWindowAdjust. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketChannelWindowAdjust.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketChannelWindowAdjust -{ - byte[] payload; - - public int recipientChannelID; - public int windowChange; - - public PacketChannelWindowAdjust(int recipientChannelID, int windowChange) - { - this.recipientChannelID = recipientChannelID; - this.windowChange = windowChange; - } - - public PacketChannelWindowAdjust(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_CHANNEL_WINDOW_ADJUST) - throw new IOException( - "This is not a SSH_MSG_CHANNEL_WINDOW_ADJUST! (" - + packet_type + ")"); - - recipientChannelID = tr.readUINT32(); - windowChange = tr.readUINT32(); - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_CHANNEL_WINDOW_ADJUST packet!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_WINDOW_ADJUST); - tw.writeUINT32(recipientChannelID); - tw.writeUINT32(windowChange); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketDisconnect.java b/src/com/trilead/ssh2/packets/PacketDisconnect.java deleted file mode 100644 index 50d6ec2..0000000 --- a/src/com/trilead/ssh2/packets/PacketDisconnect.java +++ /dev/null @@ -1,57 +0,0 @@ - -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketDisconnect. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketDisconnect.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $ - */ -public class PacketDisconnect -{ - byte[] payload; - - int reason; - String desc; - String lang; - - public PacketDisconnect(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_DISCONNECT) - throw new IOException("This is not a Disconnect Packet! (" + packet_type + ")"); - - reason = tr.readUINT32(); - desc = tr.readString(); - lang = tr.readString(); - } - - public PacketDisconnect(int reason, String desc, String lang) - { - this.reason = reason; - this.desc = desc; - this.lang = lang; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_DISCONNECT); - tw.writeUINT32(reason); - tw.writeString(desc); - tw.writeString(lang); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketGlobalCancelForwardRequest.java b/src/com/trilead/ssh2/packets/PacketGlobalCancelForwardRequest.java deleted file mode 100644 index 20bd558..0000000 --- a/src/com/trilead/ssh2/packets/PacketGlobalCancelForwardRequest.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.trilead.ssh2.packets; - -/** - * PacketGlobalCancelForwardRequest. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketGlobalCancelForwardRequest.java,v 1.1 2007/10/15 12:49:55 - * cplattne Exp $ - */ -public class PacketGlobalCancelForwardRequest -{ - byte[] payload; - - public boolean wantReply; - public String bindAddress; - public int bindPort; - - public PacketGlobalCancelForwardRequest(boolean wantReply, String bindAddress, int bindPort) - { - this.wantReply = wantReply; - this.bindAddress = bindAddress; - this.bindPort = bindPort; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_GLOBAL_REQUEST); - - tw.writeString("cancel-tcpip-forward"); - tw.writeBoolean(wantReply); - tw.writeString(bindAddress); - tw.writeUINT32(bindPort); - - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketGlobalForwardRequest.java b/src/com/trilead/ssh2/packets/PacketGlobalForwardRequest.java deleted file mode 100644 index 55257e9..0000000 --- a/src/com/trilead/ssh2/packets/PacketGlobalForwardRequest.java +++ /dev/null @@ -1,41 +0,0 @@ - -package com.trilead.ssh2.packets; - -/** - * PacketGlobalForwardRequest. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketGlobalForwardRequest.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketGlobalForwardRequest -{ - byte[] payload; - - public boolean wantReply; - public String bindAddress; - public int bindPort; - - public PacketGlobalForwardRequest(boolean wantReply, String bindAddress, int bindPort) - { - this.wantReply = wantReply; - this.bindAddress = bindAddress; - this.bindPort = bindPort; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_GLOBAL_REQUEST); - - tw.writeString("tcpip-forward"); - tw.writeBoolean(wantReply); - tw.writeString(bindAddress); - tw.writeUINT32(bindPort); - - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketGlobalTrileadPing.java b/src/com/trilead/ssh2/packets/PacketGlobalTrileadPing.java deleted file mode 100644 index 3d8930e..0000000 --- a/src/com/trilead/ssh2/packets/PacketGlobalTrileadPing.java +++ /dev/null @@ -1,32 +0,0 @@ - -package com.trilead.ssh2.packets; - -/** - * PacketGlobalTrileadPing. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketGlobalTrileadPing.java,v 1.1 2008/03/03 07:01:36 cplattne Exp $ - */ -public class PacketGlobalTrileadPing -{ - byte[] payload; - - public PacketGlobalTrileadPing() - { - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_GLOBAL_REQUEST); - - tw.writeString("trilead-ping"); - tw.writeBoolean(true); - - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketIgnore.java b/src/com/trilead/ssh2/packets/PacketIgnore.java deleted file mode 100644 index 2b4d917..0000000 --- a/src/com/trilead/ssh2/packets/PacketIgnore.java +++ /dev/null @@ -1,59 +0,0 @@ - -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketIgnore. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketIgnore.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketIgnore -{ - byte[] payload; - - byte[] data; - - public void setData(byte[] data) - { - this.data = data; - payload = null; - } - - public PacketIgnore() - { - } - - public PacketIgnore(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_IGNORE) - throw new IOException("This is not a SSH_MSG_IGNORE packet! (" + packet_type + ")"); - - /* Could parse String body */ - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_IGNORE); - - if (data != null) - tw.writeString(data, 0, data.length); - else - tw.writeString(""); - - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketKexDHInit.java b/src/com/trilead/ssh2/packets/PacketKexDHInit.java deleted file mode 100644 index 0092516..0000000 --- a/src/com/trilead/ssh2/packets/PacketKexDHInit.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.trilead.ssh2.packets; - -/** - * PacketKexDHInit. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketKexDHInit.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketKexDHInit -{ - byte[] payload; - - byte[] publicKey; - - public PacketKexDHInit(byte[] publicKey) - { - this.publicKey = publicKey; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_KEXDH_INIT); - tw.writeString(publicKey, 0, publicKey.length); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketKexDHReply.java b/src/com/trilead/ssh2/packets/PacketKexDHReply.java deleted file mode 100644 index 51f2bda..0000000 --- a/src/com/trilead/ssh2/packets/PacketKexDHReply.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketKexDHReply. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketKexDHReply.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketKexDHReply -{ - byte[] payload; - - byte[] hostKey; - byte[] publicKey; - byte[] signature; - - public PacketKexDHReply(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_KEXDH_REPLY) - throw new IOException("This is not a SSH_MSG_KEXDH_REPLY! (" - + packet_type + ")"); - - hostKey = tr.readByteString(); - publicKey = tr.readByteString(); - signature = tr.readByteString(); - - if (tr.remain() != 0) throw new IOException("PADDING IN SSH_MSG_KEXDH_REPLY!"); - } - - public byte[] getF() - { - return publicKey; - } - - public byte[] getHostKey() - { - return hostKey; - } - - public byte[] getSignature() - { - return signature; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketKexDhGexGroup.java b/src/com/trilead/ssh2/packets/PacketKexDhGexGroup.java deleted file mode 100644 index db85b61..0000000 --- a/src/com/trilead/ssh2/packets/PacketKexDhGexGroup.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -import java.math.BigInteger; - -/** - * PacketKexDhGexGroup. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketKexDhGexGroup.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketKexDhGexGroup -{ - byte[] payload; - - BigInteger p; - BigInteger g; - - public PacketKexDhGexGroup(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_KEX_DH_GEX_GROUP) - throw new IllegalArgumentException( - "This is not a SSH_MSG_KEX_DH_GEX_GROUP! (" + packet_type - + ")"); - - p = tr.readMPINT(); - g = tr.readMPINT(); - - if (tr.remain() != 0) - throw new IOException("PADDING IN SSH_MSG_KEX_DH_GEX_GROUP!"); - } - - public BigInteger getG() - { - return g; - } - - public BigInteger getP() - { - return p; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketKexDhGexInit.java b/src/com/trilead/ssh2/packets/PacketKexDhGexInit.java deleted file mode 100644 index 8b34230..0000000 --- a/src/com/trilead/ssh2/packets/PacketKexDhGexInit.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.math.BigInteger; - -/** - * PacketKexDhGexInit. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketKexDhGexInit.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketKexDhGexInit -{ - byte[] payload; - - BigInteger e; - - public PacketKexDhGexInit(BigInteger e) - { - this.e = e; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_KEX_DH_GEX_INIT); - tw.writeMPInt(e); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketKexDhGexReply.java b/src/com/trilead/ssh2/packets/PacketKexDhGexReply.java deleted file mode 100644 index 382b3b7..0000000 --- a/src/com/trilead/ssh2/packets/PacketKexDhGexReply.java +++ /dev/null @@ -1,56 +0,0 @@ - -package com.trilead.ssh2.packets; - -import java.io.IOException; - -import java.math.BigInteger; - -/** - * PacketKexDhGexReply. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketKexDhGexReply.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketKexDhGexReply -{ - byte[] payload; - - byte[] hostKey; - BigInteger f; - byte[] signature; - - public PacketKexDhGexReply(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_KEX_DH_GEX_REPLY) - throw new IOException("This is not a SSH_MSG_KEX_DH_GEX_REPLY! (" + packet_type + ")"); - - hostKey = tr.readByteString(); - f = tr.readMPINT(); - signature = tr.readByteString(); - - if (tr.remain() != 0) - throw new IOException("PADDING IN SSH_MSG_KEX_DH_GEX_REPLY!"); - } - - public BigInteger getF() - { - return f; - } - - public byte[] getHostKey() - { - return hostKey; - } - - public byte[] getSignature() - { - return signature; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketKexDhGexRequest.java b/src/com/trilead/ssh2/packets/PacketKexDhGexRequest.java deleted file mode 100644 index 50369df..0000000 --- a/src/com/trilead/ssh2/packets/PacketKexDhGexRequest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.trilead.ssh2.packets; - -import com.trilead.ssh2.DHGexParameters; - -/** - * PacketKexDhGexRequest. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketKexDhGexRequest.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketKexDhGexRequest -{ - byte[] payload; - - int min; - int n; - int max; - - public PacketKexDhGexRequest(DHGexParameters para) - { - this.min = para.getMin_group_len(); - this.n = para.getPref_group_len(); - this.max = para.getMax_group_len(); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_KEX_DH_GEX_REQUEST); - tw.writeUINT32(min); - tw.writeUINT32(n); - tw.writeUINT32(max); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketKexDhGexRequestOld.java b/src/com/trilead/ssh2/packets/PacketKexDhGexRequestOld.java deleted file mode 100644 index 327f379..0000000 --- a/src/com/trilead/ssh2/packets/PacketKexDhGexRequestOld.java +++ /dev/null @@ -1,34 +0,0 @@ - -package com.trilead.ssh2.packets; - -import com.trilead.ssh2.DHGexParameters; - -/** - * PacketKexDhGexRequestOld. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketKexDhGexRequestOld.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketKexDhGexRequestOld -{ - byte[] payload; - - int n; - - public PacketKexDhGexRequestOld(DHGexParameters para) - { - this.n = para.getPref_group_len(); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_KEX_DH_GEX_REQUEST_OLD); - tw.writeUINT32(n); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketKexInit.java b/src/com/trilead/ssh2/packets/PacketKexInit.java deleted file mode 100644 index 087d658..0000000 --- a/src/com/trilead/ssh2/packets/PacketKexInit.java +++ /dev/null @@ -1,165 +0,0 @@ - -package com.trilead.ssh2.packets; - -import java.io.IOException; -import java.security.SecureRandom; - -import com.trilead.ssh2.crypto.CryptoWishList; -import com.trilead.ssh2.transport.KexParameters; - - -/** - * PacketKexInit. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketKexInit.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketKexInit -{ - byte[] payload; - - KexParameters kp = new KexParameters(); - - public PacketKexInit(CryptoWishList cwl) - { - kp.cookie = new byte[16]; - new SecureRandom().nextBytes(kp.cookie); - - kp.kex_algorithms = cwl.kexAlgorithms; - kp.server_host_key_algorithms = cwl.serverHostKeyAlgorithms; - kp.encryption_algorithms_client_to_server = cwl.c2s_enc_algos; - kp.encryption_algorithms_server_to_client = cwl.s2c_enc_algos; - kp.mac_algorithms_client_to_server = cwl.c2s_mac_algos; - kp.mac_algorithms_server_to_client = cwl.s2c_mac_algos; - kp.compression_algorithms_client_to_server = cwl.c2s_comp_algos; - kp.compression_algorithms_server_to_client = cwl.s2c_comp_algos; - kp.languages_client_to_server = new String[] {}; - kp.languages_server_to_client = new String[] {}; - kp.first_kex_packet_follows = false; - kp.reserved_field1 = 0; - } - - public PacketKexInit(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_KEXINIT) - throw new IOException("This is not a KexInitPacket! (" + packet_type + ")"); - - kp.cookie = tr.readBytes(16); - kp.kex_algorithms = tr.readNameList(); - kp.server_host_key_algorithms = tr.readNameList(); - kp.encryption_algorithms_client_to_server = tr.readNameList(); - kp.encryption_algorithms_server_to_client = tr.readNameList(); - kp.mac_algorithms_client_to_server = tr.readNameList(); - kp.mac_algorithms_server_to_client = tr.readNameList(); - kp.compression_algorithms_client_to_server = tr.readNameList(); - kp.compression_algorithms_server_to_client = tr.readNameList(); - kp.languages_client_to_server = tr.readNameList(); - kp.languages_server_to_client = tr.readNameList(); - kp.first_kex_packet_follows = tr.readBoolean(); - kp.reserved_field1 = tr.readUINT32(); - - if (tr.remain() != 0) - throw new IOException("Padding in KexInitPacket!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_KEXINIT); - tw.writeBytes(kp.cookie, 0, 16); - tw.writeNameList(kp.kex_algorithms); - tw.writeNameList(kp.server_host_key_algorithms); - tw.writeNameList(kp.encryption_algorithms_client_to_server); - tw.writeNameList(kp.encryption_algorithms_server_to_client); - tw.writeNameList(kp.mac_algorithms_client_to_server); - tw.writeNameList(kp.mac_algorithms_server_to_client); - tw.writeNameList(kp.compression_algorithms_client_to_server); - tw.writeNameList(kp.compression_algorithms_server_to_client); - tw.writeNameList(kp.languages_client_to_server); - tw.writeNameList(kp.languages_server_to_client); - tw.writeBoolean(kp.first_kex_packet_follows); - tw.writeUINT32(kp.reserved_field1); - payload = tw.getBytes(); - } - return payload; - } - - public KexParameters getKexParameters() - { - return kp; - } - - public String[] getCompression_algorithms_client_to_server() - { - return kp.compression_algorithms_client_to_server; - } - - public String[] getCompression_algorithms_server_to_client() - { - return kp.compression_algorithms_server_to_client; - } - - public byte[] getCookie() - { - return kp.cookie; - } - - public String[] getEncryption_algorithms_client_to_server() - { - return kp.encryption_algorithms_client_to_server; - } - - public String[] getEncryption_algorithms_server_to_client() - { - return kp.encryption_algorithms_server_to_client; - } - - public boolean isFirst_kex_packet_follows() - { - return kp.first_kex_packet_follows; - } - - public String[] getKex_algorithms() - { - return kp.kex_algorithms; - } - - public String[] getLanguages_client_to_server() - { - return kp.languages_client_to_server; - } - - public String[] getLanguages_server_to_client() - { - return kp.languages_server_to_client; - } - - public String[] getMac_algorithms_client_to_server() - { - return kp.mac_algorithms_client_to_server; - } - - public String[] getMac_algorithms_server_to_client() - { - return kp.mac_algorithms_server_to_client; - } - - public int getReserved_field1() - { - return kp.reserved_field1; - } - - public String[] getServer_host_key_algorithms() - { - return kp.server_host_key_algorithms; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketNewKeys.java b/src/com/trilead/ssh2/packets/PacketNewKeys.java deleted file mode 100644 index 3ca6503..0000000 --- a/src/com/trilead/ssh2/packets/PacketNewKeys.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketNewKeys. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketNewKeys.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketNewKeys -{ - byte[] payload; - - public PacketNewKeys() - { - } - - public PacketNewKeys(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_NEWKEYS) - throw new IOException("This is not a SSH_MSG_NEWKEYS! (" - + packet_type + ")"); - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_NEWKEYS packet!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_NEWKEYS); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketOpenDirectTCPIPChannel.java b/src/com/trilead/ssh2/packets/PacketOpenDirectTCPIPChannel.java deleted file mode 100644 index da6cbef..0000000 --- a/src/com/trilead/ssh2/packets/PacketOpenDirectTCPIPChannel.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.trilead.ssh2.packets; - - -/** - * PacketOpenDirectTCPIPChannel. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketOpenDirectTCPIPChannel.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketOpenDirectTCPIPChannel -{ - byte[] payload; - - int channelID; - int initialWindowSize; - int maxPacketSize; - - String host_to_connect; - int port_to_connect; - String originator_IP_address; - int originator_port; - - public PacketOpenDirectTCPIPChannel(int channelID, int initialWindowSize, int maxPacketSize, - String host_to_connect, int port_to_connect, String originator_IP_address, - int originator_port) - { - this.channelID = channelID; - this.initialWindowSize = initialWindowSize; - this.maxPacketSize = maxPacketSize; - this.host_to_connect = host_to_connect; - this.port_to_connect = port_to_connect; - this.originator_IP_address = originator_IP_address; - this.originator_port = originator_port; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - - tw.writeByte(Packets.SSH_MSG_CHANNEL_OPEN); - tw.writeString("direct-tcpip"); - tw.writeUINT32(channelID); - tw.writeUINT32(initialWindowSize); - tw.writeUINT32(maxPacketSize); - tw.writeString(host_to_connect); - tw.writeUINT32(port_to_connect); - tw.writeString(originator_IP_address); - tw.writeUINT32(originator_port); - - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketOpenSessionChannel.java b/src/com/trilead/ssh2/packets/PacketOpenSessionChannel.java deleted file mode 100644 index a75ea63..0000000 --- a/src/com/trilead/ssh2/packets/PacketOpenSessionChannel.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketOpenSessionChannel. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketOpenSessionChannel.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketOpenSessionChannel -{ - byte[] payload; - - int channelID; - int initialWindowSize; - int maxPacketSize; - - public PacketOpenSessionChannel(int channelID, int initialWindowSize, - int maxPacketSize) - { - this.channelID = channelID; - this.initialWindowSize = initialWindowSize; - this.maxPacketSize = maxPacketSize; - } - - public PacketOpenSessionChannel(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_CHANNEL_OPEN) - throw new IOException("This is not a SSH_MSG_CHANNEL_OPEN! (" - + packet_type + ")"); - - channelID = tr.readUINT32(); - initialWindowSize = tr.readUINT32(); - maxPacketSize = tr.readUINT32(); - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_CHANNEL_OPEN packet!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_OPEN); - tw.writeString("session"); - tw.writeUINT32(channelID); - tw.writeUINT32(initialWindowSize); - tw.writeUINT32(maxPacketSize); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketServiceAccept.java b/src/com/trilead/ssh2/packets/PacketServiceAccept.java deleted file mode 100644 index d5c9a90..0000000 --- a/src/com/trilead/ssh2/packets/PacketServiceAccept.java +++ /dev/null @@ -1,61 +0,0 @@ - -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketServiceAccept. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketServiceAccept.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $ - */ -public class PacketServiceAccept -{ - byte[] payload; - - String serviceName; - - public PacketServiceAccept(String serviceName) - { - this.serviceName = serviceName; - } - - public PacketServiceAccept(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_SERVICE_ACCEPT) - throw new IOException("This is not a SSH_MSG_SERVICE_ACCEPT! (" + packet_type + ")"); - - /* Be clever in case the server is not. Some servers seem to violate RFC4253 */ - - if (tr.remain() > 0) - { - serviceName = tr.readString(); - } - else - { - serviceName = ""; - } - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_SERVICE_ACCEPT packet!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_SERVICE_ACCEPT); - tw.writeString(serviceName); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketServiceRequest.java b/src/com/trilead/ssh2/packets/PacketServiceRequest.java deleted file mode 100644 index c2d2065..0000000 --- a/src/com/trilead/ssh2/packets/PacketServiceRequest.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketServiceRequest. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketServiceRequest.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketServiceRequest -{ - byte[] payload; - - String serviceName; - - public PacketServiceRequest(String serviceName) - { - this.serviceName = serviceName; - } - - public PacketServiceRequest(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_SERVICE_REQUEST) - throw new IOException("This is not a SSH_MSG_SERVICE_REQUEST! (" - + packet_type + ")"); - - serviceName = tr.readString(); - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_SERVICE_REQUEST packet!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_SERVICE_REQUEST); - tw.writeString(serviceName); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketSessionExecCommand.java b/src/com/trilead/ssh2/packets/PacketSessionExecCommand.java deleted file mode 100644 index 84efa5d..0000000 --- a/src/com/trilead/ssh2/packets/PacketSessionExecCommand.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.trilead.ssh2.packets; - - -/** - * PacketSessionExecCommand. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketSessionExecCommand.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketSessionExecCommand -{ - byte[] payload; - - public int recipientChannelID; - public boolean wantReply; - public String command; - - public PacketSessionExecCommand(int recipientChannelID, boolean wantReply, String command) - { - this.recipientChannelID = recipientChannelID; - this.wantReply = wantReply; - this.command = command; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST); - tw.writeUINT32(recipientChannelID); - tw.writeString("exec"); - tw.writeBoolean(wantReply); - tw.writeString(command); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketSessionPtyRequest.java b/src/com/trilead/ssh2/packets/PacketSessionPtyRequest.java deleted file mode 100644 index d9c3d59..0000000 --- a/src/com/trilead/ssh2/packets/PacketSessionPtyRequest.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.trilead.ssh2.packets; - - -/** - * PacketSessionPtyRequest. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketSessionPtyRequest.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketSessionPtyRequest -{ - byte[] payload; - - public int recipientChannelID; - public boolean wantReply; - public String term; - public int character_width; - public int character_height; - public int pixel_width; - public int pixel_height; - public byte[] terminal_modes; - - public PacketSessionPtyRequest(int recipientChannelID, boolean wantReply, String term, - int character_width, int character_height, int pixel_width, int pixel_height, - byte[] terminal_modes) - { - this.recipientChannelID = recipientChannelID; - this.wantReply = wantReply; - this.term = term; - this.character_width = character_width; - this.character_height = character_height; - this.pixel_width = pixel_width; - this.pixel_height = pixel_height; - this.terminal_modes = terminal_modes; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST); - tw.writeUINT32(recipientChannelID); - tw.writeString("pty-req"); - tw.writeBoolean(wantReply); - tw.writeString(term); - tw.writeUINT32(character_width); - tw.writeUINT32(character_height); - tw.writeUINT32(pixel_width); - tw.writeUINT32(pixel_height); - tw.writeString(terminal_modes, 0, terminal_modes.length); - - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketSessionPtyResize.java b/src/com/trilead/ssh2/packets/PacketSessionPtyResize.java deleted file mode 100644 index 1e3b558..0000000 --- a/src/com/trilead/ssh2/packets/PacketSessionPtyResize.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.trilead.ssh2.packets; - -public class PacketSessionPtyResize { - byte[] payload; - - public int recipientChannelID; - public int width; - public int height; - public int pixelWidth; - public int pixelHeight; - - public PacketSessionPtyResize(int recipientChannelID, int width, int height, int pixelWidth, int pixelHeight) { - this.recipientChannelID = recipientChannelID; - this.width = width; - this.height = height; - this.pixelWidth = pixelWidth; - this.pixelHeight = pixelHeight; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST); - tw.writeUINT32(recipientChannelID); - tw.writeString("window-change"); - tw.writeBoolean(false); - tw.writeUINT32(width); - tw.writeUINT32(height); - tw.writeUINT32(pixelWidth); - tw.writeUINT32(pixelHeight); - - payload = tw.getBytes(); - } - return payload; - } -} - - diff --git a/src/com/trilead/ssh2/packets/PacketSessionStartShell.java b/src/com/trilead/ssh2/packets/PacketSessionStartShell.java deleted file mode 100644 index e5add01..0000000 --- a/src/com/trilead/ssh2/packets/PacketSessionStartShell.java +++ /dev/null @@ -1,36 +0,0 @@ - -package com.trilead.ssh2.packets; - -/** - * PacketSessionStartShell. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketSessionStartShell.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketSessionStartShell -{ - byte[] payload; - - public int recipientChannelID; - public boolean wantReply; - - public PacketSessionStartShell(int recipientChannelID, boolean wantReply) - { - this.recipientChannelID = recipientChannelID; - this.wantReply = wantReply; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST); - tw.writeUINT32(recipientChannelID); - tw.writeString("shell"); - tw.writeBoolean(wantReply); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketSessionSubsystemRequest.java b/src/com/trilead/ssh2/packets/PacketSessionSubsystemRequest.java deleted file mode 100644 index cdc3a8c..0000000 --- a/src/com/trilead/ssh2/packets/PacketSessionSubsystemRequest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.trilead.ssh2.packets; - - -/** - * PacketSessionSubsystemRequest. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketSessionSubsystemRequest.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketSessionSubsystemRequest -{ - byte[] payload; - - public int recipientChannelID; - public boolean wantReply; - public String subsystem; - - public PacketSessionSubsystemRequest(int recipientChannelID, boolean wantReply, String subsystem) - { - this.recipientChannelID = recipientChannelID; - this.wantReply = wantReply; - this.subsystem = subsystem; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST); - tw.writeUINT32(recipientChannelID); - tw.writeString("subsystem"); - tw.writeBoolean(wantReply); - tw.writeString(subsystem); - payload = tw.getBytes(); - tw.getBytes(payload); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketSessionX11Request.java b/src/com/trilead/ssh2/packets/PacketSessionX11Request.java deleted file mode 100644 index 26479c7..0000000 --- a/src/com/trilead/ssh2/packets/PacketSessionX11Request.java +++ /dev/null @@ -1,53 +0,0 @@ - -package com.trilead.ssh2.packets; - -/** - * PacketSessionX11Request. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketSessionX11Request.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketSessionX11Request -{ - byte[] payload; - - public int recipientChannelID; - public boolean wantReply; - - public boolean singleConnection; - String x11AuthenticationProtocol; - String x11AuthenticationCookie; - int x11ScreenNumber; - - public PacketSessionX11Request(int recipientChannelID, boolean wantReply, boolean singleConnection, - String x11AuthenticationProtocol, String x11AuthenticationCookie, int x11ScreenNumber) - { - this.recipientChannelID = recipientChannelID; - this.wantReply = wantReply; - - this.singleConnection = singleConnection; - this.x11AuthenticationProtocol = x11AuthenticationProtocol; - this.x11AuthenticationCookie = x11AuthenticationCookie; - this.x11ScreenNumber = x11ScreenNumber; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST); - tw.writeUINT32(recipientChannelID); - tw.writeString("x11-req"); - tw.writeBoolean(wantReply); - - tw.writeBoolean(singleConnection); - tw.writeString(x11AuthenticationProtocol); - tw.writeString(x11AuthenticationCookie); - tw.writeUINT32(x11ScreenNumber); - - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketUserauthBanner.java b/src/com/trilead/ssh2/packets/PacketUserauthBanner.java deleted file mode 100644 index 8ad8c3b..0000000 --- a/src/com/trilead/ssh2/packets/PacketUserauthBanner.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketUserauthBanner. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketUserauthBanner.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketUserauthBanner -{ - byte[] payload; - - String message; - String language; - - public PacketUserauthBanner(String message, String language) - { - this.message = message; - this.language = language; - } - - public String getBanner() - { - return message; - } - - public PacketUserauthBanner(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_USERAUTH_BANNER) - throw new IOException("This is not a SSH_MSG_USERAUTH_BANNER! (" + packet_type + ")"); - - message = tr.readString("UTF-8"); - language = tr.readString(); - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_USERAUTH_REQUEST packet!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_USERAUTH_BANNER); - tw.writeString(message); - tw.writeString(language); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketUserauthFailure.java b/src/com/trilead/ssh2/packets/PacketUserauthFailure.java deleted file mode 100644 index fd4a726..0000000 --- a/src/com/trilead/ssh2/packets/PacketUserauthFailure.java +++ /dev/null @@ -1,53 +0,0 @@ - -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketUserauthBanner. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketUserauthFailure.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketUserauthFailure -{ - byte[] payload; - - String[] authThatCanContinue; - boolean partialSuccess; - - public PacketUserauthFailure(String[] authThatCanContinue, boolean partialSuccess) - { - this.authThatCanContinue = authThatCanContinue; - this.partialSuccess = partialSuccess; - } - - public PacketUserauthFailure(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_USERAUTH_FAILURE) - throw new IOException("This is not a SSH_MSG_USERAUTH_FAILURE! (" + packet_type + ")"); - - authThatCanContinue = tr.readNameList(); - partialSuccess = tr.readBoolean(); - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_USERAUTH_FAILURE packet!"); - } - - public String[] getAuthThatCanContinue() - { - return authThatCanContinue; - } - - public boolean isPartialSuccess() - { - return partialSuccess; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketUserauthInfoRequest.java b/src/com/trilead/ssh2/packets/PacketUserauthInfoRequest.java deleted file mode 100644 index e1606d1..0000000 --- a/src/com/trilead/ssh2/packets/PacketUserauthInfoRequest.java +++ /dev/null @@ -1,84 +0,0 @@ - -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketUserauthInfoRequest. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketUserauthInfoRequest.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketUserauthInfoRequest -{ - byte[] payload; - - String name; - String instruction; - String languageTag; - int numPrompts; - - String prompt[]; - boolean echo[]; - - public PacketUserauthInfoRequest(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_USERAUTH_INFO_REQUEST) - throw new IOException("This is not a SSH_MSG_USERAUTH_INFO_REQUEST! (" + packet_type + ")"); - - name = tr.readString(); - instruction = tr.readString(); - languageTag = tr.readString(); - - numPrompts = tr.readUINT32(); - - prompt = new String[numPrompts]; - echo = new boolean[numPrompts]; - - for (int i = 0; i < numPrompts; i++) - { - prompt[i] = tr.readString(); - echo[i] = tr.readBoolean(); - } - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_USERAUTH_INFO_REQUEST packet!"); - } - - public boolean[] getEcho() - { - return echo; - } - - public String getInstruction() - { - return instruction; - } - - public String getLanguageTag() - { - return languageTag; - } - - public String getName() - { - return name; - } - - public int getNumPrompts() - { - return numPrompts; - } - - public String[] getPrompt() - { - return prompt; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketUserauthInfoResponse.java b/src/com/trilead/ssh2/packets/PacketUserauthInfoResponse.java deleted file mode 100644 index e8795d4..0000000 --- a/src/com/trilead/ssh2/packets/PacketUserauthInfoResponse.java +++ /dev/null @@ -1,35 +0,0 @@ - -package com.trilead.ssh2.packets; - -/** - * PacketUserauthInfoResponse. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketUserauthInfoResponse.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketUserauthInfoResponse -{ - byte[] payload; - - String[] responses; - - public PacketUserauthInfoResponse(String[] responses) - { - this.responses = responses; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_USERAUTH_INFO_RESPONSE); - tw.writeUINT32(responses.length); - for (int i = 0; i < responses.length; i++) - tw.writeString(responses[i]); - - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketUserauthRequestInteractive.java b/src/com/trilead/ssh2/packets/PacketUserauthRequestInteractive.java deleted file mode 100644 index 83e9f49..0000000 --- a/src/com/trilead/ssh2/packets/PacketUserauthRequestInteractive.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.trilead.ssh2.packets; - -/** - * PacketUserauthRequestInteractive. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketUserauthRequestInteractive.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketUserauthRequestInteractive -{ - byte[] payload; - - String userName; - String serviceName; - String[] submethods; - - public PacketUserauthRequestInteractive(String serviceName, String user, String[] submethods) - { - this.serviceName = serviceName; - this.userName = user; - this.submethods = submethods; - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_USERAUTH_REQUEST); - tw.writeString(userName); - tw.writeString(serviceName); - tw.writeString("keyboard-interactive"); - tw.writeString(""); // draft-ietf-secsh-newmodes-04.txt says that - // the language tag should be empty. - tw.writeNameList(submethods); - - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketUserauthRequestNone.java b/src/com/trilead/ssh2/packets/PacketUserauthRequestNone.java deleted file mode 100644 index d786003..0000000 --- a/src/com/trilead/ssh2/packets/PacketUserauthRequestNone.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketUserauthRequestPassword. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketUserauthRequestNone.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketUserauthRequestNone -{ - byte[] payload; - - String userName; - String serviceName; - - public PacketUserauthRequestNone(String serviceName, String user) - { - this.serviceName = serviceName; - this.userName = user; - } - - public PacketUserauthRequestNone(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_USERAUTH_REQUEST) - throw new IOException("This is not a SSH_MSG_USERAUTH_REQUEST! (" + packet_type + ")"); - - userName = tr.readString(); - serviceName = tr.readString(); - - String method = tr.readString(); - - if (method.equals("none") == false) - throw new IOException("This is not a SSH_MSG_USERAUTH_REQUEST with type none!"); - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_USERAUTH_REQUEST packet!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_USERAUTH_REQUEST); - tw.writeString(userName); - tw.writeString(serviceName); - tw.writeString("none"); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketUserauthRequestPassword.java b/src/com/trilead/ssh2/packets/PacketUserauthRequestPassword.java deleted file mode 100644 index 83047dd..0000000 --- a/src/com/trilead/ssh2/packets/PacketUserauthRequestPassword.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketUserauthRequestPassword. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketUserauthRequestPassword.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketUserauthRequestPassword -{ - byte[] payload; - - String userName; - String serviceName; - String password; - - public PacketUserauthRequestPassword(String serviceName, String user, String pass) - { - this.serviceName = serviceName; - this.userName = user; - this.password = pass; - } - - public PacketUserauthRequestPassword(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_USERAUTH_REQUEST) - throw new IOException("This is not a SSH_MSG_USERAUTH_REQUEST! (" + packet_type + ")"); - - userName = tr.readString(); - serviceName = tr.readString(); - - String method = tr.readString(); - - if (method.equals("password") == false) - throw new IOException("This is not a SSH_MSG_USERAUTH_REQUEST with type password!"); - - /* ... */ - - if (tr.remain() != 0) - throw new IOException("Padding in SSH_MSG_USERAUTH_REQUEST packet!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_USERAUTH_REQUEST); - tw.writeString(userName); - tw.writeString(serviceName); - tw.writeString("password"); - tw.writeBoolean(false); - tw.writeString(password); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/PacketUserauthRequestPublicKey.java b/src/com/trilead/ssh2/packets/PacketUserauthRequestPublicKey.java deleted file mode 100644 index 6462864..0000000 --- a/src/com/trilead/ssh2/packets/PacketUserauthRequestPublicKey.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.trilead.ssh2.packets; - -import java.io.IOException; - -/** - * PacketUserauthRequestPublicKey. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: PacketUserauthRequestPublicKey.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class PacketUserauthRequestPublicKey -{ - byte[] payload; - - String userName; - String serviceName; - String password; - String pkAlgoName; - byte[] pk; - byte[] sig; - - public PacketUserauthRequestPublicKey(String serviceName, String user, - String pkAlgorithmName, byte[] pk, byte[] sig) - { - this.serviceName = serviceName; - this.userName = user; - this.pkAlgoName = pkAlgorithmName; - this.pk = pk; - this.sig = sig; - } - - public PacketUserauthRequestPublicKey(byte payload[], int off, int len) throws IOException - { - this.payload = new byte[len]; - System.arraycopy(payload, off, this.payload, 0, len); - - TypesReader tr = new TypesReader(payload, off, len); - - int packet_type = tr.readByte(); - - if (packet_type != Packets.SSH_MSG_USERAUTH_REQUEST) - throw new IOException("This is not a SSH_MSG_USERAUTH_REQUEST! (" - + packet_type + ")"); - - throw new IOException("Not implemented!"); - } - - public byte[] getPayload() - { - if (payload == null) - { - TypesWriter tw = new TypesWriter(); - tw.writeByte(Packets.SSH_MSG_USERAUTH_REQUEST); - tw.writeString(userName); - tw.writeString(serviceName); - tw.writeString("publickey"); - tw.writeBoolean(true); - tw.writeString(pkAlgoName); - tw.writeString(pk, 0, pk.length); - tw.writeString(sig, 0, sig.length); - payload = tw.getBytes(); - } - return payload; - } -} diff --git a/src/com/trilead/ssh2/packets/Packets.java b/src/com/trilead/ssh2/packets/Packets.java deleted file mode 100644 index 6989286..0000000 --- a/src/com/trilead/ssh2/packets/Packets.java +++ /dev/null @@ -1,149 +0,0 @@ - -package com.trilead.ssh2.packets; - -/** - * Packets. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: Packets.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ - */ -public class Packets -{ - public static final int SSH_MSG_DISCONNECT = 1; - public static final int SSH_MSG_IGNORE = 2; - public static final int SSH_MSG_UNIMPLEMENTED = 3; - public static final int SSH_MSG_DEBUG = 4; - public static final int SSH_MSG_SERVICE_REQUEST = 5; - public static final int SSH_MSG_SERVICE_ACCEPT = 6; - - public static final int SSH_MSG_KEXINIT = 20; - public static final int SSH_MSG_NEWKEYS = 21; - - public static final int SSH_MSG_KEXDH_INIT = 30; - public static final int SSH_MSG_KEXDH_REPLY = 31; - - public static final int SSH_MSG_KEX_DH_GEX_REQUEST_OLD = 30; - public static final int SSH_MSG_KEX_DH_GEX_REQUEST = 34; - public static final int SSH_MSG_KEX_DH_GEX_GROUP = 31; - public static final int SSH_MSG_KEX_DH_GEX_INIT = 32; - public static final int SSH_MSG_KEX_DH_GEX_REPLY = 33; - - public static final int SSH_MSG_USERAUTH_REQUEST = 50; - public static final int SSH_MSG_USERAUTH_FAILURE = 51; - public static final int SSH_MSG_USERAUTH_SUCCESS = 52; - public static final int SSH_MSG_USERAUTH_BANNER = 53; - public static final int SSH_MSG_USERAUTH_INFO_REQUEST = 60; - public static final int SSH_MSG_USERAUTH_INFO_RESPONSE = 61; - - public static final int SSH_MSG_GLOBAL_REQUEST = 80; - public static final int SSH_MSG_REQUEST_SUCCESS = 81; - public static final int SSH_MSG_REQUEST_FAILURE = 82; - - public static final int SSH_MSG_CHANNEL_OPEN = 90; - public static final int SSH_MSG_CHANNEL_OPEN_CONFIRMATION = 91; - public static final int SSH_MSG_CHANNEL_OPEN_FAILURE = 92; - public static final int SSH_MSG_CHANNEL_WINDOW_ADJUST = 93; - public static final int SSH_MSG_CHANNEL_DATA = 94; - public static final int SSH_MSG_CHANNEL_EXTENDED_DATA = 95; - public static final int SSH_MSG_CHANNEL_EOF = 96; - public static final int SSH_MSG_CHANNEL_CLOSE = 97; - public static final int SSH_MSG_CHANNEL_REQUEST = 98; - public static final int SSH_MSG_CHANNEL_SUCCESS = 99; - public static final int SSH_MSG_CHANNEL_FAILURE = 100; - - public static final int SSH_EXTENDED_DATA_STDERR = 1; - - public static final int SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT = 1; - public static final int SSH_DISCONNECT_PROTOCOL_ERROR = 2; - public static final int SSH_DISCONNECT_KEY_EXCHANGE_FAILED = 3; - public static final int SSH_DISCONNECT_RESERVED = 4; - public static final int SSH_DISCONNECT_MAC_ERROR = 5; - public static final int SSH_DISCONNECT_COMPRESSION_ERROR = 6; - public static final int SSH_DISCONNECT_SERVICE_NOT_AVAILABLE = 7; - public static final int SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED = 8; - public static final int SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE = 9; - public static final int SSH_DISCONNECT_CONNECTION_LOST = 10; - public static final int SSH_DISCONNECT_BY_APPLICATION = 11; - public static final int SSH_DISCONNECT_TOO_MANY_CONNECTIONS = 12; - public static final int SSH_DISCONNECT_AUTH_CANCELLED_BY_USER = 13; - public static final int SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14; - public static final int SSH_DISCONNECT_ILLEGAL_USER_NAME = 15; - - public static final int SSH_OPEN_ADMINISTRATIVELY_PROHIBITED = 1; - public static final int SSH_OPEN_CONNECT_FAILED = 2; - public static final int SSH_OPEN_UNKNOWN_CHANNEL_TYPE = 3; - public static final int SSH_OPEN_RESOURCE_SHORTAGE = 4; - - private static final String[] reverseNames = new String[101]; - - static - { - reverseNames[1] = "SSH_MSG_DISCONNECT"; - reverseNames[2] = "SSH_MSG_IGNORE"; - reverseNames[3] = "SSH_MSG_UNIMPLEMENTED"; - reverseNames[4] = "SSH_MSG_DEBUG"; - reverseNames[5] = "SSH_MSG_SERVICE_REQUEST"; - reverseNames[6] = "SSH_MSG_SERVICE_ACCEPT"; - - reverseNames[20] = "SSH_MSG_KEXINIT"; - reverseNames[21] = "SSH_MSG_NEWKEYS"; - - reverseNames[30] = "SSH_MSG_KEXDH_INIT"; - reverseNames[31] = "SSH_MSG_KEXDH_REPLY/SSH_MSG_KEX_DH_GEX_GROUP"; - reverseNames[32] = "SSH_MSG_KEX_DH_GEX_INIT"; - reverseNames[33] = "SSH_MSG_KEX_DH_GEX_REPLY"; - reverseNames[34] = "SSH_MSG_KEX_DH_GEX_REQUEST"; - - reverseNames[50] = "SSH_MSG_USERAUTH_REQUEST"; - reverseNames[51] = "SSH_MSG_USERAUTH_FAILURE"; - reverseNames[52] = "SSH_MSG_USERAUTH_SUCCESS"; - reverseNames[53] = "SSH_MSG_USERAUTH_BANNER"; - - reverseNames[60] = "SSH_MSG_USERAUTH_INFO_REQUEST"; - reverseNames[61] = "SSH_MSG_USERAUTH_INFO_RESPONSE"; - - reverseNames[80] = "SSH_MSG_GLOBAL_REQUEST"; - reverseNames[81] = "SSH_MSG_REQUEST_SUCCESS"; - reverseNames[82] = "SSH_MSG_REQUEST_FAILURE"; - - reverseNames[90] = "SSH_MSG_CHANNEL_OPEN"; - reverseNames[91] = "SSH_MSG_CHANNEL_OPEN_CONFIRMATION"; - reverseNames[92] = "SSH_MSG_CHANNEL_OPEN_FAILURE"; - reverseNames[93] = "SSH_MSG_CHANNEL_WINDOW_ADJUST"; - reverseNames[94] = "SSH_MSG_CHANNEL_DATA"; - reverseNames[95] = "SSH_MSG_CHANNEL_EXTENDED_DATA"; - reverseNames[96] = "SSH_MSG_CHANNEL_EOF"; - reverseNames[97] = "SSH_MSG_CHANNEL_CLOSE"; - reverseNames[98] = "SSH_MSG_CHANNEL_REQUEST"; - reverseNames[99] = "SSH_MSG_CHANNEL_SUCCESS"; - reverseNames[100] = "SSH_MSG_CHANNEL_FAILURE"; - } - - public static final String getMessageName(int type) - { - String res = null; - - if ((type >= 0) && (type < reverseNames.length)) - { - res = reverseNames[type]; - } - - return (res == null) ? ("UNKNOWN MSG " + type) : res; - } - - // public static final void debug(String tag, byte[] msg) - // { - // System.err.println(tag + " Type: " + msg[0] + ", LEN: " + msg.length); - // - // for (int i = 0; i < msg.length; i++) - // { - // if (((msg[i] >= 'a') && (msg[i] <= 'z')) || ((msg[i] >= 'A') && (msg[i] <= 'Z')) - // || ((msg[i] >= '0') && (msg[i] <= '9')) || (msg[i] == ' ')) - // System.err.print((char) msg[i]); - // else - // System.err.print("."); - // } - // System.err.println(); - // System.err.flush(); - // } -} diff --git a/src/com/trilead/ssh2/packets/TypesReader.java b/src/com/trilead/ssh2/packets/TypesReader.java deleted file mode 100644 index 28f5363..0000000 --- a/src/com/trilead/ssh2/packets/TypesReader.java +++ /dev/null @@ -1,177 +0,0 @@ - -package com.trilead.ssh2.packets; - -import java.io.IOException; -import java.math.BigInteger; - -import com.trilead.ssh2.util.Tokenizer; - - -/** - * TypesReader. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: TypesReader.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $ - */ -public class TypesReader -{ - byte[] arr; - int pos = 0; - int max = 0; - - public TypesReader(byte[] arr) - { - this.arr = arr; - pos = 0; - max = arr.length; - } - - public TypesReader(byte[] arr, int off) - { - this.arr = arr; - this.pos = off; - this.max = arr.length; - - if ((pos < 0) || (pos > arr.length)) - throw new IllegalArgumentException("Illegal offset."); - } - - public TypesReader(byte[] arr, int off, int len) - { - this.arr = arr; - this.pos = off; - this.max = off + len; - - if ((pos < 0) || (pos > arr.length)) - throw new IllegalArgumentException("Illegal offset."); - - if ((max < 0) || (max > arr.length)) - throw new IllegalArgumentException("Illegal length."); - } - - public int readByte() throws IOException - { - if (pos >= max) - throw new IOException("Packet too short."); - - return (arr[pos++] & 0xff); - } - - public byte[] readBytes(int len) throws IOException - { - if ((pos + len) > max) - throw new IOException("Packet too short."); - - byte[] res = new byte[len]; - - System.arraycopy(arr, pos, res, 0, len); - pos += len; - - return res; - } - - public void readBytes(byte[] dst, int off, int len) throws IOException - { - if ((pos + len) > max) - throw new IOException("Packet too short."); - - System.arraycopy(arr, pos, dst, off, len); - pos += len; - } - - public boolean readBoolean() throws IOException - { - if (pos >= max) - throw new IOException("Packet too short."); - - return (arr[pos++] != 0); - } - - public int readUINT32() throws IOException - { - if ((pos + 4) > max) - throw new IOException("Packet too short."); - - return ((arr[pos++] & 0xff) << 24) | ((arr[pos++] & 0xff) << 16) | ((arr[pos++] & 0xff) << 8) - | (arr[pos++] & 0xff); - } - - public long readUINT64() throws IOException - { - if ((pos + 8) > max) - throw new IOException("Packet too short."); - - long high = ((arr[pos++] & 0xff) << 24) | ((arr[pos++] & 0xff) << 16) | ((arr[pos++] & 0xff) << 8) - | (arr[pos++] & 0xff); /* sign extension may take place - will be shifted away =) */ - - long low = ((arr[pos++] & 0xff) << 24) | ((arr[pos++] & 0xff) << 16) | ((arr[pos++] & 0xff) << 8) - | (arr[pos++] & 0xff); /* sign extension may take place - handle below */ - - return (high << 32) | (low & 0xffffffffl); /* see Java language spec (15.22.1, 5.6.2) */ - } - - public BigInteger readMPINT() throws IOException - { - BigInteger b; - - byte raw[] = readByteString(); - - if (raw.length == 0) - b = BigInteger.ZERO; - else - b = new BigInteger(raw); - - return b; - } - - public byte[] readByteString() throws IOException - { - int len = readUINT32(); - - if ((len + pos) > max) - throw new IOException("Malformed SSH byte string."); - - byte[] res = new byte[len]; - System.arraycopy(arr, pos, res, 0, len); - pos += len; - return res; - } - - public String readString(String charsetName) throws IOException - { - int len = readUINT32(); - - if ((len + pos) > max) - throw new IOException("Malformed SSH string."); - - String res = (charsetName == null) ? new String(arr, pos, len) : new String(arr, pos, len, charsetName); - pos += len; - - return res; - } - - public String readString() throws IOException - { - int len = readUINT32(); - - if ((len + pos) > max) - throw new IOException("Malformed SSH string."); - - String res = new String(arr, pos, len, "ISO-8859-1"); - - pos += len; - - return res; - } - - public String[] readNameList() throws IOException - { - return Tokenizer.parseTokens(readString(), ','); - } - - public int remain() - { - return max - pos; - } - -} diff --git a/src/com/trilead/ssh2/packets/TypesWriter.java b/src/com/trilead/ssh2/packets/TypesWriter.java deleted file mode 100644 index 9f7336b..0000000 --- a/src/com/trilead/ssh2/packets/TypesWriter.java +++ /dev/null @@ -1,169 +0,0 @@ - -package com.trilead.ssh2.packets; - -import java.io.UnsupportedEncodingException; -import java.math.BigInteger; - -/** - * TypesWriter. - * - * @author Christian Plattner, plattner@trilead.com - * @version $Id: TypesWriter.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $ - */ -public class TypesWriter -{ - byte arr[]; - int pos; - - public TypesWriter() - { - arr = new byte[256]; - pos = 0; - } - - private void resize(int len) - { - byte new_arr[] = new byte[len]; - System.arraycopy(arr, 0, new_arr, 0, arr.length); - arr = new_arr; - } - - public int length() - { - return pos; - } - - public byte[] getBytes() - { - byte[] dst = new byte[pos]; - System.arraycopy(arr, 0, dst, 0, pos); - return dst; - } - - public void getBytes(byte dst[]) - { - System.arraycopy(arr, 0, dst, 0, pos); - } - - public void writeUINT32(int val, int off) - { - if ((off + 4) > arr.length) - resize(off + 32); - - arr[off++] = (byte) (val >> 24); - arr[off++] = (byte) (val >> 16); - arr[off++] = (byte) (val >> 8); - arr[off++] = (byte) val; - } - - public void writeUINT32(int val) - { - writeUINT32(val, pos); - pos += 4; - } - - public void writeUINT64(long val) - { - if ((pos + 8) > arr.length) - resize(arr.length + 32); - - arr[pos++] = (byte) (val >> 56); - arr[pos++] = (byte) (val >> 48); - arr[pos++] = (byte) (val >> 40); - arr[pos++] = (byte) (val >> 32); - arr[pos++] = (byte) (val >> 24); - arr[pos++] = (byte) (val >> 16); - arr[pos++] = (byte) (val >> 8); - arr[pos++] = (byte) val; - } - - public void writeBoolean(boolean v) - { - if ((pos + 1) > arr.length) - resize(arr.length + 32); - - arr[pos++] = v ? (byte) 1 : (byte) 0; - } - - public void writeByte(int v, int off) - { - if ((off + 1) > arr.length) - resize(off + 32); - - arr[off] = (byte) v; - } - - public void writeByte(int v) - { - writeByte(v, pos); - pos++; - } - - public void writeMPInt(BigInteger b) - { - byte raw[] = b.toByteArray(); - - if ((raw.length == 1) && (raw[0] == 0)) - writeUINT32(0); /* String with zero bytes of data */ - else - writeString(raw, 0, raw.length); - } - - public void writeBytes(byte[] buff) - { - writeBytes(buff, 0, buff.length); - } - - public void writeBytes(byte[] buff, int off, int len) - { - if ((pos + len) > arr.length) - resize(arr.length + len + 32); - - System.arraycopy(buff, off, arr, pos, len); - pos += len; - } - - public void writeString(byte[] buff, int off, int len) - { - writeUINT32(len); - writeBytes(buff, off, len); - } - - public void writeString(String v) - { - byte[] b; - - try - { - /* All Java JVMs must support ISO-8859-1 */ - b = v.getBytes("ISO-8859-1"); - } - catch (UnsupportedEncodingException ignore) - { - b = v.getBytes(); - } - - writeUINT32(b.length); - writeBytes(b, 0, b.length); - } - - public void writeString(String v, String charsetName) throws UnsupportedEncodingException - { - byte[] b = (charsetName == null) ? v.getBytes() : v.getBytes(charsetName); - - writeUINT32(b.length); - writeBytes(b, 0, b.length); - } - - public void writeNameList(String v[]) - { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < v.length; i++) - { - if (i > 0) - sb.append(','); - sb.append(v[i]); - } - writeString(sb.toString()); - } -} -- cgit v1.2.3