Skip to content

csharpHub/Unispect

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Not currently ready for github. Getting there, please be patient. :)


Unispect

unispect

Unispect is a mono type definition and field inspector targetting Unity games compiled with mono. It does so by accessing the remote process's memory.

Screenshot0

The design choice of accessing the process memory to gather the definitions was made with the intention of being able to access the run-time type definitions as well as accurate field definition information.

Screenshot1

Features

  • Display type definitions from classes, structures, interfaces and enums
  • Display field definitions including offsets, types and static values *¹
  • Automatic deobfuscation of obfuscated names *²
  • Save processed information to a formatted document for manual digestion
  • Plugin interface for custom memory access implementations
  • Track types in more detail in the inspector by simply clicking on the base or extended type

Static values are still being implemented

These will match between users, but they will not match de4dot's naming

Screenshot2

Planned features (these aren't definite, but likely):

  • The ability to drag desired type hierarchies into a project view
  • Save project state so you can review the information at a later time
  • Export a .NET Framework dynamic link library using the project information
  • Changes to the application interface, more UI elements to make swift browsing more accessible

Current Limitations & Thoughts

  • Currently only tested on Unity 2018 and Unity 2019 builds. When I push the Assembly Export feature, I will also convert the static structures used to read all of the remote information into dynamic structures and allow the offsets to be customized with a JSON file. This will allow Unispect to target a broader spectrum of Unity versions.

  • Only works with Unity Scripting Backend: Mono. IL2CPP may be supported in the future.

  • Only works with x64 systems and software. I might (unlikely) add support for x32 in the future.

  • Static, constant and enum values are not shown. Still figuring those out.

  • Method definitions are not collected. This is intentional, but I may implement it in the future with good reason.

  • You can only view a type definition from another MonoImage if it's the parent of one from the current MonoImage.

    (I will probably change the code to iterate over all modules and collect all information in the future)

  • Unispect's 'Deobfuscation' only targets the most common obfuscation seen on Unity's managed assemblies.

Tech

Unispect uses these projects (or plans to):

  • MahApps.Metro - A toolkit for creating modern WPF applications. Lots of goodness out-of-the box.
  • Fody.Costura - Merges IL assemblies together, makes things more portable!
  • [DynamicStructs] (Currently Private) - A dynamic struct generator written by me. :)

Installation

Unispect requires the .NET Framework v4.8 or higher to be installed in order to run. I currently have no plans on porting it to other frameworks or platforms.

Example file output (small snippet):

[Class] GPUInstancer.SpaceshipMobileJoystick : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler, IDragHandler
    [00] OffsetOfInstanceIDInCPlusPlusObject : Int32
    [00] objectIsNullMessage : String
    [00] cloneDestroyedMessage : String
    [10] m_CachedPtr : IntPtr
    [18] image_0x18 : UnityEngine.UI.Image
    [20] image_0x20 : UnityEngine.UI.Image
    [28] inputDirection : UnityEngine.Vector3
    [34] vector2_0x34 : UnityEngine.Vector2
[Class] GPUInstancer.TerrainGenerator : MonoBehaviour
    [00] HELPTEXT_detailHealthyColor : String
    [00] OffsetOfInstanceIDInCPlusPlusObject : Int32
    [00] objectIsNullMessage : String
    [00] cloneDestroyedMessage : String
    [08] HELPTEXT_detailDryColor : String

Plugins

  • Start a new Class Library (.NET Framework) project and replace your starting code with the code from MemoryPluginTemplate.cs
  • Add a reference to Unispect.exe (Project > Add Reference... > Browse)
  • Change your Build Platform target to x64
  • Edit the code to your hearts content
  • Compile the class library and place the .dll into Unispect's plugins folder (Unispect\Plugins)
  • Open Unispect and click "Load Plugin". Look for your class name and then select it by clicking on it.

Screenshot1

Note: Every time Unispect is restarted the memory access type will be reverted to default. So for now you will need to ensure you reselect your plugin every time you restart the application.

Build

  • Visual Studio 2019: Build > Build Solution (F6)
  • Visual Studio 2017: Remove the 'Fody.Costura' NuGet package then Build > Build Solution (F6)

Support

Contribute? Nice! Fork and request a pull.

License

All code, NuGets and binaries are under the MIT License (MIT)

About

A mono type definition and field inspector for Unity games compiled with mono.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%