我可以恢复我编译的应用程序的来源吗?

时间:2018-01-10 00:03:40

标签: c#

我刚刚丢失了我的库,一旦我反编译它就会有很多不必要的代码。它可以恢复或理解或多或少的代码完全重写到原始来源? 例如,如果我检查我的项目的一部分,我可以在尝试反编译它之前给出一个原始源代码的示例:

private static bool ByteArrayCompare(byte[] b1, byte[] b2)
        {
            return b1.Length == b2.Length && memcmp(b1, b2, b1.Length) == 0;
        }

一旦我反编译它,代码就完全不同了:

private static bool ByteArrayCompare(byte[] b1, byte[] b2)
{
    if (b1.Length == b2.Length)
    {
        while (true)
        {
            int num = 719326676;
            goto IL_000d;
            IL_000d:
            uint num2;
            switch ((num2 = (uint)(num ^ 0x6B86E2FE)) % 3u)
            {
            case 0u:
                break;
            case 1u:
                return SMPTR.memcmp(b1, b2, b1.Length) == 0;
            default:
                goto IL_0048;
            }
            continue;
            IL_0039:
            num = ((int)num2 * -1900091540 ^ 0x4DAC5FA);
            goto IL_000d;
        }
    }
    goto IL_0048;
    IL_0048:
    return false;
}

现在这些类发生了同样的事情。 运行:

public static bool Run()
    {
        header.‫‬‭‪‪​‎‍‬‌‫‎‫‏‫‭‍‪‮‍‌​​‬‌​header.‪‫‏‎‮‬‎‬​‮‮‪‏‭‎‪‮‭​‏‌​‭‫​‭‮(), header.CurrentDomain_AssemblyResolve);
        while (true)
        {
            int num = 1039260164;
            goto IL_001b;
            IL_001b:
            uint num2;
            while (true)
            {
                int num3 = default(int);
                switch ((num2 = (uint)(num ^ 0x3472CD9D)) % 8u)
                {
                case 0u:
                    break;
                case 3u:
                    return true;
                case 4u:
                    num = ((int)num2 * -188976845 ^ -260518362);
                    continue;
                case 7u:
                    goto IL_006c;
                case 6u:
                    goto IL_0081;
                case 1u:
                    num3 = 1;
                    num = ((int)num2 * -1593869856 ^ 0x44175289);
                    continue;
                case 2u:
                    num3++;
                    num = 179700154;
                    continue;
                default:
                    return false;
                }
                break;
                IL_0081:
                int num4;
                if (!RunHandler.HandleRun())
                {
                    num = 311890711;
                    num4 = num;
                }
                else
                {
                    num = 483767846;
                    num4 = num;
                }
                continue;
                IL_006c:
                int num5;
                if (num3 > 5)
                {
                    num = 822334488;
                    num5 = num;
                }
                else
                {
                    num = 1601113283;
                    num5 = num;
                }
            }
            continue;
            IL_004e:
            num = ((int)num2 * -75964955 ^ 0x5EDD0E50);
            goto IL_001b;
        }
    }

第二节课:

private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
    {
        if (header.id != null)
        {
            goto IL_0007;
        }
        goto IL_003e;
        IL_003e:
        header.id = header.​‏‍‍‏‎‪‫‪‬‏‬‫​‫‪‌‌‌‪‭​‫​‮‏‭‫‮(args);
        int num = -782795078;
        goto IL_000c;
        IL_000c:
        uint num2;
        switch ((num2 = (uint)(num ^ -504079301)) % 4u)
        {
        case 0u:
            break;
        case 2u:
            return null;
        case 3u:
            goto IL_003e;
        default:
            return header.‮​‬‭‮‪‬‫‌‌‬‫​‍‍‮‬‬‮‭‪‮(Resources.MyDLL;
        }
        goto IL_0007;
        IL_0007:
        num = -1157763175;
        goto IL_000c;
        IL_002f:
        num = ((int)num2 * -823262644 ^ -680184524);
        goto IL_000c;
    }

可以恢复最后两个类的代码。为什么编译的代码会添加很多循环并且很难理解真正发生了什么?有可能恢复吗?

0 个答案:

没有答案