frida / frida-clr

Frida .NET bindings
Other
82 stars 36 forks source link

How can i use custom port for frida-clr #14

Closed Turingyc closed 1 year ago

Turingyc commented 1 year ago

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!

5andr0 commented 1 month ago

@Turingyc can you please post the solution?

Looks like we have to implement

FridaDevice*
frida_device_manager_add_remote_device_sync (FridaDeviceManager* self,
                                             const gchar* address,
                                             FridaRemoteDeviceOptions* options,
                                             GCancellable* cancellable,
                                             GError** error)

then create options with frida_remote_device_options_new / frida_remote_device_options_construct and set them by

frida_remote_device_options_set_certificate
frida_remote_device_options_set_origin
frida_remote_device_options_set_token
frida_remote_device_options_set_keepalive_interval

hopefully a nullpointer is allowed for options

Turingyc commented 1 month ago

@5andr0 add to DeviceManager.cpp

    Device^
        DeviceManager::add_remote_device(int port)
    {
        if (handle == NULL)
            throw gcnew ObjectDisposedException("DeviceManager");
        GError* error = NULL;
        FridaRemoteDeviceOptions* options = frida_remote_device_options_new();
        std::string address = "127.0.0.1:" + std::to_string(port);
        return gcnew Device(frida_device_manager_add_remote_device_sync(handle, address.c_str(), options, nullptr, &error), dispatcher);
    }

add to DeviceManager.hpp Device^ add_remote_device(int port);