Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/12/2017, 10:07
aguml
 
Fecha de Ingreso: febrero-2015
Mensajes: 404
Antigüedad: 9 años, 2 meses
Puntos: 3
Respuesta: No puedo comprender el siguiente codigo

Aqui os pongo todas las funciones que creo que son las que estan involucradas por si podeis echarme un cable:
El botón que desencripta:
El botón que desencripta:
Código C++:
Ver original
  1. private void button_1_Click(object sender, EventArgs e)
  2. {
  3.     File.WriteAllBytes(this.string_0, new Form1.GClass1(this.byte_0).Decrypt(File.ReadAllBytes(this.string_0)));
  4.     int num = (int)MessageBox.Show(Class5.c39c0e0f1863ae92a6bb9f1c4d11eea98(80));
  5. }

La función desencriptadora:
Código C++:
Ver original
  1. public unsafe byte[] Decrypt(byte[] eData)
  2. {
  3.     byte[] numArray = Class41.smethod_0((int) Class37.smethod_0(eData));
  4.     byte[] byte_0_1;
  5.     // ISSUE: cast to a reference type
  6.     // ISSUE: explicit reference operation
  7.     // ISSUE: explicit reference operation
  8.     fixed (byte* numPtr1 = &^((byte_0_1 = eData) == null || (int) Class37.smethod_0(byte_0_1) == 0 ? (byte&) Class4.smethod_0(272) : @byte_0_1[Class4.smethod_0(276)]))
  9.     {
  10.         byte[] byte_0_2;
  11.         // ISSUE: cast to a reference type
  12.         // ISSUE: explicit reference operation
  13.         // ISSUE: explicit reference operation
  14.         fixed (byte* numPtr2 = &^((byte_0_2 = numArray) == null || (int) Class37.smethod_0(byte_0_2) == 0 ? (byte&) Class4.smethod_0(280) : @byte_0_2[Class4.smethod_0(284)]))
  15.         {
  16.             int* numPtr3 = (int*) numPtr1;
  17.             int* numPtr4 = (int*) numPtr2;
  18.             int num1 = Class4.smethod_0(288);
  19.             while (num1 < (int) Class37.smethod_0(eData) >> Class4.smethod_0(312))
  20.             {
  21.                 int* numPtr5 = numPtr3;
  22.                 IntPtr num2 = (IntPtr) Class4.smethod_0(292);
  23.                 int* numPtr6 = (int*) ((IntPtr) numPtr5 + num2);
  24.                 int int_2 = GClass0.smethod_2(*numPtr5);
  25.                 int* numPtr7 = numPtr6;
  26.                 IntPtr num3 = (IntPtr) Class4.smethod_0(296);
  27.                 numPtr3 = (int*) ((IntPtr) numPtr7 + num3);
  28.                 int int_3 = GClass0.smethod_2(*numPtr7);
  29.                 this.ccfae92404b1d8caf890158f763ac579b(ref int_2, ref int_3);
  30.                 int* numPtr8 = numPtr4;
  31.                 IntPtr num4 = (IntPtr) Class4.smethod_0(300);
  32.                 int* numPtr9 = (int*) ((IntPtr) numPtr8 + num4);
  33.                 int num5;
  34.                 int num6 = num5 = GClass0.smethod_2(int_2);
  35.                 *numPtr8 = num5;
  36.                 int* numPtr10 = numPtr9;
  37.                 IntPtr num7 = (IntPtr) Class4.smethod_0(304);
  38.                 numPtr4 = (int*) ((IntPtr) numPtr10 + num7);
  39.                 int num8;
  40.                 int_3 = num8 = GClass0.smethod_2(int_3);
  41.                 *numPtr10 = num8;
  42.                 num1 += Class4.smethod_0(308);
  43.             }
  44.             // ISSUE: cast to a reference type
  45.             // ISSUE: variable of a reference type
  46.             byte& local1 = (byte&) Class4.smethod_0(316);
  47.             // ISSUE: cast to a reference type
  48.             // ISSUE: variable of a reference type
  49.             byte& local2 = (byte&) Class4.smethod_0(320);
  50.             return numArray;
  51.         }
  52.     }
  53. }

