libimobiledevice-win32 / imobiledevice-net

.NET (C#, VB.NET,...) bindings for libimobiledevice
GNU Lesser General Public License v2.1
305 stars 76 forks source link

start service on ios 13.2 #135

Open yunmengzehaha opened 4 years ago

yunmengzehaha commented 4 years ago

Does anyone know how to start service on ios 13 device. Any help will be greatly appreciated.

qmfrederik commented 4 years ago

Normally you'd do something like this:

var api = LibiMobileDevice.Instance;

// Connect to your device. You'll need a connection to the lockdown daemon running on the device,
// which is your entrypoint to any other service to which you want to connect
int count = 0;
api.iDevice.idevice_get_device_list(out var udids, ref count);
api.iDevice.idevice_new(out var iDeviceHandle, udids[0])
lockdown.lockdownd_client_new_with_handshake(iDeviceHandle, out var lockdownClientHandle, "Label");

// Connect to your service. Use the name of the service you want to connect to.
const string serviceName = "com.apple.webinspector";

// Start the service on the device. You can also use 
// lockdownd_start_service_with_escrow_bag if needed
this.api.Lockdown.lockdownd_start_service(lockdownClientHandle, serviceName, out var service).ThrowOnError();

// You can now use api.Service.service_receive_with_timeout and api.Service.service_send
// to interact with the service on the device

imobiledevice-net is fairly up to date with upstream libimobiledevice. If you have a specific use case which does not work, feel free to share that here.

qmfrederik commented 4 years ago

@yunmengzehaha You are correct that com.apple.instruments.remoteserver requires SSL to be enabled.

com.apple.instruments.remoteserver uses a rather complex protocol, though.

yunmengzehaha commented 4 years ago

@yunmengzehaha You are correct that com.apple.instruments.remoteserver requires SSL to be enabled.

com.apple.instruments.remoteserver uses a rather complex protocol, though.

The problem is that I find what I want to send to the server is not sent. It's before the protocol.