Giter VIP home page Giter VIP logo

unity-game-hacking's Introduction

Unity Game Hacking Guide

This is a small guide for extracting and modifying assets or code from games made with the Unity engine. Feel free to contribute.

  1. Unity game folder structure
  2. Extracting and editing code
  3. Extracting assets
  4. Hacking memory

Unity game folder structure

│  *.exe
└──*_Data
   │  globalgamemanagers
   │  globalgamemanagers.assets
   │  level0
   │  level0.resS
      ...
   |  levelN
   |  levelN.resS
   |  resources.assets
   |  resources.assets.resS
   |  resources.resource
   │  sharedassets0.assets
   │  sharedassets0.assets.resS
      ...
   |  sharedassetsN.assets
   |  sharedassetsN.assets.resS
   ├──Managed
   │    Assembly-CSharp.dll
   │    Assembly-UnityScript.dll
   │    Mono.Security.dll
   │    mscorlib.dll
   │    System.Core.dll
   │    System.dll
   │    UnityEngine.dll
   │    UnityEngine.dll.mdb
   │    UnityEngine.Networking.dll
   │    UnityEngine.UI.dll
   ├──Mono
   │  │  mono.dll
   │  └──etc
   │     └──mono
   │        │  browscap.ini
   │        │  config
   │        ├──1.0
   │        │     DefaultWsdlHelpGenerator.aspx
   │        │     machine.config
   │        ├──2.0
   │        │  │  DefaultWsdlHelpGenerator.aspx
   │        │  │  machine.config
   │        │  │  settings.map
   │        │  │  web.config
   │        │  └──Browsers
   │        │        Compat.browser
   │        └──mconfig
   │              config.xml
   └──Resources
        unity default resources
        unity_builtin_extra
File/Directory Description
*.exe Executable file of the game
*_Data Data folder containing the game resources
level0-levelN Files containing game scenes data, each scene has its own file
sharedassets0-sharedassetsN Game assets are split into sharedassets and .resS files (sharedassets.assets.split0 - ..splitN on platforms like Android/iOS)
resources.assets Raw Assets found in the project resources folders and their dependencies are stored in this file (as well as raw audio files, even if outside of Resources folder in Unity, AudioClips with references to .resource and info such as audio size/offset still stored inside .assets)
Managed Folder containing unity DLLs
Assembly-CSharp.dll DLL file containing compiled C# files
Assembly-UnityScript.dll DLL file containing compiled UnityScript files

With * : The name of the main executable (.exe).

Extracting and editing code

C# and UnityScript files are compiled into the Assembly-CSharp.dll and Assembly-UnityScript.dll DLLs respectively, which can be found inside the Managed folder.

DLLs can be decompiled using ILSpy, dnSpy, DotPeek or JustAssembly which allow modifying and recompiling assembly files.

If DLLs are missing from the managed directory, try dumping them using MegaDumper tool.

Tool Decription
ILSpy Cross-platform .NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more).
DotPeek JetBrains DotPeek is a free .NET Decompiler and Assembly Browser.
dnSpyEx Unofficial revival of the well known .NET debugger and assembly editor, dnSpy.
Fork of dnSpy.
Telerik JustAssembly Decompile and Compare .NET Assemblies. Binary Code Diff. Method Diff.
Cpp2IL Work-in-progress tool to reverse unity's IL2CPP toolchain.
Il2CppDumper Unity il2cpp reverse engineer.
dnSpy
No Longer Maintained
dnSpy is a debugger and .NET assembly editor. You can use it to edit and debug assemblies even if you don't have any source code available.
Working but you can use dnSpyEx instead.
MegaDumper
No Longer Maintained
Dump native and .NET assemblies.

Extracting assets

Assets are stored in the .assets and .resS files. Content of these files can be unpacked with one of these tools :

