示例#1
0
        private static void send_AttachUserRequest()
        {
            RdpPacket data = new RdpPacket();

            data.WriteByte((byte)(AURQ << 2));
            IsoLayer.SendTPKT(data);
        }
示例#2
0
        private static void send_ErectDomainRequest()
        {
            RdpPacket data = new RdpPacket();

            data.WriteByte((byte)(EDRQ << 2));
            data.WriteBigEndian16((short)1);
            data.WriteBigEndian16((short)1);
            IsoLayer.SendTPKT(data);
        }
示例#3
0
        private static void send_ChannelJoinRequest(int channelid)
        {
            RdpPacket data = new RdpPacket();

            data.WriteByte((byte)(CJRQ << 2));
            data.WriteBigEndian16((short)RDPClient.McsUserID);
            data.WriteBigEndian16((short)channelid);
            IsoLayer.SendTPKT(data);
        }
示例#4
0
        public static void Disconnect()
        {
            RdpPacket packet = new RdpPacket();

            packet.WriteLittleEndian16((short)1);
            packet.WriteLittleEndian16((short)0x3ea);
            IsoLayer.sendDataPDU(packet, IsoLayer.PDUType2.PDUTYPE2_SHUTDOWN_REQUEST, Secure.RDPEncrypted() ? SEC_ENCRYPT : 0);
            packet = new RdpPacket();
            packet.WriteByte((byte)(DPUM << 2));
            packet.WriteByte(3);
            IsoLayer.SendTPKT(packet);
        }
示例#5
0
        internal static void send_connection_request(byte[] loadBalanceToken, bool bAutoReconnect)
        {
            int num;

            RDPClient.dec_count     = 0;
            RDPClient.enc_count     = 0;
            Network.ConnectionStage = RDPClient.eConnectionStage.Negotiating;
            if (RDPClient.enableNLA)
            {
                sendConnectNegotiation(3, loadBalanceToken);
                num = receiveConnectNegotiation();

                if (num == 0x10000000)
                {
                    Network.Close();
                    Network.Connect(RDPClient.Host, RDPClient.Port);
                    sendConnectNegotiation(0, loadBalanceToken);
                    num = receiveConnectNegotiation();

                    if (num != 0)
                    {
                        throw new RDFatalException("Security negotiation failed!");
                    }
                }
                else
                {
                    if (((num & 1) != 0) || ((num & 2) != 0))
                    {
                        Network.ConnectionStage = RDPClient.eConnectionStage.Securing;
                        Network.ConnectSSL();
                    }
                    if ((num & 2) != 0)
                    {
                        Network.ConnectionStage = RDPClient.eConnectionStage.Authenticating;
                        CredSSP.Negotiate(Network.GetSSLPublicKey());
                    }
                }
            }
            else
            {
                sendConnectNegotiation(0, loadBalanceToken);
                num = receiveConnectNegotiation();
                if (num != 0)
                {
                    throw new RDFatalException("Security negotiation failed!");
                }
            }

            Network.ConnectionStage = RDPClient.eConnectionStage.Establishing;
            IsoLayer.SendTPKT(sendConnectInitial(sendMcsData(true, Channels.RegisteredChannels.Count, num)));
            receiveConnectResponse();
            send_ErectDomainRequest();
            send_AttachUserRequest();
            RDPClient.McsUserID = receive_AttachUserConfirm();
            send_ChannelJoinRequest(RDPClient.McsUserID + MCS_USERCHANNEL_BASE);
            receive_ChannelJoinConfirm();
            send_ChannelJoinRequest(MSC_GLOBAL_CHANNEL);
            receive_ChannelJoinConfirm();
            foreach (IVirtualChannel channel in Channels.RegisteredChannels)
            {
                send_ChannelJoinRequest(channel.ChannelID);
                receive_ChannelJoinConfirm();
            }
            int num2 = 0x40;

            if (Secure.RDPEncrypted())
            {
                Network.ConnectionStage = RDPClient.eConnectionStage.SecureAndLogin;
                RdpPacket packet = Secure.establishKey();
                packet.Position = 0L;
                IsoLayer.SendMCS(packet, MSC_GLOBAL_CHANNEL);
                num2 |= SEC_ENCRYPT;
            }
            else
            {
                Network.ConnectionStage = RDPClient.eConnectionStage.Login;
            }
            IsoLayer.SendMCS_GlobalChannel(getLoginInfo(RDPClient.Domain, RDPClient.Username, RDPClient.Password, "", "", bAutoReconnect), num2);
        }