Esta función creo que es la que realmente desencripta usando dos valores enteros (supongo que uno será el que está en el archivo y el otro el que se usa para desencriptar):
Código C++:
Ver original
  1. private void ccfae92404b1d8caf890158f763ac579b(ref int int_2, ref int int_3)
  2. {
  3.      Class4.smethod_0(376);
  4.      int num1 = Class4.smethod_0(380);
  5.      int num2;
  6.      do
  7.      {
  8.          num2 = this.int_0[Class4.smethod_0(384) - num1] ^ int_2;
  9.          int_2 = (this.int_1[Class4.smethod_0(388), (int) (byte) (num2 >> Class4.smethod_0(392))] + this.int_1[Class4.smethod_0(396), (int) (byte) (num2 >> Class4.smethod_0(400))] ^ this.int_1[Class4.smethod_0(404), (int) (byte) (num2 >> Class4.smethod_0(408))]) + this.int_1[Class4.smethod_0(412), (int) (byte) num2] ^ int_3;
  10.          int_3 = num2;
  11.          num1 += Class4.smethod_0(416);
  12.      }
  13.      while (num1 < Class4.smethod_0(420));
  14.      int_3 = this.int_0[Class4.smethod_0(424)] ^ int_2;
  15.      int_2 = this.int_0[Class4.smethod_0(428)] ^ num2;
  16. }

La función Class41.smethod_0:
Código C++:
Ver original
  1. internal static byte[] smethod_0(int int_0)
  2. {
  3.     return new byte[int_0];
  4. }

la función Class37.smethod_0:
Código C++:
Ver original
  1. internal static UIntPtr smethod_0(byte[] byte_0)
  2. {
  3.     return (UIntPtr) byte_0.Length;
  4. }

La función Class4.smethod_0:
Código C++:
Ver original
  1. internal static int smethod_0(int int_1)
  2. {
  3.     return BitConverter.ToInt32(Class4.byte_0, int_1);
  4. }

