Note
Mecha has been archived and no longer receives developer support, as it is considered complete.
Mecha is a simple, minimal low-level debugger for the League of Legends client.
Features:
- Users can debug the client using the Chrome Developer Tools through remote debugging on a specified port
- Users can enable web debugging proxies, such as Fiddler
To install Mecha, you'll need to carefully follow a list of instructions and you'll have to have Administrator rights.
To begin, you'll first have to compile Mecha.
- The Mecha source code (Download from GitHub or get via Git:
git clone https://github.com/x00bence/Mecha.git
) - Visual Studio 22 or higher
- Component: Desktop development with C++
- Component: Windows SDK
- A few minutes of your time
- Get the Mecha source code
- Navigate into the Mecha source code directory
- Navigate into the src subdirectory
- Open the Mecha.sln solution file using Visual Studio
- Solution Explorer > right-click "Solution 'Mecha'" > Restore NuGet packages
- Optionally, customize the settings
- Set the configuration to Release and the platform to x64
- Solution Explorer > right-click "Solution 'Mecha'" > Build Solution
- That's it!
Your antivirus may nag you about possible threats after compilation. This is completely normal; Mecha is not doing anything bad. You can fix this by adding an exclusion to the relevant offenders or by disabling your antivirus software.
To customize the settings you'll need to edit a small source file, Mecha\src\Payload\src\config.h
, before compiling Mecha. The contents of the file are very straightforward. The following defaults are provided:
ENABLE_REMOTE_DEBUGGING
: enables remote debugging with the Chrome Developer Tools; default:true
PORT
: a valid free port for the remote debugger; default:42069
ENABLE_PROXY_SERVER
: enables web debugging proxies like Fiddler; default:true
Note
Please note that if you wish to change the settings later down the line, you'll have to repeat compilation steps 2-9, as well as post-compilation steps 1-2 (1-8 if working from scratch).
Now that Mecha is compiled, the "real" installation process can begin. You'll have to manually move some compiled files then configure the registry.
- The compiled
Stub.exe
binary - The compiled
Payload.dll
dynamic-link library - Administrator rights on your machine
- Access to the Registry Editor
- ... and a few more minutes of your time
- Navigate into the compilation output directory (Found at the
Mecha\src\x64\Release
path if you've followed correctly so far) - Copy
Stub.exe
andPayload.dll
into your League of Legends installation directory (For example:C:\Riot Games\League of Legends
; the directory must containLeagueClientUx.exe
) - Copy the path of the copied
Stub.exe
(Right-click > Copy as path) - Open the Registry Editor (Windows Key + R, then type
regedit
) - Navigate to the
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
key - Add a new key under
Image File Execution Options
with the nameLeagueClientUx.exe
- In the
LeagueClientUx.exe
key, add a new string value nameddebugger
with the value data set to the path copied in Step 3 - Done!
Click here to view the intended Registry Editor configuration!
If you've gotten this far, good job! You've essentially just compiled and installed Mecha.
Mecha will persist on every new instance of your client until you decide to get rid of the registry value that was set earlier.
To get started with debugging, you can read the usage instructions.
First, make sure you've compiled Mecha with support for remote debugging (enabled by default). If enabled, the remote debugger will become accessible through the configured port (42069
by default) once you start the client.
To start debugging the client using the Chrome Developer Tools, you'll have to follow these steps:
- Launch your client
- In your browser, or using a REST client, visit/GET
127.0.0.1:PORT/json
, wherePORT
is the configured remote debugging port - In the resulting JSON, take the value of the
devtoolsFrontendUrl
key in the first object - Append the taken value to
127.0.0.1:PORT
; this should result in a URL like127.0.0.1:PORT/devtools/inspector.html?ws=127.0.0.1:PORT/devtools/page/<ID>
- Visit the URL and enjoy debugging!
First, make sure you've compiled Mecha with support for enabling proxy servers (enabled by default). If enabled, Fiddler will be able to intercept the HTTP(S) traffic of the client.
Note
Make sure you only capture traffic after the client loads. Otherwise, the client will fail to load and get stuck.
To get Fiddler working with the client, you'll have to follow these steps:
- In Fiddler, click Tools > Options > HTTPS
- Click Decrypt HTTPS Traffic
- Click Ignore server certificate errors
- Press
F12
or uncheck File > Capture Traffic to stop capturing traffic - Launch the client and let it load
- Press
F12
or check File > Capture Traffic to start capturing traffic - Done. Enjoy proxying!
A: It's hard to say for certain. Generally speaking, Mecha is >90% safe, as it doesn't really do anything sketchy to misuse or compromise the client out of the box. However, Mecha, just like any other third party tool, falls under the "use at your own risk" umbrella, and as such, Riot Games has every right to take action as required.
TL;DR: Use Mecha at your own risk, as intended, and you'll most likely be fine.
A: Magic! (Okay, not really...)
High-level overview:
- In the registry, we set
Stub.exe
as a debugger toLeagueClientUx.exe
, which will intercept the launch of the client Stub.exe
spawnsLeagueClientUx.exe
withPayload.dll
injectedPayload.dll
hooks thecef_initialize
export oflibcef.dll
, which the client depends on- We enable our features by doing extra processing of the command line string through CEF
Resources to learn more:
Registry (Image File Execution Options), Debugging:
- Image File Execution Options
- Persistence β Image File Execution Options Injection
- Creating a Basic Debugger
- How do debuggers bypass Image File Execution Options when launching their debugee?
- Injecting DLLs at the start of a Windows process
Hooking, Reverse Engineering, Hacking:
The League of Legends client:
A: Mecha is designed to be static, simple, and "DIY". Providing support for installation and configuration adds notable difficulty and introduces more points of failure. Additionally, by integrating the settings with the compilation step we can make the resulting files a bit smaller by excluding unneeded features.
Don't like it? Fork it! :3
A: I (x00bence) have had very dwindling interest in League of Legends in recent times due to the overall stagnating health of the game and the apparent lack of care displayed towards it. Personally, even as a multi-season high elo player, the game feels completely dry and devoid of life and more of a chore to play and interact with than anything. Because of this, I'd like to move on, and unfortunately, that means Mecha has to go, too.
I consider Mecha complete, but in any case, everyone is welcome to fork the project and extend/maintain it.
The inspiration for Mecha came from these two projects:
If you'd like to do more than just debugging, you can view this other awesome project as well: