View Source ExMobileDevice.Lockdown (exmobiledevice v0.2.19)
Communicates with lockdownd
, an iOS daemon that holds system-wide
information
The connection with the daemon is represented by a process, returned
by calling connect/1
. The created process monitors the caller, exiting
if the caller exits, unless close/1
is called first.
Summary
Functions
Returns a specification to start this module under a supervisor.
Close the lockdownd
connection.
Connect to lockdownd
on the specified device.
Retrieve data from lockdownd
.
Start a service on the device.
Start an authenticated session with lockdownd.
Terminate the current authenticated session.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec close(pid()) :: :ok
Close the lockdownd
connection.
@spec connect(String.t()) :: DynamicSupervisor.on_start_child()
Connect to lockdownd
on the specified device.
On success, a process is returned that represents the connection to
lockdownd
. This process will exit when the caller exits, unless
close/1
is called first.
Example
iex(1)> ExMobileDevice.Lockdown.connect("00008120-0018DEADC0DEFACE")
{:ok, #PID<0.303.0>}
Retrieve data from lockdownd
.
The caller may provide the following options:
:domain
- The domain of the query:key
- A specific key
On success, the caller will return a map of the requested properties.
If no session has yet been started on the connection (see
start_session/1
), only a very limited subset of properties will be
returned.
Example
iex(1)> {:ok, conn} = ExMobileDevice.Lockdown.connect("00008120-0018DEADC0DEFACE")
{:ok, #PID<0.303.0>}
iex(2)> ExMobileDevice.Lockdown.get_info(conn)
{:ok, %{
# ... elided ...
}}
@spec start_service(pid(), String.t(), Keyword.t()) :: {:ok, %{port: integer(), ssl: boolean()}} | {:error, any()}
Start a service on the device.
On success, the function returns a map containing the following keys:
:port
- the port that the service is listening on:ssl
- a flag indicating whether an authenticated connection is required
The caller should then establish another connection to usbmuxd
(via
ExMobileDevice.Muxd.connect/0
) and use this to connect through to the
specified port (via ExMobileDevice.Muxd.connect_thru/3
). If an authenticated
connection is required, ExMobileDevice.Ssl.connect/2
may be used to secure
the connection
This function requires that an authenticated session has already been started on the connection.
Additional service-specific options may be passed in opts
.
Example
iex(1)> {:ok, conn} = ExMobileDevice.Lockdown.connect("00008120-0018DEADC0DEFACE")
{:ok, #PID<0.215.0>}
iex(2)> ExMobileDevice.Lockdown.start_session(conn)
:ok
iex(3)> ExMobileDevice.Lockdown.start_service(conn, "com.apple.mobile.diagnostics_relay")
{:ok, %{port: 50933, ssl: true}}
Start an authenticated session with lockdownd.
On success, the connection process is now authenticated with the device and may perform privileged device operations such as retrieving sensitive information and/or starting further services.
Terminate the current authenticated session.