x64Dbg plugin that enables C# plugins with hot-loading support and scripting.

Overview

DotX64Dbg (EARLY ALPHA)

Plugins and Scripting with C# for x64Dbg.

Create Plugins for X64Dbg with ease

DotX64Dbg aims to provide a seamless way to write and test plugins for X64Dbg using .Net 5.0 and C#.

You can create/edit/debug plugins without ever restarting x64Dbg. Live Coding

This gif showcases how you debug and edit your plugin at the same time, this also showcases how you can register custom commands for x64Dbg on the fly, the same works also for expressions.

No more binaries

DotX64Dbg does not load the plugins as binaries instead it will automatically compile your plugin code as soon something changes and reloads it, this also means all plugins will be shipped as pure code which means its a lot harder to hide malicious code in there.

Installing

There is currently no official release. You can grab the latest artifacts from the CI to try it out or build it yourself.

Your first Plugin

Creating new plugins is as easy as creating a new folder with two new files. By default the DotX64Dbg plugins are located in the root directory of X64Dbg called dotplugins this can be however configured via dotx64dbg.json.

Simply create a new folder in dotplugins called SamplePlugin, plugins are required to have a file called plugin.json which should look like following:

{
  "Name": "Sample Plugin",
  "Description": "My awesome plugin",
  "Version": "1.0.0",
  "Author": "Bob",
  "Website": "http://github.com/[youruser]/yourplugin",
  "Settings": {
    "Test": true
  }
}

Without the plugin.json file plugins will not load. The last thing you need is some code that defines the plugin entry class, this is done by deriving from IPlugin, you can have only one class that derives from this interface. Create a file named SamplePlugin.cs, you can choose any filename you like. To bootstrap the plugin you need at least following minimal example:

using System;
using Dotx64Dbg;

public class SamplePlugin : IPlugin
{
    public SamplePlugin()
    {
        // Constructor, only called during first load
    }
    
    // Called as soon the plugin is fully initialized, this is called after
    // the constructor and only once the for the initial plugin load.
    public void Startup()
    {
        Console.WriteLine("Startup time!");
    }
    
    // Called before the plugin is about to be unloaded.
    public void Shutdown()
    {
        Console.WriteLine("We are about to go offline");
    }
}

After the two files are created DotX64Dbg will detect the changes and immediately starts compiling/(re-)loading the plugin. DotX64Dbg will also automatically generate a .csproj file with the correct assembly references being setup. If you want to debug your plugins simply attach Visual Studio to x64Dbg and place the breakpoints where you would like to stop, its as simple as that.

There is also test plugin available here

Scripting

DotX64Dbg also provides a scripting interface, unlike plugins a script will be without state and only executes once. Scripts can use the same APIs as plugins. To execute scripts use following command:

dotscript 

You can find an example script here

Building

Requirements

  • Net 5.0 SDK.
  • Visual Studio 2019 Community or greater.
  • Vcpkg
  • Zydis

Vcpkg

Vcpkg is currently required with the integration setup. This is planned to change in the future.

Building

After everything is setup you should be open Dotx64Dbg.sln and be able to build the entire solution.

Documentation

The plan is to document all public API which also makes the documentation available to Intellisense. A good starting point is to check the plugin example, a lot of functions and classes already have minimal documentation, the best way to find out whats there is to explore the Assembly in Visual Studio with the Object Explorer. Object Explorer