La parte donde se define Class4.byte_0:
Código C++:
Ver original
  1. internal sealed class Class4
  2. {
  3.     internal static readonly byte[] byte_0;
  4.     internal readonly int int_0;
  5.  
  6.     static Class4()
  7.     {
  8.         if (Class4.byte_0 != null)
  9.             return;
  10.         byte[] bytes = Convert.FromBase64String("UmVzaWRlbnQgRXZpbCBSZXZlbGF0aW9ucyAyIERlY3J5cHRlciU=");
  11.         Class4.byte_0 = Class6.smethod_1(97L, Assembly.GetExecutingAssembly().GetManifestResourceStream(Encoding.UTF8.GetString(bytes, 0, bytes.Length)));
  12.     }
  13.     ...

El botón donde se encripta:
Código C++:
Ver original
  1. private void button_2_Click(object sender, EventArgs e)
  2. {
  3.     File.WriteAllBytes(this.string_0, new Form1.GClass1(this.byte_0).Encrypt(File.ReadAllBytes(this.string_0)));
  4.     int num = (int)MessageBox.Show(Class5.c39c0e0f1863ae92a6bb9f1c4d11eea98(95));
  5. }

Para la funcion encriptadora:
Código C++:
Ver original
  1. public unsafe byte[] Encrypt(byte[] uData)
  2. {
  3.     byte[] numArray = Class41.smethod_0((int) Class37.smethod_0(uData));
  4.     byte[] byte_0_1;
  5.     // ISSUE: cast to a reference type
  6.     // ISSUE: explicit reference operation
  7.     // ISSUE: explicit reference operation
  8.     fixed (byte* numPtr1 = &^((byte_0_1 = uData) == null || (int) Class37.smethod_0(byte_0_1) == 0 ? (byte&) Class4.smethod_0(220) : @byte_0_1[Class4.smethod_0(224)]))
  9.     {
  10.         byte[] byte_0_2;
  11.         // ISSUE: cast to a reference type
  12.         // ISSUE: explicit reference operation
  13.         // ISSUE: explicit reference operation
  14.         fixed (byte* numPtr2 = &^((byte_0_2 = numArray) == null || (int) Class37.smethod_0(byte_0_2) == 0 ? (byte&) Class4.smethod_0(228) : @byte_0_2[Class4.smethod_0(232)]))
  15.         {
  16.             int* numPtr3 = (int*) numPtr2;
  17.             int* numPtr4 = (int*) numPtr1;
  18.             int num1 = Class4.smethod_0(236);
  19.             while (num1 < (int) Class37.smethod_0(uData) >> Class4.smethod_0(260))
  20.             {
  21.                 int* numPtr5 = numPtr4;
  22.                 IntPtr num2 = (IntPtr) Class4.smethod_0(240);
  23.                 int* numPtr6 = (int*) ((IntPtr) numPtr5 + num2);
  24.                 int int_2 = GClass0.smethod_2(*numPtr5);
  25.                 int* numPtr7 = numPtr6;
  26.                 IntPtr num3 = (IntPtr) Class4.smethod_0(244);
  27.                 numPtr4 = (int*) ((IntPtr) numPtr7 + num3);
  28.                 int int_3 = GClass0.smethod_2(*numPtr7);
  29.                 this.c0c1ef294051644e1e4a229a2e6a0ee04(ref int_2, ref int_3);
  30.                 int* numPtr8 = numPtr3;
  31.                 IntPtr num4 = (IntPtr) Class4.smethod_0(248);
  32.                 int* numPtr9 = (int*) ((IntPtr) numPtr8 + num4);
  33.                 int num5;
  34.                 int num6 = num5 = GClass0.smethod_2(int_2);
  35.                 *numPtr8 = num5;
  36.                 int* numPtr10 = numPtr9;
  37.                 IntPtr num7 = (IntPtr) Class4.smethod_0(252);
  38.                 numPtr3 = (int*) ((IntPtr) numPtr10 + num7);
  39.                 int num8;
  40.                 int_3 = num8 = GClass0.smethod_2(int_3);
  41.                 *numPtr10 = num8;
  42.                 num1 += Class4.smethod_0(256);
  43.             }
  44.             // ISSUE: cast to a reference type
  45.             // ISSUE: variable of a reference type
  46.             byte& local1 = (byte&) Class4.smethod_0(264);
  47.             // ISSUE: cast to a reference type
  48.             // ISSUE: variable of a reference type
  49.             byte& local2 = (byte&) Class4.smethod_0(268);
  50.             return numArray;
  51.         }
  52.     }
  53. }

Esta función creo que es la que realmente encripta usando dos valores enteros (supongo que uno será el que está en el archivo y el otro el que se usa para encriptar):
Código C++:
Ver original
  1. private void c0c1ef294051644e1e4a229a2e6a0ee04(ref int int_2, ref int int_3)
  2. {
  3.     Class4.smethod_0(324);
  4.     int index = Class4.smethod_0(328);
  5.     int num;
  6.     do
  7.     {
  8.         num = this.int_0[index] ^ int_2;
  9.         int_2 = (this.int_1[Class4.smethod_0(332), (int) (byte) (num >> Class4.smethod_0(336))] + this.int_1[Class4.smethod_0(340), (int) (byte) (num >> Class4.smethod_0(344))] ^ this.int_1[Class4.smethod_0(348), (int) (byte) (num >> Class4.smethod_0(352))]) + this.int_1[Class4.smethod_0(356), (int) (byte) num] ^ int_3;
  10.         int_3 = num;
  11.         index += Class4.smethod_0(360);
  12.     }
  13.     while (index < Class4.smethod_0(364));
  14.     int_3 = this.int_0[Class4.smethod_0(368)] ^ int_2;
  15.     int_2 = this.int_0[Class4.smethod_0(372)] ^ num;
  16. }