Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement better DLL injection methods #113

Open
unknownv2 opened this issue Dec 18, 2018 · 4 comments
Open

Implement better DLL injection methods #113

unknownv2 opened this issue Dec 18, 2018 · 4 comments

Comments

@unknownv2
Copy link
Owner

We will use this issue for a discussion on implementing different injection methods for our libraries.

@unknownv2 unknownv2 mentioned this issue Dec 18, 2018
@ghost
Copy link

ghost commented Dec 18, 2018

So if I understand correctly, we want a function in RemoteInjector.cs that starts a specified process and then manually maps a specified DLL into the process?

@unknownv2
Copy link
Owner Author

We want to implement a function to load a DLL into the process.

There is an interface for a Module Injector which is used to call the actual injection method.
https://github.com/unknownv2/CoreHook/blob/master/src/CoreHook.BinaryInjection/Loader/IModuleInjector.cs

The Module Injector Implementation here: https://github.com/unknownv2/CoreHook/blob/master/src/CoreHook.BinaryInjection/Loader/ModuleInjector.cs

The Assembly loading code is accessed through the AssemblyLoader class here:
https://github.com/unknownv2/CoreHook/blob/master/src/CoreHook.BinaryInjection/Loader/AssemblyLoader.cs#L21

Here is an example of a module being injected using it's filepath:
https://github.com/unknownv2/CoreHook/blob/master/src/CoreHook.BinaryInjection/RemoteInjection/RemoteInjector.cs#L206

The actual process we start is wrapped in a ManagedProcess handle: https://github.com/unknownv2/CoreHook/blob/master/src/CoreHook.Memory/ManagedProcess.cs#L7

The current injection method is implemented here:

https://github.com/unknownv2/CoreHook/blob/master/src/CoreHook.Memory/Processes/ProcessManager.Windows.cs#L20

So I think that would be the best place to implement the actual injection code, because then we don't have to change anything as far as function calls.

The .NET C# Process class is wrapped and passed to the ProcessManager here in the RemoteInjector: https://github.com/unknownv2/CoreHook/blob/master/src/CoreHook.BinaryInjection/RemoteInjection/RemoteInjector.cs#L34

You can modify the process creation code here if necessary: https://github.com/unknownv2/CoreHook/blob/master/src/CoreHook.BinaryInjection/RemoteInjection/RemoteInjector.cs#L85

@unknownv2
Copy link
Owner Author

If that's confusing, I understand as well... I really appreciate the help so I can answer any questions and I am very open to suggestions on how to better document everything or maybe how to better structure the code and projects to make it easier to understand.

Thank you again!

@ghost
Copy link

ghost commented Dec 18, 2018

Once we get this DLL injection working I could definitely help you structure the codebase of this project better as well as help you with the documentation of the functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant