• Stars
    star
    267
  • Rank 153,621 (Top 4 %)
  • Language
    C#
  • License
    Other
  • Created over 9 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Platform to hook into Unity3D assemblies

UnityHook

UnityHook is a simple platform for hooking managed function calls, targeting specifically assemblies compiled for Unity3d games.

Installed hooks allow overriding hooked functions' return values, essentially granting complete control over managed code execution in a targeted game.

Hooker

Hooker is the project that actually injects code into original game assemblies/libraries (= .dll files). It can be used to 'hook' and 'restore' assemblies. Run hooker.exe help for information about the options to pass. To hook game-assemblies you need to tell it the location of the game folder and the path to a compiled HookRegistry binary.

HookRegistry

HookRegistry is the project that contains code to be executed when a hooked method/function has been called while the game is running. The project compiles to 1 binary file that must be passed to Hooker. Currently implemented hooks are following:

  • Hearthstone - with dependancy on HS game libraries
    • Disable SSL connection between client/server;
    • Duplicate packets transferred between client/server to other TCP streams. These streams try to attach to the HearthStone PacketAnalyzer.
  • General
    • Hooking into the Unity logger.

Hooker will attempt to copy all referenced (by HookRegistry) library files to the library folder of the game. Make sure to validate all necessary library files are copied by inspecting the Hooker log output.

Hooks file

The file which declares all methods, located inside the game libraries, to be hooked. See /Hooker/example_hooks for more information about it's syntax. The example_hooks file is used in the next section's example.

NOTE: The hooker will always hook all methods entered in the Hooks file, if found. Hooking a specific method when the HooksRegistry binary has no code to inject will have NO side effect on the game! The game will run a bit slower though..

Build

Visual Studio 2017 has to be installed to build both projects. Required components are C# - and Unity development tools! Visual Studio 2017 Community edition is free to download and capable to perform the build.

  1. Clone the repo;
  2. Create a junction link between the solution folder and the game install path. See /createJunction.bat;
  3. Open UnityHook solution file with Visual Studio;
  4. Build project Hooker;
  5. Build project HookRegistry;
  6. All binary files can be found inside the bin folder of each project.

Usage Example

The example expects the example_hooks file to be used as of the latest commit, also the latest HookRegistry binary.

Effects of the example

  • The game creates a non secure connection to the server (NOT through a TLS tunnel);
  • All transferred network packets are being duplicated to another TCP 'dump'-stream.

What you need

  • The PATH to Hooker compiled binaries. Refered to as {HOOKERPATH};
  • The compiled binary FILE from HookRegistry. Referred to as {REGISTRY};
  • The PATH to the game installation folder. Referred to as {GAMEDIR};
  • The path to a hooks FILE, example_hooks as mentioned above. Referred to as {HOOKS}.

Steps

  1. Call Hooker.exe;
{HOOKERPATH}\Hooker.exe hook -d "{GAMEDIR}" -h "{HOOKS}" -l "{REGISTRY}"
  1. Verify that that Hooker did not encounter a problem;
    • Check the log output;
    • Requested methods are hooked;
    • Game assemblies are duplicated next to the original as {name}.original.dll -> Backup;
    • Patched assemblies are written to the game directory as {name}.out.dll;
    • Patched assemblies replaced the original assemblies as {name}.dll;
    • HookRegistry assembly, and referenced assemblies, are copied next to the game assemblies;
  2. Run the game -> Watch the game log for lines starting with [HOOKER].

To restore, run the command {HOOKERPATH}\Hooker.exe restore -d "{GAMEDIR}"

Remarks

  • This project is intended to run within the context of the Unity Engine. If Unity Engine is not initialised when HookRegistry is initialised, then no hooks will run. Each method will perform as if unhooked when outside of the Unity Engine context.

More Repositories

1

Hearthstone-Deck-Tracker

A deck tracker and deck manager for Hearthstone on Windows
C#
4,667
star
2

HSTracker

A deck tracker and deck manager for Hearthstone on macOS
Swift
1,170
star
3

UnityPack

Python deserialization library for Unity3D Asset format
Python
720
star
4

hsdata

Hearthstone Data
262
star
5

SabberStone

Just another Hearthstone Simulator in C# .Net Core, with some A.I. approaches!
C#
249
star
6

python-hearthstone

Hearthstone Python library (CardDefs, DBF, enums, log parser)
Python
237
star
7

Arcane-Tracker

An automatic Hearthstone tracker for Android
Kotlin
147
star
8

python-fsb5

Library and tool to extract audio from FSB5 (FMOD Sample Bank) files
Python
136
star
9

Joust

🍿 Hearthstone replays in your browser.
TypeScript
116
star
10

Sunwell

Canvas-based high quality Hearthstone card renderer - no longer maintained
TypeScript
94
star
11

proto-extractor

Program to extract protobufs compiled for C#
C#
88
star
12

dj-paypal

