Question

How to understand this code in C#?

using System;
internal class <Module>
{
}

The class name can't contain the symbol <> but it is allowed to have it in code? How would you achieve this? And how can I understand this difference?

Take a look at this code:

internal class <Module>{D8BAC701-C957-4CBE-8F97-37BB3A7DAFFE}
{
    static <Module>{D8BAC701-C957-4CBE-8F97-37BB3A7DAFFE}()
    {
        if (!(eqXmHMg8VVPy3nYeAo.eHiMp4DL8(Convert.ToBase64String(Type.GetTypeFromHandle(epOl6XynGueNUNwY5Y.e53w34m968awCm9P85taUZe(33554477)).Assembly.GetName().GetPublicKeyToken()), "eObc8gibn") != "34NavQ/3DsKjaKpYVSNSMjtuaXO9zUZlQl7AY+p3wrM="))
        {
            return;
        }
        while (true)
        {
            eqXmHMg8VVPy3nYeAo.ce4DmfsmSrOT856tDgfrkMb();
        }
    }
}

This class doesn't even have a namespace.

I decompiled this DLL with ILSpy. But how can I use this code and de-obfuscate it?

Was it helpful?

Solution

This looks like it could be obfuscated code. That's code that is compiled into IL in a way that is still valid, but can't be easily understood by humans.

This works because the rules for valid identifiers are different in C# and IL. So, when you try to decompile the code, you're getting invalid C#, but the IL itself is valid.

Also, classes don't have to be in namespaces, even in C#.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top