Comments
  • Adding NuGet support

    Adding NuGet support

    NuGet support?

    I added rough support for NuGet dependencies in the Csharp projects. Currently, it's capable of searching for the 'PackageReference' tag in the project, automatically resolving the references via NuGet.

    How it's done:

    First, it tries to find the package locally in the packages cache, otherwise, it creates a local NuGet repository to store the dependencies packages that will be downloaded and used for future builds.

    Notes:

    It requires more testing and has room for improvements in the code.

    testing required 
    opened by Guila767 9
  • Cache plugin builds

    Cache plugin builds

    Major changes:

    • The AssemblyLoader class is now responsible for loading all required plugin dependencies to the current domain. This solves the issue that dependencies only got loaded in rebuild time

    • A refactor in dependency management

    • Support for plugin build cache

    opened by Guila767 8
  • Issue with single .cs plugins and Visual Studio

    Issue with single .cs plugins and Visual Studio

    Reference: https://developercommunity.visualstudio.com/t/tmp-files-created-in-solution-directory/180376

    This needs to be detected to avoid unloading the plugin entirely for a brief moment, this also disables hotloading because of this effect.

    opened by ZehMatt 0
  • Ignore files generated by VS for hot-reload

    Ignore files generated by VS for hot-reload

    It currently wants to compile every *.cs file, when VS is loaded the .vs and obj folder can contain private source files which should not be compiled.

    opened by ZehMatt 0
  • add  .NET 6 support

    add .NET 6 support

    本地预配向导和预配代理。 若要开始生成 .NET 应用,请下载并安装 .NET SDK (软件开发工具包)。

    [

    ](https://download.visualstudio.microsoft.com/download/pr/deb4711b-7bbc-4afa-8884-9f2b964797f2/fb603c451b2a6e0a2cb5372d33ed68b9/dotnet-sdk-6.0.300-win-x64.exe)

    32 位下载 | Arm64 下载

    opened by tqangxl 0
  • Make command arguments optional for registration

    Make command arguments optional for registration

    Commands currently require the function signature of bool Command(string[] args) or void Command(string[] args). In a lot of cases the arguments are unused and should be made optional.

    opened by ZehMatt 0
  • Potential race condition on menu registration

    Potential race condition on menu registration

    One thing that I noticed is the dictionary used in the menu system should probably be a ConcurrentDictionary (not sure) because sometimes when calling ReloadPlugin here: https://github.com/x64dbg/DotX64Dbg/blob/b51c825fde261ca54c7296f68f55f4563c4558c1/src/Dotx64Managed/Plugins.Builder.cs#L168 It can throw an exception like ArgumentException or NullReferenceException like:

    image

    or even deadlock the application at startup. I also, for testing, added a Thread.Sleep(100) before calling ReloadPlugin, and seems to "solve" the problem. That's why I think I could be a concurrency problem

    Originally posted by @Guila767 in https://github.com/x64dbg/DotX64Dbg/issues/48#issuecomment-979362879

    bug hotload 
    opened by ZehMatt 0
Releases(v0.0.2)
  • v0.0.2(Sep 17, 2022)

    What's Changed

    • Github CI by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/4
    • Refactoring and CI tests by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/5
    • Add some information by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/6
    • Refactor instruction meta by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/7
    • Add bindings for some symbols by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/8
    • Improve CI by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/9
    • Add more events by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/10
    • Plugins can now be dynamically added and removed during runtime by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/11
    • Update SDK by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/12
    • Example plugin update by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/13
    • Load the CLR dll from Non-CLR dll to avoid crashes on missing SDK by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/14
    • Fix 32 bit not working by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/15
    • Use correct calling convention for expressions and commands by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/16
    • Add memory stream API for the child process by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/17
    • Allow the use of WinForms by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/18
    • Refactor plugin reloading, unloading and registration by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/19
    • Fix out of bounds access with instruction operands by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/20
    • Update vcpkg by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/21
    • Remove vcpkg and integrate zydis into Solution by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/22
    • Add PID, Handle process bindings by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/23
    • Refactor RegisterMaskGp by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/25
    • Memory protection bindings by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/26
    • Fix assembler encoding by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/29
    • Refactor operand api by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/30
    • Rename OpImm to Immediate by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/32
    • Fix encoder issues by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/33
    • Fix memory scale by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/34
    • Refactor assembler by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/35
    • Fix out of bounds access by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/36
    • Fix missing memory operand size strings and constructors by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/37
    • Fix instruction generator unable to handle addresses correctly by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/38
    • Adding NuGet support by @Guila767 in https://github.com/x64dbg/DotX64Dbg/pull/28
    • Fix rebuilds not triggering when dependencies changed in plugin.json by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/40
    • Add apis for module exports and imports by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/41
    • Minor fixes in the 'NuGetDependencyResolver' class. by @Guila767 in https://github.com/x64dbg/DotX64Dbg/pull/42
    • #39: Add menus by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/43
    • Use nuint for selections by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/44
    • Use UTF8 for bindings by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/45
    • Add CI functionality to release to GitHub on tag by @mrexodia in https://github.com/x64dbg/DotX64Dbg/pull/46
    • Added support for menu icons by @Guila767 in https://github.com/x64dbg/DotX64Dbg/pull/47
    • Cache plugin builds by @Guila767 in https://github.com/x64dbg/DotX64Dbg/pull/48
    • Refactor register code by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/49
    • Fix new plugins being created in wrong path if relative by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/52
    • Fix dead lock during menu registration by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/53
    • Close #51: Make command arguments optional by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/54
    • Migrate to .net 6.0 framework by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/56
    • Fix a crash when unable to resolve nuget dependencies by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/57
    • First release by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/58
    • Fix plugins not loading when one plugin has exceptions during startup by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/59
    • #60: Place cache in x64/x86 directories by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/61

    New Contributors

    • @ZehMatt made their first contribution in https://github.com/x64dbg/DotX64Dbg/pull/4
    • @Guila767 made their first contribution in https://github.com/x64dbg/DotX64Dbg/pull/28
    • @mrexodia made their first contribution in https://github.com/x64dbg/DotX64Dbg/pull/46

    Full Changelog: https://github.com/x64dbg/DotX64Dbg/commits/v0.0.2

    Source code(tar.gz)
    Source code(zip)
    DotX64Dbg-v0.0.2.zip(12.24 MB)
  • v0.0.1(May 27, 2022)

    What's Changed

    • Github CI by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/4
    • Refactoring and CI tests by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/5
    • Add some information by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/6
    • Refactor instruction meta by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/7
    • Add bindings for some symbols by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/8
    • Improve CI by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/9
    • Add more events by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/10
    • Plugins can now be dynamically added and removed during runtime by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/11
    • Update SDK by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/12
    • Example plugin update by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/13
    • Load the CLR dll from Non-CLR dll to avoid crashes on missing SDK by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/14
    • Fix 32 bit not working by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/15
    • Use correct calling convention for expressions and commands by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/16
    • Add memory stream API for the child process by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/17
    • Allow the use of WinForms by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/18
    • Refactor plugin reloading, unloading and registration by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/19
    • Fix out of bounds access with instruction operands by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/20
    • Update vcpkg by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/21
    • Remove vcpkg and integrate zydis into Solution by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/22
    • Add PID, Handle process bindings by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/23
    • Refactor RegisterMaskGp by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/25
    • Memory protection bindings by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/26
    • Fix assembler encoding by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/29
    • Refactor operand api by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/30
    • Rename OpImm to Immediate by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/32
    • Fix encoder issues by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/33
    • Fix memory scale by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/34
    • Refactor assembler by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/35
    • Fix out of bounds access by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/36
    • Fix missing memory operand size strings and constructors by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/37
    • Fix instruction generator unable to handle addresses correctly by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/38
    • Adding NuGet support by @Guila767 in https://github.com/x64dbg/DotX64Dbg/pull/28
    • Fix rebuilds not triggering when dependencies changed in plugin.json by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/40
    • Add apis for module exports and imports by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/41
    • Minor fixes in the 'NuGetDependencyResolver' class. by @Guila767 in https://github.com/x64dbg/DotX64Dbg/pull/42
    • #39: Add menus by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/43
    • Use nuint for selections by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/44
    • Use UTF8 for bindings by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/45
    • Add CI functionality to release to GitHub on tag by @mrexodia in https://github.com/x64dbg/DotX64Dbg/pull/46
    • Added support for menu icons by @Guila767 in https://github.com/x64dbg/DotX64Dbg/pull/47
    • Cache plugin builds by @Guila767 in https://github.com/x64dbg/DotX64Dbg/pull/48
    • Refactor register code by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/49
    • Fix new plugins being created in wrong path if relative by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/52
    • Fix dead lock during menu registration by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/53
    • Close #51: Make command arguments optional by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/54
    • Migrate to .net 6.0 framework by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/56
    • Fix a crash when unable to resolve nuget dependencies by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/57
    • First release by @ZehMatt in https://github.com/x64dbg/DotX64Dbg/pull/58

    New Contributors

    • @Guila767 made their first contribution in https://github.com/x64dbg/DotX64Dbg/pull/28
    • @mrexodia made their first contribution in https://github.com/x64dbg/DotX64Dbg/pull/46

    Full Changelog: https://github.com/x64dbg/DotX64Dbg/commits/v0.0.1

    Source code(tar.gz)
    Source code(zip)
    DotX64Dbg-v0.0.1.zip(12.24 MB)
Owner
x64dbg
An open-source x64/x32 debugger for windows.
x64dbg
A plugin for x64dbg.

x128dbg x128dbg 是一个 x64dbg 的插件,随着时间的推移,它会有越来越多的功能 目前的 x128dbg 的版本为 v1 ,它提供了查看汇编指令手册的功能 查看汇编指令手册 有时,我们在使用 x64dbg 调试时,会碰到不认识的汇编指令(即使开启了 x64dbg 自带的 Ctrl+

古月浪子 21 Sep 22, 2022
Hypervisor based anti anti debug plugin for x64dbg

HyperHide Table of Contents Description Compilation Support Usage Information Examples Features 1. Process Environment Block (PEB) 2. Heap Flags 3. Pr

Air 677 Jan 8, 2023
With xshellex you can paste any kind of c-shellcode strings in x64dbg, ollydbg & immunity debugger

With xshellex you can paste any kind of c-shellcode strings in x64dbg, ollydbg & immunity debugger. Also you can convert the "binary-copied-clipboard" to c-shellcode string.

David Reguera Garcia aka Dreg 30 Oct 7, 2022
Clang plugin to find method or property directable.

ObjCDirectFinder Clang had provided objc_direct attribute for us to write this: @property (nonatomic, assign, direct) BOOL isLaunchFinished; - (BOOL)i

Kam-To 3 Jun 2, 2022
A microbenchmark support library

Benchmark A library to benchmark code snippets, similar to unit tests. Example: #include <benchmark/benchmark.h> static void BM_SomeFunction(benchmar

Google 7.1k Jan 3, 2023
A modern, C++-native, header-only, test framework for unit-tests, TDD and BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x branch)

Catch2 v3 is being developed! You are on the devel branch, where the next major version, v3, of Catch2 is being developed. As it is a significant rewo

Catch Org 16k Jan 8, 2023
A modern, C++-native, header-only, test framework for unit-tests, TDD and BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x branch)

