frida / frida-clr Goto Github PK
View Code? Open in Web Editor NEWFrida .NET bindings
License: Other
Frida .NET bindings
License: Other
Hi,
When I connected to frida-server, I found that it connects to 127.0.0.1:27042 by default, but I want to use a custom port, similar to frida.get_device_manager().add_remote_device("host:port") of frida-python,Is there a similar function in frida-clr。please help me。
thanks!
Can the the CLR bindings be compiled and used with .NET Core on Ubuntu? If yes, can you post instructions? Thanks
It would be great to build for the unified runtime of .NET:
https://dotnet.microsoft.com/en-us/download/dotnet
This way we can also use it on Linux
and MacOS
and it would have support for Arm(64)
🙏
Hi i want to use frida with C# to create application that inject code into a game, but i was not able to run this app, it ask for missing assembly and i do have Frida.dll
Hi,
There is no script.exports for .Net like Python and Node.js:
https://github.com/frida/frida-python/blob/37847fd8c9d97b9c5177b35543613abb6fa3b9fb/examples/rpc.py#L17
https://github.com/frida/frida-node/blob/328316a50497bd4b68f03ec6651689b1086786be/examples/rpc.js#L23
@oleavr and others, Can you help me?
I use script.post with 31 threads (31 Android devices) and it runs stably. However, from the 32nd thread onwards, I encounter a System.OutOfMemoryException. The memory gets filled up because the Script is not being released. I've tried various solutions: reducing the number of concurrent threads, adding delay time after each script.post, but none have resolved the issue. It would be great if CLR had an rpc method like Python. I apologize if my English is not good.
Using a really simple test to check that I'm able to hook anything in my target application.
Android 11, Pixel 2, rooted and successfully able to use frida-trace and frida cli to get hooks into the application.
DeviceManager deviceManager;
deviceManager = new DeviceManager(Dispatcher.CurrentDispatcher);
var devices = deviceManager.EnumerateDevices();
var usbDevice = devices.Where(d => d.Type == DeviceType.Usb).SingleOrDefault();
if (usbDevice != null)
{
uint targetProcessPid = usbDevice.Spawn(applicationToSpawnName, null, null, null, null);
Thread.Sleep(TimeSpan.FromSeconds(1));
var session = usbDevice.Attach(targetProcessPid);
usbDevice.Resume(targetProcessPid);
var clientScript = session.CreateScript(File.ReadAllText(@"C:\Temp\js\poc.js"));
clientScript.Message += ClientScriptMessageHandler;
clientScript.Load();
Thread.Sleep(Timeout.Infinite);
}
My .js is just a simple output to make sure the script is loaded and Java.perform
is being called:
Java.perform(function () {
console.log("hello");
});
I've tried a couple of different methods for pausing the thread / waiting while my output is received by the handler, but the process dies every time with the error The process was terminated due to an unhandled exception
.
The eventlog records the .net runtime crash:
Application: test-frida.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
at System.Runtime.InteropServices.GCHandle.InternalCheckDomain(IntPtr)
at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr)
at <Module>.msclr.gcroot<Frida::Script ^>.->(msclr.gcroot<Frida::Script ^>*)
at <Module>.Frida.?A0x6d48abc7.OnScriptMessage(_FridaScript*, SByte*, _GBytes*, Void*)
and
Faulting application name: test-frida.exe, version: 1.0.0.0, time stamp: 0x57158fd2
Faulting module name: KERNELBASE.dll, version: 10.0.22000.918, time stamp: 0xb42fa627
Exception code: 0xe0434352
Fault offset: 0x000000000004474c
Faulting process ID: 0x6a18
Faulting application start time: 0x01d8ddade22a9c8a
Faulting application path: C:\projects\sandbox\frida-test\test-frida.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report ID: aa6a7c05-f113-41f4-ab01-5d558b52fbed
Faulting package full name:
Faulting package-relative application ID:
I'm referencing the 64bit version of the frida clr .dll downloaded at the same time as the frida-server which is running fine on the device.
I've tried both dowloading from the build site and (sucessfully) compiling form source, and this is what I get when i run (after slightly altering due to implicit type conversion error) the HelloFrida example...
I'm using Windows 10 Pro, 64-bit. If you (all) need more information I'd be happy to give you more.
Hi,
I was just wondering why frida-clr
depends on WPF libraries to use (namely System.Windows.Threading
)? With the advancement of .NET/.NET Core over the years, is this still necessary? The use of Forms seems like more than what's required for normal Frida usage and it makes using things like Script.Post
really unintuitive.
Here is the Console app. The script is loaded and working well.
But Console will never get data back when I execute send() in the JS script.
Same script works perfectly in Hello.Frida example.
Can somone post a builded version
hi! on opening of example project, I can see there is a "frida" reference, but was unable to find this file. tried the "frida-clr-15.1.24-windows-x86_64.dll" but not able to reference it. any ideas?
I wanted to create a small C# utility but I'm getting a file not found exception at runtime. I grabbed the latest x64 clr release from Github and added it as a reference in my project.
Environment: Win10 x64, .NET 4.0, frida 12.9.4, build-arch x64
Repro test-case:
using System;
using Frida;
namespace Londor
{
class Program
{
public static void FridaGetDevices()
{
DeviceManager dm = new DeviceManager(System.Windows.Threading.Dispatcher.CurrentDispatcher);
Device[] devices = dm.EnumerateDevices();
foreach(Device d in devices)
{
Console.WriteLine("Device: " + d.Name);
}
}
static void Main(string[] args)
{
FridaGetDevices();
}
}
}
Compile:
1>------ Rebuild All started: Project: Londor, Configuration: Release x64 ------
1> Londor -> C:\Users\b33f\Tools\Dev\Frida-CLR-Test\Londor\Londor\bin\x64\Release\Londor.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Runtime:
C:\Users\b33f>C:\Users\b33f\Tools\Dev\Frida-CLR-Test\Londor\Londor\bin\x64\Release\Londor.exe
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Frida, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
at Londor.Program.FridaGetDevices()
at Londor.Program.Main(String[] args) in C:\Users\b33f\Tools\Dev\Frida-CLR-Test\Londor\Londor\Program.cs:line 26
Am I missing a dependency here?
Hi. I'm trying to get the HelloFrida example working. Whenever I try to debug it, I get the following exception in Visual Studio:
"System.BadImageFormatException {"Could not load file or assembly 'Frida.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)"}".
The project builds successfully into a .exe, but whenever I try to open it I get:
"The exception unknown software exception (0xe0434352) occurred in the application at location 0x7670c52d."
I've also tried using the 64 bit .DLL but get a different exception:
"System.AccessViolationException {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}".
Is there something I'm doing wrong or missing?
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.