Giter VIP home page Giter VIP logo

goalnet's Introduction

goalnet

A payload and injector that enables easy .NET Core DLL injection.

Motivation

A while ago, I was writing some injected C# code for the game FINAL FANTASY XIV. I ended up writing an injector and loader using dll-syringe and netcorehost, supporting the ability to unload itself. Later on, for another game, I wanted to reuse some its features and code, so I ended up writing it again a second time. ...then it came up a third time, and I questioned what I was doing with my life.

goalnet enables you to use C# in another process without having to think about the setup. Add a static method & delegate, write a config file, and then start the injector. No extra thought required.

Example

Let's use the examples/hello-goalnet folder as an example. This project loads into Notepad, shows a message box, and unloads itself.

To demonstrate it in action, start Notepad, then build everything. goalnet-injector takes one argument, which is the path to the config file.

$ cargo build --release
$ dotnet build --configuration Release ./examples/hello-goalnet/HelloGoalnet
$ cargo run --release -p goalnet-injector -- ./examples/hello-goalnet/config.toml

Project setup

Every project that uses goalnet requires a config file, along with some setup in the assembly itself. See the above example for all values in the config file.

In the project's .csproj, GenerateRuntimeConfigurationFiles must be set to true. This is required for goalnet, as it creates a .runtimeconfig.json (used to determine what .NET version to use).

The assembly must have a class with an entrypoint method, along with a delegate matching the method signature. The entrypoint method must be static, contain no arguments, and returns void.

When unload is set to true, the entrypoint method instead takes one argument, being an IntPtr/nint to the unload function. This can be casted into a delegate, which can be called to signal unloading the assembly from inside itself. This will only work as long as the injector process is still alive and communicating with the goalnet payload.

When copy_build_artifacts is set to true, the entire specified directory (along with the goalnet payload itself) is copied to a temporary directory. This is wasteful, but allows you to bypass file locking issues, meaning you can cleanly unload and reload the assembly without having to restart the target process.

goalnet's People

Contributors

notnite avatar

Stargazers

 avatar Jade avatar fangs avatar

Watchers

 avatar

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.