عرض مشاركة واحدة
قديم 2019-12-02, 03:23 PM
المشاركة 8
Rider
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكلة بخصوص ال login
جرب تبدل auth ب ده

كود:
using Rayzo.Network.Cryptography;
using System;
using System.IO;
using System.Text;

namespace 
Rayzo.Network.AuthPackets
{
    public 
unsafe class Authentications Interfaces.IPacket
    
{
        public 
string Username;
        public 
string Password;
        public 
string Server;
        public 
string MacAddress;

        public 
Authentications()
        {
        }
        public 
void Deserialize(byte[] buffer)
        {
            if (
buffer.Length == 312)
            {
                
ushort length BitConverter.ToUInt16(buffer0);

                if (
length == 312)
                {

                    
ushort type BitConverter.ToUInt16(buffer2);
                    
byte[] temp = new byte[16];
                    if (
type == 1636)
                    {
                        
MemoryStream MS = new MemoryStream(buffer);
                        
BinaryReader BR = new BinaryReader(MS);
                        
BR.ReadUInt16();
                        
BR.ReadUInt16();
                        
Username Encoding.Default.GetString(BR.ReadBytes(32)).Replace("\0""");
                        
BR.ReadBytes(36);
                        var 
PasswordArray BR.ReadBytes(32);
                        
LoaderEncryption.Decrypt(PasswordArray32);
                        
Password Encoding.Default.GetString(BR.ReadBytes(32)).Replace("\0""");
                        
BR.ReadBytes(32);
                        
Server Encoding.Default.GetString(BR.ReadBytes(16)).Replace("\0"""); ;
                       
MacAddress Encoding.Default.GetString(BR.ReadBytes(12)).Replace("\0""");
                        
BR.Close();
                        
MS.Close();
                    }
                }
            }
            
//   Password ==  Username
            //    
        
}
        public 
byte[] ToArray()
        {
            throw new 
NotImplementedException();
        }
        public 
void Send(Client.GameState client)
        {
            throw new 
NotImplementedException();
        }
    }

}


namespace 
Rayzo.Network.Cryptography
{
    public class 
LoaderEncryption
    
{
        private static 
byte[] Key 
        { 
            
180,
            
152
            
187
            
196,
            
231
            
208
            
204
            
120
            
177,
            
164,
            
184,
            
77
            
9,
            
125
            
114,
            
49,
            
9
            
191,
            
20
            
122,
            
9
            
39,
            
123,
            
17
            
115,
            
222
            
188
            
120
            
109
            
9
            
65,
            
206,
            
85
            
10
            
29
            
215
            
143
            
108
            
231,
            
114 
        
};
        public static 
void Encrypt(byte[] arr)
        {
            
int length Key.Length;
            for (
int i 0arr.Lengthi++)
            {
                
arr[i] ^= Key[length];
                
arr[i] ^= Key[(1) % length];

            }
        }
        public static 
void Decrypt(byte[] arrint size)
        {
            
int length Key.Length;
            for (
int i 0sizei++)
            {
                
arr[i] ^= Key[(1) % length];
                
arr[i] ^= Key[length];

            }
        }
    }