Catch2 v3 is being developed! You are on the devel branch, where the next major version, v3, of Catch2 is being developed. As it is a significant rewo

Catch Org 16k Jan 8, 2023
The world's first free and open-source PlayStation 3 emulator/debugger, written in C++ for Windows and Linux.

The world's first free and open-source PlayStation 3 emulator/debugger, written in C++ for Windows and Linux.

null 12.1k Jan 2, 2023
CppUTest unit testing and mocking framework for C/C++

CppUTest CppUTest unit testing and mocking framework for C/C++ More information on the project page Slack channel: Join if link not expired Getting St

CppUTest 1.1k Dec 26, 2022
Googletest - Google Testing and Mocking Framework

GoogleTest OSS Builds Status Announcements Release 1.10.x Release 1.10.x is now available. Coming Soon Post 1.10.x googletest will follow Abseil Live

Google 28.7k Jan 7, 2023
A simple C++ 03/11/etc timer class for ~microsecond-precision cross-platform benchmarking. The implementation is as limited and as simple as possible to create the lowest amount of overhead.

plf_nanotimer A simple C++ 03/11/etc timer class for ~microsecond-precision cross-platform benchmarking. The implementation is as limited and simple a

Matt Bentley 102 Dec 4, 2022
🧪 single header unit testing framework for C and C++