Tool Description
AssetRipper AssetRipper is a tool for extracting assets from serialized files (CAB-*, *.assets, .sharedAssets, etc.) and assets bundles (.unity3d, *.bundle, etc.) and converting them into the native Unity engine format.
Fork of uTinyRipper.
Unity Assets Bundle Extractor UABE is an editor for 3.4+/4/5/2017-2021.3 .assets and AssetBundle files. It can create standalone mod installers from changes to .assets and/or bundles.
QuickBMS with this script or this one for webplayer universal script based files extractor and reimporter. QuickBMS supports tons of games and file formats, archives, encryptions, compressions, obfuscations and other algorithms.
DevXUnityUnpacker A (paid) tool with a friendly GUI meant for restoring unity projects by inputting the built game/app including a previewer for individual files as image, hex, text etc.
uTinyRipper
No Longer Maintained
uTinyRipper is a tool for extracting assets from serialized files (CAB-*, *.assets, *.sharedAssets, etc.) and assets bundles (*.unity3d, *.assetbundle, etc.) and conveting them into native Engine format.
Use AssetRipper Instead
Unity Studio / AssetStudio
No Longer Maintained
AssetStudio is an independent tool for exploring, extracting and exporting assets.
Unity Assets Explorer
No Longer Maintained
Unity Assets Explorer is used to view the contents of Assets-files (Unity 3D engine). Allows you to: Extract all files, extract one file (from context menu), convert tex-files into a picture format DDS (on extraction), import the changed DDS-images to the archive.

Do not use UnityEX, it is most likely a virus.

DDS files :

The DDS files can be opened/converted/edited with the following tools :

Tool Tutorial
Ninja Ripper Extract (rip) 3D scenes from games and explore them in 3D editor (Blender, 3D Max, Noesis).
An old guide on how to use Ninja Ripper.
The official YouTube Channel can be usefull for latest video tutorial.
RenderDoc Tutorial on how to use RenderDoc.
NVIDIA Texture Tools Exporter The NVIDIA Texture Tools Exporter allows users to create highly compressed texture files - that stay small both on disk and in memory - directly from image sources using NVIDIA’s CUDA-accelerated Texture Tools 3.0 compressor technology.
Can be used as a standalone software or as an Adobe Photoshop Plugin.
Intel® Graphics Performance Analyzers Improve your game's performance by quickly identifying problem areas.
Tutorial on how to use the Intel Graphics Analyzers to extract graphics.
Gimp Plugin This is a plugin for GIMP version 2.8.x. It allows you to load and save images in the Direct Draw Surface (DDS) format.
3D Ripper DX This soft doesn't support 64 bits binaries.

Hacking memory

Cheat engine have a feature called Dissect mono that can help hacking game's memory. This video series about using cheat engine is really useful.

unity-game-hacking's People

Contributors

gglinnk avatar imadr avatar swagsy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity-game-hacking's Issues

How to Deobfuscate a game that has Il2Cpp ?

I tried to deobfuscate a game that has Il2cpp with

  • il2Cpp Dumper [extract all the dlls from UnityPlayer.dll]

  • .Net Reflector 10.2 [Extract all the C# code from dlls]

  • De4Dot [Deobfuscator for all the C# ] idk if this works

but for some reason it didn't worked to deobfuscate it.... so i think this is my last chance here.

is there a way to deobfuscate a game that has [Obfuscator And Il2Cpp ] ?

Tools for Linux?

Is there any possible way to get similar tools on linux? I mean, I want to use it for Among Us, but it seems like there are only some crappy python ones.
Thanks!

How to handle assets encrypted by offset?

I have seen some forks of AssetStudio decrypt games like Naraka that use offset-encrypted assets. I would like to understand the basic approach to decrypting any offset encryption.

[Q] .split files merge and/or read

I have a 3+ year old apk file for a game I used to play.
I have extracted it and it has several level0.split0/1/2/3/4 etc files

What do I need to do to merge these and/or what program to open them in a readable format?

EDIT: I open it in notepad++ and a few other things, but it looks like the section I desire does not display correctly

Adding a note for older Unity versions

As this guide will likely help with reverse engineering, modding and preserving/restoring older Unity games, I think it's important to mention Unity version support or at least acknowledge tools useful for older engine versions. As such, even though uTinyRipper is no longer maintained, it supports Unity 1.x to 2019.x whereas AssetRipper is actively maintained but currently supports Unity 3.5.0 to 2023.3.X.

I would therefore suggest adding a note regarding version support under the "Extracting assets" so this information is clearer if anyone needs it.

How to open obb files

Hello,
This information is really helpful. I lost my project now iam reverse engineering everything. Currently i am stuck at unpacking the obb. it uses pk.. signature, which is i think is .zip. So i renamed the obb with .zip format and extracted it. Now it made these folders (assets\bin\Data) but the file inside Data folder is named 000000... and its size is in around 20 mb. So i think this is the main file. but i dont think i can further open it. Can you help me with this.

Assembly-CSharp.dll not found

I've extracted the apk, but in assets\bin\Data\Managed folder there is etc, Metadata, Resources folder and SymbolMap-ARMv7 file, I didn't found any dll.

How can I find those dlls?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.