ata4 / disunity

An experimental toolset for Unity asset and asset bundle files.
The Unlicense
2.69k stars 662 forks source link

How to unpack encrypted .unity3d? #220

Open asdqwe3124 opened 7 years ago

asdqwe3124 commented 7 years ago

Anyone know how to unpack encrypted .unity3d? There is a "ENCRYPT_HEADER" string when I open the file with hex editor.

this is the function from Assembly-CSharp.dll

public static byte[] RemoveEncryptHeader(MemoryStream ms)
{
    byte[] result = null;
    if (ms != null)
    {
        BinaryReader binaryReader = new BinaryReader(ms);
        byte b = binaryReader.ReadByte();
        if (b == 2)
        {
            string text = binaryReader.ReadString();
            if (text == "ENCRYPT_HEADER")
            {
                result = binaryReader.ReadBytes(Convert.ToInt32(ms.get_Length() - ms.get_Position()));
            }
        }
    }
    return result;
}

Thanks

Mactastic1-5 commented 7 years ago

How would you get the Assembly-CSharp.dll from the unity asset bundle (.unity3d) if it is encrypted?

asdqwe3124 commented 7 years ago

Assembly-CSharp.dll is not in asset bundle. It's located on managed folder and the encrypted assets bundle is in resources folder.

Mactastic1-5 commented 7 years ago

You just contradicted yourself. You've already unpacked the Unity asset bundle (.unity3d) Libraries for Unity games and apps can not be outside the Unity asset bundle, it wouldn't work. You decompiled the library to get the code and you want to export the assets from the asset bundle (.assets, .asset, etc.) What you should have done is opened the asset bundle in a hex editor and showed what the header says. However, you probably won't be able to use DisUnity to do what you want to do, I suggest you use Unity Studio, the latest version, which you can see on my Starred repositories page.

asdqwe3124 commented 7 years ago

There is lot of asset bundle files (.unity3d), some of them unencrypted so I can unpack it with Disunity or Unity Studio.

But, some .unity3d is encrypted, when I open it in a hex editor, I've found this: 00000000 02 0E 45 4E 43 52 59 50 54 5F 48 45 41 44 45 52 ENCRYPT_HEADER