示例#1
0
        public static byte[] m00000b(byte[] argBuffer)
        {
            //检查执行程序集是否与调用程序集相同,不同则退出
            Assembly callingAssembly = Assembly.GetCallingAssembly();
            Assembly executingAssembly = Assembly.GetExecutingAssembly();
            if ((callingAssembly != executingAssembly) && !IsAssemblyEqual(executingAssembly, callingAssembly))
            {
                return null;
            }

            MyMemoryStream myStream = new MyMemoryStream(argBuffer);
            byte[] buffer = new byte[0];
            int num = myStream.ReadFullByte();

            //如果以这个序列开头
            if (num == 0x4034b50)
            {
                short num2 = (short) myStream.ReadLowByte();
                int num3 = myStream.ReadLowByte();
                int num4 = myStream.ReadLowByte();
                if (((num != 0x4034b50) || (num2 != 20)) || ((num3 != 0) || (num4 != 8)))
                {
                    throw new FormatException("Wrong Header Signature");
                }
                myStream.ReadFullByte();
                myStream.ReadFullByte();
                myStream.ReadFullByte();
                int num5 = myStream.ReadFullByte();
                int count = myStream.ReadLowByte();
                int num7 = myStream.ReadLowByte();
                if (count > 0)
                {
                    byte[] buffer2 = new byte[count];
                    myStream.Read(buffer2, 0, count);
                }
                if (num7 > 0)
                {
                    byte[] buffer3 = new byte[num7];
                    myStream.Read(buffer3, 0, num7);
                }
                byte[] buffer4 = new byte[(uint) (myStream.Length - myStream.Position)];
                myStream.Read(buffer4, 0, buffer4.Length);

                c00000e ce = new c00000e(buffer4);
                buffer = new byte[num5];
                ce.m00000d(buffer, 0, buffer.Length);
                buffer4 = null;
            }
            else
            {
                int num8 = num >> 0x18;
                num -= num8 << 0x18;

                //如果以这个序列开头
                if (num == 0x7d7a7b)
                {
                    switch (num8)
                    {
                        case 1:
                        {
                            int num12;
                            int num9 = myStream.ReadFullByte();
                            buffer = new byte[num9];
                            for (int i = 0; i < num9; i += num12)
                            {
                                int num11 = myStream.ReadFullByte();
                                num12 = myStream.ReadFullByte();
                                byte[] buffer5 = new byte[num11];
                                myStream.Read(buffer5, 0, buffer5.Length);
                                new c00000e(buffer5).m00000d(buffer, i, num12);
                            }
                            break;
                        }
                        case 2:
                        {
                            byte[] buffer6 = new byte[] { 0x69, 140, 0x88, 0xa1, 0x68, 0xb9, 0xe3, 0xd3 };
                            byte[] buffer7 = new byte[] { 0x7d, 0xb0, 0xa8, 0x17, 0xda, 0x54, 0xc5, 0x3e };
                            using (DESCryptoHelper cc = new DESCryptoHelper())
                            {
                                using (ICryptoTransform transform = cc.m000009(buffer6, buffer7, true))
                                {
                                    buffer = m00000b(transform.TransformFinalBlock(argBuffer, 4, argBuffer.Length - 4));
                                }
                            }
                            break;
                        }
                    }
                    if (num8 != 3)
                    {
                        goto Label_02E3;
                    }
                    byte[] buffer9 = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
                    byte[] buffer10 = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
                    using (RijndaelCryptHelper cb = new RijndaelCryptHelper())
                    {
                        using (ICryptoTransform transform2 = cb.CreateCryptor(buffer9, buffer10, true))
                        {
                            buffer = m00000b(transform2.TransformFinalBlock(argBuffer, 4, argBuffer.Length - 4));
                        }
                        goto Label_02E3;
                    }
                }
                throw new FormatException("Unknown Header");
            }
            Label_02E3:
            myStream.Close();
            myStream = null;
            return buffer;
        }
示例#2
0
 public static byte[] m00000b(byte[] p0)
 {
     Assembly callingAssembly = Assembly.GetCallingAssembly();
     Assembly executingAssembly = Assembly.GetExecutingAssembly();
     if ((callingAssembly != executingAssembly) && !m00000a(executingAssembly, callingAssembly))
     {
         return null;
     }
     c000014 c = new c000014(p0);
     byte[] buffer = new byte[0];
     int num = c.m000010();
     if (num == 0x4034b50)
     {
         short num2 = (short) c.m00000f();
         int num3 = c.m00000f();
         int num4 = c.m00000f();
         if (((num != 0x4034b50) || (num2 != 20)) || ((num3 != 0) || (num4 != 8)))
         {
             throw new FormatException("Wrong Header Signature");
         }
         c.m000010();
         c.m000010();
         c.m000010();
         int num5 = c.m000010();
         int count = c.m00000f();
         int num7 = c.m00000f();
         if (count > 0)
         {
             byte[] buffer2 = new byte[count];
             c.Read(buffer2, 0, count);
         }
         if (num7 > 0)
         {
             byte[] buffer3 = new byte[num7];
             c.Read(buffer3, 0, num7);
         }
         byte[] buffer4 = new byte[(uint) (c.Length - c.Position)];
         c.Read(buffer4, 0, buffer4.Length);
         c00000e ce = new c00000e(buffer4);
         buffer = new byte[num5];
         ce.m00000d(buffer, 0, buffer.Length);
         buffer4 = null;
     }
     else
     {
         int num8 = num >> 0x18;
         num -= num8 << 0x18;
         if (num == 0x7d7a7b)
         {
             switch (num8)
             {
                 case 1:
                 {
                     int num12;
                     int num9 = c.m000010();
                     buffer = new byte[num9];
                     for (int i = 0; i < num9; i += num12)
                     {
                         int num11 = c.m000010();
                         num12 = c.m000010();
                         byte[] buffer5 = new byte[num11];
                         c.Read(buffer5, 0, buffer5.Length);
                         new c00000e(buffer5).m00000d(buffer, i, num12);
                     }
                     break;
                 }
                 case 2:
                 {
                     byte[] buffer6 = new byte[] { 0x69, 140, 0x88, 0xa1, 0x68, 0xb9, 0xe3, 0xd3 };
                     byte[] buffer7 = new byte[] { 0x7d, 0xb0, 0xa8, 0x17, 0xda, 0x54, 0xc5, 0x3e };
                     using (c00000c cc = new c00000c())
                     {
                         using (ICryptoTransform transform = cc.m000009(buffer6, buffer7, true))
                         {
                             buffer = m00000b(transform.TransformFinalBlock(p0, 4, p0.Length - 4));
                         }
                     }
                     break;
                 }
             }
             if (num8 != 3)
             {
                 goto Label_02E3;
             }
             byte[] buffer9 = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
             byte[] buffer10 = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
             using (c00000b cb = new c00000b())
             {
                 using (ICryptoTransform transform2 = cb.m000009(buffer9, buffer10, true))
                 {
                     buffer = m00000b(transform2.TransformFinalBlock(p0, 4, p0.Length - 4));
                 }
                 goto Label_02E3;
             }
         }
         throw new FormatException("Unknown Header");
     }
     Label_02E3:
     c.Close();
     c = null;
     return buffer;
 }