All Projects → 71 → Ryder

71 / Ryder

Licence: MIT license
Runtime redirection of method calls for .NET Core.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Ryder

sudohulk
try privilege escalation changing sudo command
Stars: ✭ 114 (+235.29%)
Mutual labels:  hook, intercept
react-use-countdown
React hook for countdown state.
Stars: ✭ 19 (-44.12%)
Mutual labels:  hook
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (+476.47%)
Mutual labels:  hook
Use Image Color
🎨 A hook to grab a color palette from images. Render a skeleton color while your original image still loading.
Stars: ✭ 222 (+552.94%)
Mutual labels:  hook
Elfhook
modify PLT to hook api, supported android 5\6.
Stars: ✭ 202 (+494.12%)
Mutual labels:  hook
Component Size
React hook for determining the size of a component
Stars: ✭ 224 (+558.82%)
Mutual labels:  hook
Simple Git Hooks
A simple git hooks manager for small projects
Stars: ✭ 179 (+426.47%)
Mutual labels:  hook
TemplePlus
ToEE hooks, extensions and fixes
Stars: ✭ 73 (+114.71%)
Mutual labels:  hook
use-route-as-state
Use React Router route and query string as component state
Stars: ✭ 37 (+8.82%)
Mutual labels:  hook
Neteasemusiccrack
iOS网易云音乐 免VIP下载、去广告、去更新 无需越狱...
Stars: ✭ 221 (+550%)
Mutual labels:  hook
Understand Plugin Framework
demos to help understand plugin framwork
Stars: ✭ 2,507 (+7273.53%)
Mutual labels:  hook
Xhook
🔥 A PLT hook library for Android native ELF.
Stars: ✭ 2,996 (+8711.76%)
Mutual labels:  hook
Zxhookdetection
【iOS应用安全、安全攻防】hook及越狱的基本防护与检测(动态库注入检测、hook检测与防护、越狱检测、签名校验、IDA反编译分析加密协议Demo);【数据传输安全】浅谈http、https与数据加密
Stars: ✭ 241 (+608.82%)
Mutual labels:  hook
Qujing
曲境是一个xposed模块,可实现在PC浏览器上动态监控(hook)函数调用和查看堆栈信息,及反射调用(invoke)等功能。
Stars: ✭ 197 (+479.41%)
Mutual labels:  hook
react-media-hook
React Hook for Media Queries
Stars: ✭ 60 (+76.47%)
Mutual labels:  hook
Wmi Static Spoofer
Spoofing the Windows 10 HDD/diskdrive serialnumber from kernel without hooking
Stars: ✭ 199 (+485.29%)
Mutual labels:  hook
Fridacontainer
FridaContainer 整合了网上流行的和自己编写的常用的 frida 脚本,为逆向工作提效之用。 frida 脚本模块化,Java & Jni Trace。
Stars: ✭ 190 (+458.82%)
Mutual labels:  hook
Frida Skeleton
基于frida的安卓hook框架,提供了很多frida自身不支持的功能,将hook安卓变成简单便捷,人人都会的事情
Stars: ✭ 222 (+552.94%)
Mutual labels:  hook
use-spring
Hooke's law hook
Stars: ✭ 53 (+55.88%)
Mutual labels:  hook
use-callbag
👜 Use callbag as React hook.
Stars: ✭ 34 (+0%)
Mutual labels:  hook

Ryder

Ryder is a .NET Core library providing the ability to redirect method calls from one method to another. By extension, it can also redirect property accesses, and event subscriptions / raises.

NuGet Issues License


Get started

Redirect a method

public static int Incremented(int nbr) => nbr + 1;
public static int Decremented(int nbr) => nbr - 1;

Incremented(1); // => 2.

MethodRedirection r = Redirection.Redirect<Func<int, int>>(Incremented, Decremented);

Incremented(1); // => 0.

// You can also invoke the original method:
r.InvokeOriginal(null, 1); // => 2.

// You can also stop the redirection...
r.Stop(); // or r.IsRedirecting = false, or r.Dispose().
Incremented(1); // => 2.

// ... and restart it
r.Start(); // or r.IsRedirecting = true, unless you disposed it, in which case it's no longer usable
Incremented(1); // => 0.

Using Reactive Extensions

MethodInfo method = typeof(DateTime)
    .GetProperty(nameof(DateTime.Now), BindingFlags.Static | BindingFlags.Public)
    .GetGetMethod();

int count = 0;
DateTime bday = new DateTime(1955, 10, 28);

// Make "DateTime.get_Now()" return "bday" every two calls.
using (Redirection.Observe(method)
                  .Where(_ => count++ % 2 == 0)
                  .Subscribe(ctx => ctx.ReturnValue = bday))
{
    DateTime.Now.ShouldBe(bday);
    DateTime.Now.ShouldNotBe(bday);
    DateTime.Now.ShouldBe(bday);
    DateTime.Now.ShouldNotBe(bday);
}

DateTime.Now.ShouldNotBe(bday);
DateTime.Now.ShouldNotBe(bday);

Other features

Any Redirection also defines the following members:
  • bool IsRedirecting { get; set; }
  • void Start()
  • void Stop()
Redirections can be created in multiple ways:
  • MethodRedirection: Redirect(Delegate, Delegate), Redirect(MethodBase, MethodBase).
  • PropertyRedirection: Redirect(PropertyInfo, PropertyInfo).
  • EventRedirection: Redirect(EventInfo, EventInfo).
Tests:

All features are tested in Ryder.Tests. Please check it out, as it contains some real-world-usage code.

Gloriously unsafe:

By default, Ryder performs many safety checks when you create a new Redirection. However, should you decide to do some experimental things, disabling all those checks is as easy as setting the skipChecks parameter available on all Redirect methods to true.

Implicit JIT checks:

When creating a Redirection, Ryder will ensure that the methods you use have already been jitted. If they haven't, they will be compiled automatically.

Support for i386, x86_64, arm and arm64

Ryder is designed to work with i386, x86_64, arm and arm64 using purely runtime checks. This means that it works everywhere without additional configuration. Additionally, Windows, Linux and OSX are all supported.

Installation

You can install Ryder through the NuGet package manager:

Install-Package Ryder

Alternatively, if you don't want to add a dependency, you can copy-paste the Ryder.Lightweight.cs file in your project. Caution, however, since this version only provides the MethodRedirection class (simply called Redirection), and performs no safety checks.

Additional notes

  • Make sure the method you want to redirect does not get inlined by the JIT; if it does get inlined, redirecting it will most likely break stuff in unexpected ways, or do nothing at all. Additionally, if the method you redirect hasn't been jitted yet, the same problems may arise.
  • In order to keep the GC from collecting jitted methods, Ryder keeps static references to them. Those references are only deleted when Redirection.Dispose() is called, after which the Redirection is no longer guaranteed to work.

Inspiration

Ryder is highly inspired by Harmony, but tries to take a very minimal approach to redirection, instead of providing the ability to patch individual instructions. Moreover, it was made with .NET Core in mind.

Projects using Ryder

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].