Posted: Wed Feb 25, 2015 11:31 am Post subject: [C#] Hook into an exe and execute some of its functions
I have a simple program in C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static int count;
static void Main(string[] args)
{
for (int i = 0; i<10; i++)
{
Console.WriteLine(func_count());
Console.ReadKey();
}
}
static int func_count()
{
return count++;
}
}
}
I want to write another simple C# program that will be able JUST to execute the func_count() WITHOUT being detected. In C after getting the right to access the memory region to avoid seg fault I would have to use a pointer to a function - something like:
int (* func_ptr)(); //pointer to function
func_ptr = func_count_address
What's a simple way to do this in C# like above that will also be undetectable?
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
Posted: Wed Feb 25, 2015 3:39 pm Post subject:
If both apps are .NET the easiest way would be via loader reflection. You can load the first application inside of your own and reflect its properties and members to invoke them etc with ease. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum