0

I've started to work on my runPE just to get a little more familiar with C# and how a runPE work. Just for learning purposes. And this is how I do it.

private static void Inject(string injectTo, string binToInject)
{
    int num = 0;
    RunPe.Run(Path.Combine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), /*injectTo*/"ilasm.exe"),"", File.ReadAllBytes(binToInject), 4, ref num);
}

How ever, right now the bin(.exe) file I 'inject' located on my machine, what I would like to do is to stream this bin from DataBase or a server so it would not need to be on my machine. Is that possible?

1 Answer 1

1

Presumably this is the only interaction you have with the file?:

File.ReadAllBytes(binToInject)

All that does is return a byte[] array representing the contents of the file. So anything which returns the same thing would work as a drop-in functional replacement.

Any data access technology (plain ADO.NET, Entity Framework, etc.) would generally treat a BLOB column (which would contain a file) as a byte[], or at least something easily converted to that. So in general, yes, you can serve your file from any source.

Sign up to request clarification or add additional context in comments.

2 Comments

I'll look closer into that, thanks. And File.ReadAllBytes is the only interaction I have right now with the file, though I would not have a problem to change that if it would make the secound part easier.
Accepting this as an answear as thanks to this i got it working flawless. Thanks a ton.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.