Esempio n. 1
0
        private void B_start_Click(object sender, EventArgs e)
        {
            string Username = T_username.Text.ToLower();
            string NCPass = T_password.Text.ToLower();

            Client.User = Username;

            SHA256Managed Sha = new SHA256Managed();
            string CP = Username + ":" + NCPass;
            byte[] Result = Sha.ComputeHash(UTF8Encoding.UTF8.GetBytes(CP));

            PacketOut Out = new PacketOut((byte)Opcodes.CL_START);
            Out.WriteString(Username);
            Out.WriteUInt32((uint)Result.Length);
            Out.Write(Result, 0, Result.Length);

            Client.SendTCP(Out);
            B_start.Enabled = false;
        }
Esempio n. 2
0
        static public void SendCheck()
        {
            PacketOut Out = new PacketOut((byte)Opcodes.CL_CHECK);

            Out.WriteUInt32((uint)Version);

            FileInfo Info = new FileInfo("mythloginserviceconfig.xml");

            if (Info.Exists)
            {
                Out.WriteByte(1);
                Out.WriteUInt64((ulong)Info.Length);
            }
            else
            {
                Out.WriteByte(0);
            }

            SendTCP(Out);
        }
Esempio n. 3
0
        private void B_start_Click(object sender, EventArgs e)
        {
            string Username = T_username.Text.ToLower();
            string NCPass   = T_password.Text.ToLower();

            Client.User = Username;

            SHA256Managed Sha = new SHA256Managed();
            string        CP  = Username + ":" + NCPass;

            byte[] Result = Sha.ComputeHash(UTF8Encoding.UTF8.GetBytes(CP));

            PacketOut Out = new PacketOut((byte)Opcodes.CL_START);

            Out.WriteString(Username);
            Out.WriteUInt32((uint)Result.Length);
            Out.Write(Result, 0, Result.Length);

            Client.SendTCP(Out);
            B_start.Enabled = false;
        }
Esempio n. 4
0
        private void bnConnectToLocal_Click(object sender, EventArgs e)
        {
            Client.Connect(LocalServerIP, LocalServerPort);
            lblConnection.Text = $@"Connecting to : {LocalServerIP}:{LocalServerPort}";

            string userCode     = T_username.Text.ToLower();
            string userPassword = T_password.Text.ToLower();


            Client.User = userCode;

            string encryptedPassword = ConvertSHA256(userCode + ":" + userPassword);

            _logger.Info($@"Connecting to : {LocalServerIP}:{LocalServerPort} as {userCode} [{encryptedPassword}]");

            _logger.Info($"Sending CL_START to {LocalServerIP}:{LocalServerPort}");
            PacketOut Out = new PacketOut((byte)Opcodes.CL_START);

            Out.WriteString(userCode);
            Out.WriteString(encryptedPassword);

            Client.SendTCP(Out);
        }
Esempio n. 5
0
        private void bnConnectToServer_Click(object sender, EventArgs e)
        {
            Client.Connect(TestServerIP, TestServerPort);
            lblConnection.Text = $@"Connecting to : {TestServerIP}:{TestServerPort}";

            string userCode     = T_username.Text.ToLower();
            string userPassword = T_password.Text.ToLower();


            Client.User = userCode;

            string encryptedPassword = ConvertSHA256(userCode + ":" + userPassword);

            _logger.Info($@"Connecting to : {TestServerIP}:{TestServerPort} as {userCode} [{encryptedPassword}]");

            _logger.Info($"Sending CL_START to {TestServerIP}:{TestServerPort}");
            PacketOut Out = new PacketOut((byte)Opcodes.CL_START);

            Out.WriteString(userCode);
            Out.WriteString(encryptedPassword);

            Client.SendTCP(Out);

            Configuration configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            if (configuration.AppSettings.Settings["LastUSerCode"] == null)
            {
                configuration.AppSettings.Settings.Add("LastUserCode", T_username.Text);
            }
            else
            {
                configuration.AppSettings.Settings["LastUserCode"].Value = T_username.Text;
            }
            configuration.Save();

            System.Configuration.ConfigurationManager.RefreshSection("appSettings");
        }
Esempio n. 6
0
 public static void SendTCPRaw(PacketOut packet)
 {
     SendTCP((byte[])packet.GetBuffer().Clone());
 }
Esempio n. 7
0
        public static void UpdateRealms()
        {
            PacketOut Out = new PacketOut((byte)Opcodes.CL_INFO);

            SendTCP(Out);
        }
Esempio n. 8
0
 public static void UpdateRealms()
 {
     PacketOut Out = new PacketOut((byte)Opcodes.CL_INFO);
     SendTCP(Out);
 }
Esempio n. 9
0
 public static void SendTCPRaw(PacketOut packet)
 {
     SendTCP((byte[])packet.GetBuffer().Clone());
 }
Esempio n. 10
0
        // Envoi un packet
        public static void SendTCP(PacketOut packet)
        {
            //Fix the packet size
            packet.WritePacketLength();

            //Get the packet buffer
            byte[] buf = packet.GetBuffer(); //packet.WritePacketLength sets the Capacity

            //Send the buffer
            SendTCP(buf);
        }
Esempio n. 11
0
        public static void SendCheck()
        {
            PacketOut Out = new PacketOut((byte)Opcodes.CL_CHECK);
            Out.WriteUInt32((uint)Version);

            FileInfo Info = new FileInfo("mythloginserviceconfig.xml");
            if (Info.Exists)
            {
                Out.WriteByte(1);
                Out.WriteUInt64((ulong)Info.Length);
            }
            else
            {
                Out.WriteByte(0);
            }

            SendTCP(Out);
        }
Esempio n. 12
0
        private void B_start_Click(object sender, EventArgs e)
        {
            string Username = T_username.Text.ToLower();
            string NCPass = T_password.Text.ToLower();
            // Je Fawk | 13 April 2014 | Making it fool proof encapsulating everything in the if statement
            if (Username.Length > 1 && NCPass.Length > 1 && textBox_serverIp.Text.Length > 8 && textBox_port.Text.Length > 0)
            {
                // Je Fawk | 13 April 2014 | Getting the server ip and port via interface
                // Putting the server IP from the textBox to Client.IP
                Client.IP = textBox_serverIp.Text.Trim();
                // Putting the server port from the textBox to Client.Port
                Client.Port = Convert.ToInt32(textBox_port.Text.Trim());
                Client.User = Username;

                // Connecting to the client now that we have all the credentials
                Client.Connect();

                SHA256Managed Sha = new SHA256Managed();
                string CP = Username + ":" + NCPass;
                byte[] Result = Sha.ComputeHash(UTF8Encoding.UTF8.GetBytes(CP));

                PacketOut Out = new PacketOut((byte)Opcodes.CL_START);
                Out.WriteString(Username);
                Out.WriteUInt32((uint)Result.Length);
                Out.Write(Result, 0, Result.Length);

                Client.SendTCP(Out);
                B_start.Enabled = false;

                // Je Fawk | 13 April 2014 | Setting the isConnected to true in case the user checks the realm status
                isConnected = true;
                // Je Fawk | 13 April 2014 | Minimizing the form that gets in the way
                this.WindowState = FormWindowState.Minimized;
            }
            else
            {
                MessageBox.Show("Credentials are too short.");
            }
        }