?? utest.h A simple one header solution to unit testing for C/C++. Usage Just #include "utest.h" in your code! The current supported platforms are Lin

Neil Henning 560 Jan 1, 2023
Anti-Debug and Anti-Memory Dump for Android

AntiDebugandMemoryDump Anti-Debug and Anti-Memory Dump for Android Some known techniques for anti-debug and anti-memory dump have been used in this pr

Darvin 184 Dec 25, 2022
An efficient OpenFST-based tool for calculating WER and aligning two transcript sequences.

fstalign Overview Installation Dependencies Build Docker Quickstart WER Subcommand Align Subcommand Inputs Outputs Overview fstalign is a tool for cre

Rev 108 Dec 12, 2022
🍦IceCream-Cpp is a little (single header) library to help with the print debugging on C++11 and forward.

??IceCream-Cpp is a little (single header) library to help with the print debugging on C++11 and forward.

Renato Garcia 422 Dec 28, 2022
HyperDbg debugger is an open-source, hypervisor-assisted user-mode, and kernel-mode Windows debugger 🐞

HyperDbg debugger is an open-source, hypervisor-assisted user-mode, and kernel-mode Windows debugger with a focus on using modern hardware technologies. It is a debugger designed for analyzing, fuzzing and reversing. ??

HyperDbg 2k Dec 30, 2022
Watch for file changes and auto restart an application using fork checkpoints to continue the process (for quick live development)

Forkmon Watch for file changes and auto restart an application using fork checkpoints to continue. Intended for quick live development. This works onl

Eduardo Bart 12 Aug 27, 2022
Palanteer is a set of high performance visual profiler, debugger, tests enabler for C++ and Python

Palanteer is a set of lean and efficient tools to improve the general software quality, for C++ and Python programs.

Damien Feneyrou 1.9k Dec 29, 2022
Hibizcus is a collection of tools - Font proofing and debugging tools

Hibizcus Font proofing and debugging tools. Written by: Muthu Nedumaran Hibizcus is a collection of tools written to proof and debug in-house develope

Muthu Nedumaran 23 Oct 31, 2022