Paypal integration for Django - Inspired by dj-Stripe
Python
84
star
13

HearthDb

HearthDb is a .NET Hearthstone database.
C#
69
star
14

hs-bugs

Unofficial Hearthstone issue tracker
65
star
15

docker-pgredshift

Redshift docker image based on postgres
Dockerfile
64
star
16

python-hslog

Python module to parse Hearthstone Power.log files
Python
59
star
17

HDT-Releases

58
star
18

hearthstone-deckstrings

πŸ”— Decode and encode Hearthstone Deckstrings.
JavaScript
52
star
19

python-hsreplay

Python library for creating and parsing HSReplay XML files
Python
50
star
20

LotusTracker

Deck Tracker for Magic Arena [DEPRECATED]
C++
50
star
21

twitch-hdt-frontend

πŸ“Ί The official Twitch Extension for Hearthstone Deck Tracker.
TypeScript
42
star
22

hs-icons

Hearthstone vector icons
39
star
23

hsproto

Hearthstone Protobuf files
33
star
24

hsreplaynet-localstack

HSReplay.net local Docker dev stack
Python
32
star
25

HDT-Localization

Localization for Hearthstone Deck Tracker
XML
23
star
26

Brazier

Hearthstone Simulator in Java
Java
21
star
27

dynity

Load an assembly in Unity at runtime
C++
20
star
28

keg

A client for Blizzard's NGDP protocol
Python
20
star
29

django-reflinks

Referral links implementation for Django
Python
15
star
30

twitch-hdt-ebs

πŸ“’ Twitch Extension Backend Service for Hearthstone Deck Tracker.
Python
15
star
31

decrunch

Python wrapper around Crunch DXTc decompressor
C++
14
star
32

articles

Analysis of Hearthstone replays
Jupyter Notebook
11
star
33

hs-card-tiles

Hearthstone Card Tiles
C#
9
star
34

unity-examples

ASP
9
star
35

UnityPack-Swift

Swift port of UnityPack
C
8
star
36

hearthstonejson-client

πŸ“– HearthstoneJSON client for browsers and Node.
TypeScript
8
star
37

python-hearthstone-data

CardDefs.xml and Strings.txt for Hearthstone, conveniently packaged in Python
Python
7
star
38

HearthBot

Hearthstone bot for Discord
Python
7
star
39

hsreplay-xml

πŸ“Ό Replay format for Hearthstone
6
star
40

HSTracker-Beta

6
star
41

hearthsim.info

The HearthSim community website
SCSS
6
star
42

hearthforge

JavaScript
5
star
43

hsreplaynet-i18n

🌎 Translations for HSReplay.net.
Gettext Catalog
5
star
44

pyreplib

Starcraft Replay File parser [archived]
C++
5
star
45

deck-code-bot

A bot for decoding Hearthstone deck codes on Reddit
Python
4
star
46

legal

HearthSim legal documents (Privacy Policy, Terms of Services, etc)
Markdown
3
star
47

hsreplaynet-embed

Embeddable library for HSReplay.net features on other sites
TypeScript
3
star
48

FSBReader

FSB Reader code for FSBExtractor
Pascal
3
star
49

scenfiles

Hearthstone .scen files and conversion utility
Python
2
star
50

HearthstoneJSON.com

The HearthstoneJSON.com frontend jekyll website
CSS
2
star
51

hsreplay-test-data

Log data for HSReplay and hslog tests
XML
2
star
52

node-canvas-lambda

Builds node-canvas for lambda
Shell
2
star
53

kettle-design

Repo for Kettle design collaboration
C#
2
star
54

CardBot-lua

An IRC card search bot for #hearthsim [archived]
Lua
2
star
55

django-intenumfield

An IntEnumField for Django
Python
2
star
56

deckwarper

πŸ”§ A tiny web-based tool to create and edit Hearthstone decks.
JavaScript
2
star
57

hsreplaynet-api-docs

1
star
58

SabberStoneSynchronizer

Synchronizer between a running Hearthstone client and SabberStone.
C#
1
star
59

hearthsim-instrumentation

Legacy HSReplay.net runtime tooling
Python
1
star
60

HDT-Releases-HSReplay

1
star
61

MtgLotusValley.com

www.mtglotusvalley.com
Vue
1
star
62

hsreplaynet-lambdas

Python
1
star
63

branding

🎨 Logos, Colors and Guidelines for the HearthSim brands.
1
star
64

eslint-config-typescript

HearthSim's common ESLint configuration
JavaScript
1
star
65

Firestarter

Rust
1
star
66

mpqlib

Bob Jenkins' MPQLib (Public Domain)
C
1
star
67

react-hs-components

πŸ—„οΈ Common React components used across HearthSim products.
TypeScript
1
star
68

django-hearthstone

Hearthstone DBF models for Django
Python
1
star
69

hs-proto-go

Autogenerated Golang code for hs-proto
Shell
1
star