Advertisement
Guest User

aadadsfgsdgd

a guest
Jul 6th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.37 KB | None | 0 0
  1.    private int EncipherConstant = 135;
  2.         private int EncipherMorph;
  3.         private int DecipherConstant = 135;
  4.         private int DecipherMorph;
  5.         public byte[] Encrypt(byte[] Data)
  6.         {
  7.             int Length = Data.Length;
  8.             int ActualByte;
  9.             int Morph;
  10.             byte[] Buffer = new byte[Length];
  11.             int Index = 0;
  12.             while (Length-- > 0)
  13.             {
  14.                 ActualByte = Data[Index];
  15.                 Morph = (ActualByte ^ this.EncipherConstant) ^ this.EncipherMorph;
  16.                 Buffer[Index] = (byte)Morph;
  17.                 Index++;
  18.                 this.EncipherConstant = Rand(this.EncipherConstant);
  19.                 this.EncipherMorph = ActualByte;
  20.             }
  21.             return Buffer;
  22.         }
  23.         public byte[] Decrypt(byte[] Data)
  24.         {
  25.             int Length = Data.Length;
  26.             int ActualByte;
  27.             int Morph;
  28.             byte[] Buffer = new byte[Length];
  29.             int Index = 0;
  30.             while (Length-- > 0)
  31.             {
  32.                 ActualByte = Data[Index];
  33.                 Morph = (ActualByte ^ this.DecipherConstant) ^ this.DecipherMorph;
  34.                 Buffer[Index] = (byte)Morph;
  35.                 Index++;
  36.                 this.DecipherConstant = Rand(this.DecipherConstant);
  37.                 this.DecipherMorph = Morph;
  38.             }
  39.             return Buffer;
  40.         }
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  string Name = Parameters[1];
  56.             string Password = Parameters[2];
  57.             if (Name.Contains("/"))
  58.             {
  59.                 string[] separator = Regex.Split(Name, "/");
  60.                 Name = Tools.decodebase64(separator[0]);
  61.                 Password = separator[1];
  62.             }
  63.             else
  64.             {
  65.                 Password = Tools.getMD5(Password);
  66.             }
  67.             User User = Users.GetUserFromName(Name);//Chequeamos usuario
  68.             if (User != null)//existe si o no
  69.             {
  70.                 if (SessionAdministrator.AllSessions.ContainsKey(User.DNI))
  71.                 {
  72.                     Session ConnectedSession = SessionAdministrator.GetSession(User.DNI);
  73.                     ConnectedSession.DestructSession("Connected -> offline -> enter");
  74.                 }
  75.                 if (Password.ToLower() == User.MD5Password.ToLower())//contraseña correcta o no
  76.                 {
  77.                     Session.User = User;
  78.                     Login:
  79.                     if (CheckBan(Session) == false)
  80.                     {
  81.                         CheckVip(Session);
  82.                         Tools.REnameWord(ref Session.User.Name);
  83.                         ServerMessage SMessage = new ServerMessage(new byte[] { 120, 121 });
  84.                         SMessage.AppendParameter((uint)1);
  85.                         SMessage.AppendParameter(User.Name);
  86.                         SMessage.AppendParameter(User.AvatarNumber);
  87.                         SMessage.AppendParameter(User.AvatarColour);
  88.                         SMessage.AppendParameter(User.Email);
  89.                         SMessage.AppendParameter(18);
  90.                         SMessage.AppendParameter((uint)2);
  91.                         SMessage.AppendParameter("Spain");
  92.                         SMessage.AppendParameter((uint)0);
  93.                         SMessage.AppendParameter(User.DNI);
  94.                         SMessage.AppendParameter(User.Mod);
  95.                         SMessage.AppendParameter(User.Gold);
  96.                         SMessage.AppendParameter(User.Silver);
  97.                         SMessage.AppendParameter(200);
  98.                         SMessage.AppendParameter(5);
  99.                         SMessage.AppendParameter(24465); //invitaciones enviadas
  100.                         SMessage.AppendParameter(-1); //regalo
  101.                         SMessage.AppendParameter(0 + "³²" + 0 + "³²0³²ES³²0³²0³²" + User.Vip + "³²³²" + 2 + "³²" + 0 + "³²" + 0 + "³²0³²1³0³²0³²0");
  102.                         Session.Send(SMessage);
  103.                         Session.HasLoged = true;
  104.                         Console.WriteLine();
  105.                         Console.ForegroundColor = ConsoleColor.Green;
  106.                         Console.Write("Connected Account: ");
  107.                         Console.ForegroundColor = ConsoleColor.White;
  108.                         Console.Write(User.Name);
  109.                         Console.ForegroundColor = ConsoleColor.Gray;
  110.                         //  Tools.WriteLine("Se ha conectado: " + User.Name, ConsoleColor.Green);
  111.                         Console.WriteLine();
  112.                         Check_Months_Registered(Session);
  113.                         UpDateLastOnline(Session);
  114.                         Tools.ConnectedUsers += 1;
  115.                         Tools.RefreshTitle();
  116.                         SessionAdministrator.AllSessions.Add(User.DNI, Session);
  117.                        // new Thread(Session.GetActivity).Start();
  118.                     }
  119.                     else
  120.                     {
  121.                         int bantype = int.Parse(Session.User.Ban.Split(new char[] { '_' })[0]);
  122.                         if (bantype == 1)
  123.                         {
  124.                             string reason = Session.User.Ban.Split(new char[] { '_' })[1];
  125.                             string expire = Session.User.Ban.Split(new char[] { '_' })[2];
  126.                             DateTime BaneoTimeFlush = Convert.ToDateTime(expire);
  127.                             if (DateTime.Now >= BaneoTimeFlush)
  128.                             {
  129.                                 DataClient client = DataManager.GetClient();
  130.                                 client.SetParameter("id", Session.User.DNI);
  131.                                 client.ExecuteNonQuery("update usuarios set baneo = '' where id = @id");
  132.                                 Session.User.Ban = "";
  133.                                 goto Login;
  134.                             }
  135.                             else
  136.                             {
  137.                                 Session.Send(new ServerMessage(new byte[] { 185 }, new object[] { (BaneoTimeFlush - DateTime.Now).TotalSeconds.ToString().Split(new char[] { ',' })[0], reason }));
  138.                                 return;
  139.                             }
  140.                         }
  141.                         else
  142.                         {
  143.                             return;
  144.                         }
  145.  
  146.                     }
  147.                 }
  148.  
  149.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement