Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

liulilittle/Interceptor.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

8 Commits

Repository files navigation

Interceptor.NET

.net clr /core (x86/x64 instruction set platform) managed function inline interceptor (hooking)

Restrictions

1, OS:
1.1 >= Linux(:centos-7)
1.1 >= Windows-XP
2, CPU: Must support IA32/IA64 instruction-set
3, RT:
3.1 >= .NET Core 2.0
3.2 >= .NET Framework 2.0

Usage

1, Install
var interceptor = new Interceptor(typeof(Samples).GetMethod("A"), typeof(Samples).GetMethod("B"));
2, Suspend
interceptor.Suspend();
2, Resume
interceptor.Resume();

Samples

class Samples
{
public static int A(int x, int y)
{
Console.WriteLine($"Program.A({x}, {y})");
return x + y;
}

public static int B(int x, int y)
{
Console.WriteLine($"Program.B({x}, {y})");
return x + y;
}

public class Foo
{
public void A()
{
Console.WriteLine("Foo.A");
}

public void B()
{
Console.WriteLine("Foo.B");
}

public void G(int x)
{
Console.WriteLine($"Foo.G{x}");
}
};

public static void G(Foo foo, int x)
{
Console.WriteLine($"Program.Foo.G({x})");
}

static void Main(string[] args)
{
Interceptor[] interceptor = new[]
{
new Interceptor(typeof(Samples).GetMethod("A"), typeof(Samples).GetMethod("B")),
new Interceptor(typeof(Foo).GetMethod("A"), typeof(Foo).GetMethod("B")),
new Interceptor(typeof(Foo).GetMethod("G"), typeof(Samples).GetMethod("G")),
};

A(1, 2);

Foo foo = new Foo();
foo.A();

foo.G(3);
interceptor[2].Invoke(() => foo.G(3));

Console.ReadKey(false);
}
}

About

.NET clr /core (x86/x64 instruction set platform) managed function inline interceptor (hooking)

Topics

Resources

Readme

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages