Files
frida-core/vapi/darwin-gcd.vapi
Ole André Vadla RavnåsandHåvard Sørbø 82a68e55cc fruity: Add RemoteXPC support
With two platform integrations:

- macOS: where we use Apple's tunnel, by talking to remotepairingd and
  creating an assertion to ensure the tunnel is up and stays up for as
  long as we need it. The challenging part here was figuring out the
  device-side RemoteServiceDiscovery (RSD) port inside the tunnel, as
  it appears no API exposes it. Our solution is to ask the kernel for
  a list of TCP sockets, and picking out the ones where the foreign
  address is the device-side IPv6 address inside the tunnel, **and**
  where the process that created the socket is remoted. This seems to
  consistenly result in us finding a single socket, connected to the RSD
  port, but we try all of them in case this behavior ends up changing.
- Linux: where we open our own tunnel, assuming the iDevice has been
  mode-switched (e.g. by usbmuxd), and the Linux CDC NCM driver has been
  patched something along the lines of:
  https://lore.kernel.org/all/[email protected]/T/

We don't yet have a platform integration for Windows, as Apple's
software doesn't currently set up a tunnel. The official driver also
appears to keep the USB device busy, meaning we can't easily trigger
a mode-switch. This is an area that needs more research.

Another area that needs future improvement is that we only support
cabled connectivity on macOS. This should be easy to improve on once we
have updated frida-server and frida-gadget so they listen on tunnel
interfaces whenever they appear.

Kudos to @doronz88 for figuring out most of the protocol bits that we
needed.

Co-authored-by: Håvard Sørbø <[email protected]>
2024-05-30 21:28:33 +02:00

31 lines
1.2 KiB
Vala

[CCode (cheader_filename = "dispatch/dispatch.h", gir_namespace = "Darwin", gir_version = "1.0")]
namespace Darwin.GCD {
[Compact]
[CCode (cname = "void", ref_function = "_frida_dispatch_retain", unref_function = "dispatch_release",
cheader_filename = "frida-darwin.h")]
public class DispatchQueue {
[CCode (cname = "dispatch_queue_create")]
public DispatchQueue (string label, DispatchQueueAttr attr);
[CCode (cname = "dispatch_async_f")]
public void dispatch_async ([CCode (delegate_target_pos = 0.9)] DispatchFunction work);
[CCode (cname = "dispatch_sync_f")]
public void dispatch_sync ([CCode (delegate_target_pos = 0.9)] DispatchFunction work);
}
[CCode (cname = "dispatch_function_t")]
public delegate void DispatchFunction ();
[Compact]
[CCode (cname = "dispatch_queue_attr_t", cprefix = "DISPATCH_QUEUE_")]
public class DispatchQueueAttr {
public static DispatchQueueAttr SERIAL;
public static DispatchQueueAttr SERIAL_INACTIVE;
public static DispatchQueueAttr CONCURRENT;
public static DispatchQueueAttr CONCURRENT_INACTIVE;
public static DispatchQueueAttr SERIAL_WITH_AUTORELEASE_POOL;
public static DispatchQueueAttr CONCURRENT_WITH_AUTORELEASE_POOL;
}
}