Trouble extracting a .unity3d file with UnityRaw header [Battle Girl High School]

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
as013
Posts: 5
Joined: Sat Apr 29, 2017 7:39 pm

Trouble extracting a .unity3d file with UnityRaw header [Battle Girl High School]

Post by as013 »

I was extracting data (card images to be precise) from a card game called BGHS. Usually, I just use whatever tool I have (DisUnity, UnityEX, or QuickBMS with the unity3d_webplayer script, etc...) and I can get the texture in .tex format (card image) directly (Example of a UnityWeb .unity3d from the game). But after the latest game update, I can't use the conventional tools to extract anymore as they either cannot extract or will return a .txt file (approx. 600KB in size) instead of .tex file (usually 2MB in size). I also tried QuickBMS with the unityraw script, but it returned a .49 file, which, AFAIK, is also a text asset. Example of that UnityRaw file here. I really appreciate someone's assistance as I have been looking into this for over 100 hours.
edit: edit link. why did I mess up at something as simple as copy-paste urls
Last edited by as013 on Sun Apr 30, 2017 5:19 am, edited 1 time in total.
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Trouble extracting a .unity3d file with UnityRaw header

Post by Acewell »

as013
Posts: 5
Joined: Sat Apr 29, 2017 7:39 pm

Re: Trouble extracting a .unity3d file with UnityRaw header

Post by as013 »

That's the UnityWeb one. I can extract with most tools I currently have. But it's the UnityRaw one I'm having trouble with.
Urghh I pasted the wrong link.......
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Trouble extracting a .unity3d file with UnityRaw header

Post by Acewell »

if it really is an image the devs must have pulled some kind of trickery by changing the type and compressing it :P
as013
Posts: 5
Joined: Sat Apr 29, 2017 7:39 pm

Re: Trouble extracting a .unity3d file with UnityRaw header

Post by as013 »

Do you have any idea where to look at if I want to find out what kind of works they do to the files to get the image back from the .unity3d file? I mean, where exactly in the source code. Assembly-CSharp has about 32k methods and I don't want to read through all of them.
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Trouble extracting a .unity3d file with UnityRaw header

Post by Acewell »

sorry i've no idea, that is out of my area :)
as013
Posts: 5
Joined: Sat Apr 29, 2017 7:39 pm

Re: Trouble extracting a .unity3d file with UnityRaw header

Post by as013 »

That's unfortunate. Thanks for your time reading and replying to my question. I will sit here patiently waiting for more ideas from people :)
as013
Posts: 5
Joined: Sat Apr 29, 2017 7:39 pm

Re: Trouble extracting a .unity3d file with UnityRaw header

Post by as013 »

After spending some time looking at Assembly-CSharp.dll, I found out that they did indeed encrypt the file. In particular, this snippet of code appears only in the latest version of the game

Code: Select all

if (bundleInfo.isCrypt)
   {
      TextAsset textAsset = (TextAsset)assetBundle.Load(bundleInfo.EscapePath, typeof(TextAsset));
      AssetBundle assetBundle2 = null;
      if (textAsset != null)
      {
         byte[] array2 = Cipher.DecryptRJ128ByteArray(bundleInfo.CryptKey, Cipher.DEFAULT_ASSET_BUNDLE_IV_128, textAsset.bytes);
         if (array2 != null)
         {
            assetBundle2 = AssetBundle.CreateFromMemoryImmediate(array2);
         }
      }
      assetBundle.Unload(true);
      UnityEngine.Object.Destroy(assetBundle);
      if (!(assetBundle2 != null))
      {
         return null;
      }
      assetBundle = assetBundle2;
   }

However, I know nearly nothing about cryptography so it would be appreciated if someone could take a look and help me.
Here's the dll.