Documentation ¶
Index ¶
- Constants
- func ByteCountDecimal(b int64) string
- func FixWindowsPaths(path string) string
- func GetAssistiveTouch(device DeviceEntry) (bool, error)
- func GetProductVersion(device DeviceEntry) (*semver.Version, error)
- func GetSocketTypeAndAddress(socketAddress string) (string, string)
- func GetUsbmuxdSocket() string
- func GetUses24HourClock(device DeviceEntry) (bool, error)
- func GetValuesPlist(device DeviceEntry) (map[string]interface{}, error)
- func GetVoiceOver(device DeviceEntry) (bool, error)
- func GetWifiMac(device DeviceEntry) (string, error)
- func GetZoomTouch(device DeviceEntry) (bool, error)
- func IOS11() *semver.Version
- func IOS12() *semver.Version
- func IOS14() *semver.Version
- func InterfaceToStringSlice(intfSlice interface{}) []string
- func Listen() (func() (AttachedMessage, error), func() error, error)
- func Ntohs(port uint16) uint16
- func Pair(device DeviceEntry) error
- func PairSupervised(device DeviceEntry, p12bytes []byte, p12Password string) error
- func ParsePlist(data []byte) (map[string]interface{}, error)
- func PathExists(path string) (bool, error)
- func SetAssistiveTouch(device DeviceEntry, enabled bool) error
- func SetLanguage(device DeviceEntry, config LanguageConfiguration) error
- func SetSystemTime(device DeviceEntry) error
- func SetTime(device DeviceEntry, timeZone string, time int64) error
- func SetUses24HourClock(device DeviceEntry, enabled bool) error
- func SetVoiceOver(device DeviceEntry, enabled bool) error
- func SetZoomTouch(device DeviceEntry, enabled bool) error
- func Sign(challengeBytes []byte, cert *x509.Certificate, ...) ([]byte, error)
- func ToBinPlistBytes(data interface{}) []byte
- func ToPlist(data interface{}) string
- func ToPlistBytes(data interface{}) []byte
- func ToUnixSocketPath(socketAddress string) string
- type AllValuesType
- type AttachedMessage
- type BasebandKeyHashInformationType
- type BatteryInfo
- type CaCertificate
- type Connection
- type DeviceConnection
- func (conn *DeviceConnection) Close() error
- func (conn *DeviceConnection) Conn() net.Conn
- func (conn *DeviceConnection) DisableSessionSSL()
- func (conn *DeviceConnection) EnableSessionSsl(pairRecord PairRecord) error
- func (conn *DeviceConnection) EnableSessionSslHandshakeOnly(pairRecord PairRecord) error
- func (conn *DeviceConnection) EnableSessionSslServerMode(pairRecord PairRecord) error
- func (conn *DeviceConnection) EnableSessionSslServerModeHandshakeOnly(pairRecord PairRecord) error
- func (conn *DeviceConnection) Reader() io.Reader
- func (conn *DeviceConnection) Send(bytes []byte) error
- func (conn *DeviceConnection) Writer() io.Writer
- type DeviceConnectionInterface
- type DeviceEntry
- type DeviceList
- type DeviceProperties
- type FullPairRecordData
- type GetAllValuesResponse
- type LanguageConfiguration
- type ListenType
- type LockDownConnection
- func (lockDownConn *LockDownConnection) Close()
- func (lockDownConn *LockDownConnection) Conn() net.Conn
- func (lockDownConn LockDownConnection) DisableSessionSSL()
- func (lockDownConn LockDownConnection) EnableSessionSsl(pairRecord PairRecord) error
- func (lockDownConn LockDownConnection) EnableSessionSslServerMode(pairRecord PairRecord) error
- func (lockDownConn *LockDownConnection) GetProductVersion() (string, error)
- func (lockDownConn *LockDownConnection) GetValue(key string) (interface{}, error)
- func (lockDownConn *LockDownConnection) GetValueForDomain(key string, domain string) (interface{}, error)
- func (lockDownConn *LockDownConnection) GetValues() (GetAllValuesResponse, error)
- func (lockDownConn *LockDownConnection) ReadMessage() ([]byte, error)
- func (lockDownConn LockDownConnection) Send(msg interface{}) error
- func (lockDownConn *LockDownConnection) SetValueForDomain(key string, domain string, value interface{}) error
- func (lockDownConn *LockDownConnection) StartService(serviceName string) (StartServiceResponse, error)
- func (lockDownConn *LockDownConnection) StartSession(pairRecord PairRecord) (StartSessionResponse, error)
- func (lockDownConn *LockDownConnection) StopSession()
- type LockDownPairRequest
- type LockdownPairResponse
- type MuxResponse
- type NonVolatileRAMType
- type PairRecord
- type PairRecordData
- type PairingOptions
- type PlistCodec
- type ReadDevicesType
- type ReadPair
- type SavePair
- type StartServiceResponse
- type StartSessionResponse
- type UsbMuxConnection
- func (muxConn *UsbMuxConnection) Close() error
- func (muxConn *UsbMuxConnection) Connect(deviceID int, port uint16) error
- func (muxConn *UsbMuxConnection) ConnectLockdown(deviceID int) (*LockDownConnection, error)
- func (muxConn *UsbMuxConnection) ListDevices() (DeviceList, error)
- func (muxConn *UsbMuxConnection) Listen() (func() (AttachedMessage, error), error)
- func (muxConn *UsbMuxConnection) ReadBuid() (string, error)
- func (muxConn *UsbMuxConnection) ReadMessage() (UsbMuxMessage, error)
- func (muxConn *UsbMuxConnection) ReadPair(udid string) (PairRecord, error)
- func (muxConn *UsbMuxConnection) ReleaseDeviceConnection() DeviceConnectionInterface
- func (muxConn *UsbMuxConnection) Send(msg interface{}) error
- func (muxConn *UsbMuxConnection) SendMuxMessage(msg UsbMuxMessage) error
- type UsbMuxHeader
- type UsbMuxMessage
- type ValueResponse
Constants ¶
const Lockdownport uint16 = 32498
Lockdownport is the port of the always running lockdownd on the iOS device.
Variables ¶
This section is empty.
Functions ¶
func ByteCountDecimal ¶ added in v1.0.84
func FixWindowsPaths ¶ added in v1.0.40
FixWindowsPaths replaces backslashes with forward slashes and removes the X: style windows drive letters
func GetAssistiveTouch ¶ added in v1.0.78
func GetAssistiveTouch(device DeviceEntry) (bool, error)
func GetProductVersion ¶ added in v1.0.30
func GetProductVersion(device DeviceEntry) (*semver.Version, error)
GetProductVersion gets the iOS version of a device
func GetSocketTypeAndAddress ¶ added in v1.0.106
func GetUsbmuxdSocket ¶ added in v1.0.106
func GetUsbmuxdSocket() string
GetUsbmuxdSocket this is the default socket address for the platform to connect to.
func GetUses24HourClock ¶ added in v1.0.116
func GetUses24HourClock(device DeviceEntry) (bool, error)
func GetValuesPlist ¶ added in v1.0.4
func GetValuesPlist(device DeviceEntry) (map[string]interface{}, error)
GetValuesPlist returns the full lockdown values response as a map, so it can be converted to JSON easily.
func GetVoiceOver ¶ added in v1.0.113
func GetVoiceOver(device DeviceEntry) (bool, error)
func GetWifiMac ¶ added in v1.0.48
func GetWifiMac(device DeviceEntry) (string, error)
GetWifiMac gets the static MAC address of the device WiFi. note: this does not report the dynamic MAC if you enable the "automatic WiFi address" feature.
func GetZoomTouch ¶ added in v1.0.113
func GetZoomTouch(device DeviceEntry) (bool, error)
func InterfaceToStringSlice ¶ added in v1.0.107
func InterfaceToStringSlice(intfSlice interface{}) []string
InterfaceToStringSlice casts an interface{} to []interface{} and then converts each entry to a string. It returns an empty slice in case of an error.
func Ntohs ¶
Ntohs is a re-implementation of the C function Ntohs. it means networkorder to host oder and basically swaps the endianness of the given int. It returns port converted to little endian.
func Pair ¶ added in v1.0.9
func Pair(device DeviceEntry) error
Pair tries to pair with a device. The first time usually fails because the user has to accept a trust pop up on the iOS device. What you have to do to pair is: 1. run the Pair() function 2. accept the trust pop up on the device 3. run the Pair() function a second time
func PairSupervised ¶ added in v1.0.25
func PairSupervised(device DeviceEntry, p12bytes []byte, p12Password string) error
PairSupervised uses an organization id from apple configurator so you can pair a supervised device without the need for user interaction (the trust popup) Arguments are the device, the p12 files raw contents and the password used for the p12 file. I basically got this from cfgutil: https://configautomation.com/cfgutil-man-page.html here is how to turn a p12 into crt and key: openssl pkcs12 -in organization.p12 -out organization.pem -nodes -password pass:a openssl x509 -outform DER -out organization.crt -in organization.pem openssl rsa -outform DER -out organization.key -in organization.pem then you can run: cfgutil -K organization.key -C organization.crt pair
func ParsePlist ¶
ParsePlist tries to parse the given bytes, which should be a Plist, into a map[string]interface. It returns the map or an error if the decoding step fails.
func PathExists ¶ added in v1.0.24
PathExists is used to determine whether the path folder exists True if it exists, false otherwise
func SetAssistiveTouch ¶ added in v1.0.78
func SetAssistiveTouch(device DeviceEntry, enabled bool) error
EnableAssistiveTouch creates a new lockdown session for the device and enables or disables AssistiveTouch (the on-screen software home button), by using the special key AssistiveTouchEnabledByiTunes. Setting to true will enable AssistiveTouch Setting to false will disable AssistiveTouch, regardless of whether it was previously-enabled through a non-iTunes-related method.
func SetLanguage ¶
func SetLanguage(device DeviceEntry, config LanguageConfiguration) error
SetLanguage creates a new lockdown session for the device and sets a new language and locale. Changes will only be made when the value is not an empty string. To change only the locale, set language to "" and vice versa. If both are empty, nothing is changed. NOTE: Changing a language is an async operation that takes a long time. Springboard will be restarted automatically by the device. If you need to wait for this happen use notificationproxy.WaitUntilSpringboardStarted().
func SetSystemTime ¶ added in v1.0.107
func SetSystemTime(device DeviceEntry) error
func SetTime ¶ added in v1.0.107
func SetTime(device DeviceEntry, timeZone string, time int64) error
func SetUses24HourClock ¶ added in v1.0.116
func SetUses24HourClock(device DeviceEntry, enabled bool) error
Enable24HourClock creates a new lockdown session for the device and enables or disables 24HourClock, by using the special key Uses24HourClock. Setting to true will enable 24Hour Clock Setting to false will disable 24Hour Clock, regardless of whether it was previously-enabled through a non-iTunes-related method.
func SetVoiceOver ¶ added in v1.0.113
func SetVoiceOver(device DeviceEntry, enabled bool) error
EnableVoiceOver creates a new lockdown session for the device and enables or disables VoiceOver (the on-screen software home button), by using the special key VoiceOverTouchEnabledByiTunes. Setting to true will enable VoiceOver Setting to false will disable VoiceOver, regardless of whether it was previously-enabled through a non-iTunes-related method.
func SetZoomTouch ¶ added in v1.0.113
func SetZoomTouch(device DeviceEntry, enabled bool) error
EnableZoomTouch creates a new lockdown session for the device and enables or disables ZoomTouch (the on-screen software home button), by using the special key ZoomTouchEnabledByiTunes. Setting to true will enable ZoomTouch Setting to false will disable ZoomTouch, regardless of whether it was previously-enabled through a non-iTunes-related method.
func Sign ¶ added in v1.0.57
func Sign(challengeBytes []byte, cert *x509.Certificate, supervisedPrivateKey interface{}) ([]byte, error)
func ToBinPlistBytes ¶ added in v1.0.107
func ToBinPlistBytes(data interface{}) []byte
func ToPlist ¶
func ToPlist(data interface{}) string
ToPlist converts a given struct to a Plist using the github.com/DHowett/go-plist library. Make sure your struct is exported. It returns a string containing the plist.
func ToPlistBytes ¶
func ToPlistBytes(data interface{}) []byte
ToPlistBytes converts a given struct to a Plist using the github.com/DHowett/go-plist library. Make sure your struct is exported. It returns a byte slice containing the plist.
func ToUnixSocketPath ¶ added in v1.0.106
Types ¶
type AllValuesType ¶
type AllValuesType struct { ActivationState string ActivationStateAcknowledged bool BasebandActivationTicketVersion string BasebandCertID int `plist:"BasebandCertId"` BasebandChipID int BasebandKeyHashInformation BasebandKeyHashInformationType BasebandMasterKeyHash string BasebandRegionSKU []byte BasebandSerialNumber []byte BasebandStatus string BasebandVersion string BluetoothAddress string BoardID int `plist:"BoardId"` BrickState bool BuildVersion string CPUArchitecture string CarrierBundleInfoArray []interface{} CertID int ChipID int ChipSerialNo []byte DeviceClass string DeviceColor string DeviceName string DieID int EthernetAddress string FirmwareVersion string FusingStatus int HardwareModel string HardwarePlatform string HasSiDP bool HostAttached bool InternationalMobileEquipmentIdentity string MLBSerialNumber string MobileEquipmentIdentifier string MobileSubscriberCountryCode string MobileSubscriberNetworkCode string ModelNumber string NonVolatileRAM NonVolatileRAMType PartitionType string PasswordProtected bool PkHash []byte ProductName string ProductType string ProductVersion string ProductionSOC bool ProtocolVersion string ProximitySensorCalibration []byte RegionInfo string SBLockdownEverRegisteredKey bool SIMStatus string SIMTrayStatus string SerialNumber string SoftwareBehavior []byte SoftwareBundleVersion string SupportedDeviceFamilies []int TelephonyCapability bool TimeIntervalSince1970 float64 TimeZone string TimeZoneOffsetFromUTC float64 TrustedHostAttached bool UniqueChipID uint64 UniqueDeviceID string UseRaptorCerts bool Uses24HourClock bool WiFiAddress string WirelessBoardSerialNumber string KCTPostponementInfoPRIVersion string `plist:"kCTPostponementInfoPRIVersion"` KCTPostponementInfoPRLName int `plist:"kCTPostponementInfoPRLName"` KCTPostponementInfoServiceProvisioningState bool `plist:"kCTPostponementInfoServiceProvisioningState"` KCTPostponementStatus string `plist:"kCTPostponementStatus"` }
AllValuesType contains all possible values that can be requested from LockDown
type AttachedMessage ¶
type AttachedMessage struct { MessageType string DeviceID int Properties DeviceProperties }
AttachedMessage contains some info about when iOS devices are connected or disconnected from the host
func (AttachedMessage) DeviceAttached ¶
func (msg AttachedMessage) DeviceAttached() bool
DeviceAttached checks if the attached message is about a newly added device
func (AttachedMessage) DeviceDetached ¶
func (msg AttachedMessage) DeviceDetached() bool
DeviceDetached checks if the attachedMessage is about a disconnected device
func (AttachedMessage) DeviceEntry ¶ added in v1.0.35
func (a AttachedMessage) DeviceEntry() DeviceEntry
type BasebandKeyHashInformationType ¶
BasebandKeyHashInformationType containing some baseband related data directly from the ios device
type BatteryInfo ¶ added in v1.0.108
type BatteryInfo struct { BatteryCurrentCapacity uint64 BatteryIsCharging bool ExternalChargeCapable bool ExternalConnected bool FullyCharged bool GasGaugeCapability bool HasBattery bool }
func GetBatteryDiagnostics ¶ added in v1.0.108
func GetBatteryDiagnostics(device DeviceEntry) (BatteryInfo, error)
type CaCertificate ¶ added in v1.0.107
type CaCertificate struct { CertDER []byte PrivateKeyDER []byte Csr string CertPEM []byte PrivateKeyPEM []byte }
CaCertificate is a simple struct to hold a x509 cert and privateKey in DER and PEM formats as well as the CER should you need it.
func CreateDERFormattedSupervisionCert ¶ added in v1.0.107
func CreateDERFormattedSupervisionCert() (*CaCertificate, error)
CreateDERFormattedSupervisionCert is a convenience function to generate DER and PEM formatted private key and cert to be used for device supervision. It basically does the same as these openSSL commands:
openssl genrsa -des3 -out domain.key 2048 openssl req -key domain.key -new -out domain.csr openssl x509 -signkey domain.key -in domain.csr -req -days 365 -out domain.crt openssl x509 -in domain.crt -outform der -out domain.der and returns the resulting certs in a CaCertificate struct.
If you need p12 files, please save the PEMs to files and run this: openssl pkcs12 -export -inkey supervision-private-key.pem -in supervision-cert.pem -out certificate.p12 -password pass:a
type Connection ¶ added in v1.0.108
type Connection struct {
// contains filtered or unexported fields
}
type DeviceConnection ¶
type DeviceConnection struct {
// contains filtered or unexported fields
}
DeviceConnection wraps the net.Conn to the ios Device and has support for switching Codecs and enabling SSL
func NewDeviceConnection ¶
func NewDeviceConnection(socketToConnectTo string) (*DeviceConnection, error)
NewDeviceConnection creates a new DeviceConnection pointing to the given socket waiting for a call to Connect()
func NewDeviceConnectionWithConn ¶
func NewDeviceConnectionWithConn(conn net.Conn) *DeviceConnection
NewDeviceConnectionWithConn create a DeviceConnection with a already connected network conn.
func (*DeviceConnection) Close ¶
func (conn *DeviceConnection) Close() error
Close closes the network connection
func (*DeviceConnection) Conn ¶ added in v1.0.24
func (conn *DeviceConnection) Conn() net.Conn
func (*DeviceConnection) DisableSessionSSL ¶
func (conn *DeviceConnection) DisableSessionSSL()
DisableSessionSSL is a hack to go back from SSL to an unencrypted conn without closing the connection. It is only used for the debug proxy because certain MAC applications actually disable SSL, use the connection to send unencrypted messages just to then enable SSL again without closing the connection
func (*DeviceConnection) EnableSessionSsl ¶
func (conn *DeviceConnection) EnableSessionSsl(pairRecord PairRecord) error
EnableSessionSsl wraps the underlying net.Conn in a client tls.Conn using the pairRecord.
func (*DeviceConnection) EnableSessionSslHandshakeOnly ¶
func (conn *DeviceConnection) EnableSessionSslHandshakeOnly(pairRecord PairRecord) error
EnableSessionSslHandshakeOnly enables SSL only for the Handshake and then falls back to plaintext DTX based services do that currently
func (*DeviceConnection) EnableSessionSslServerMode ¶
func (conn *DeviceConnection) EnableSessionSslServerMode(pairRecord PairRecord) error
EnableSessionSslServerMode wraps the underlying net.Conn in a server tls.Conn using the pairRecord.
func (*DeviceConnection) EnableSessionSslServerModeHandshakeOnly ¶
func (conn *DeviceConnection) EnableSessionSslServerModeHandshakeOnly(pairRecord PairRecord) error
EnableSessionSslServerModeHandshakeOnly enables SSL only for the Handshake and then falls back to plaintext DTX based services do that currently. Server mode is needed only in the debugproxy.
func (*DeviceConnection) Reader ¶
func (conn *DeviceConnection) Reader() io.Reader
Reader exposes the underlying net.Conn as io.Reader
func (*DeviceConnection) Send ¶
func (conn *DeviceConnection) Send(bytes []byte) error
Send sends a message
func (*DeviceConnection) Writer ¶
func (conn *DeviceConnection) Writer() io.Writer
Writer exposes the underlying net.Conn as io.Writer
type DeviceConnectionInterface ¶
type DeviceConnectionInterface interface { Close() error Send(message []byte) error Reader() io.Reader Writer() io.Writer EnableSessionSsl(pairRecord PairRecord) error EnableSessionSslServerMode(pairRecord PairRecord) error EnableSessionSslHandshakeOnly(pairRecord PairRecord) error EnableSessionSslServerModeHandshakeOnly(pairRecord PairRecord) error DisableSessionSSL() Conn() net.Conn }
DeviceConnectionInterface contains a physical network connection to a usbmuxd socket.
func ConnectToService ¶
func ConnectToService(device DeviceEntry, serviceName string) (DeviceConnectionInterface, error)
ConnectToService connects to a service on the phone and returns the ready to use DeviceConnectionInterface
type DeviceEntry ¶
type DeviceEntry struct { DeviceID int MessageType string Properties DeviceProperties }
DeviceEntry contains the DeviceID with is sometimes needed f.ex. to enable LockdownSSL. More importantly it contains DeviceProperties where the udid is stored.
func GetDevice ¶
func GetDevice(udid string) (DeviceEntry, error)
GetDevice returns: the device for the udid if a valid udid is provided. if the env variable 'udid' is specified, the device with that udid otherwise it returns the first device in the list.
type DeviceList ¶
type DeviceList struct {
DeviceList []DeviceEntry
}
DeviceList is a simple wrapper for a array of DeviceEntry
func DeviceListfromBytes ¶
func DeviceListfromBytes(plistBytes []byte) DeviceList
DeviceListfromBytes parses a DeviceList from a byte array
func ListDevices ¶
func ListDevices() (DeviceList, error)
ListDevices returns a DeviceList containing data about all currently connected iOS devices using a new UsbMuxConnection
func (DeviceList) CreateMapForJSONConverter ¶
func (deviceList DeviceList) CreateMapForJSONConverter() map[string]interface{}
CreateMapForJSONConverter creates a simple json ready map containing all UDIDs
func (DeviceList) String ¶
func (deviceList DeviceList) String() string
String returns a list of all udids in a formatted string
type DeviceProperties ¶
type DeviceProperties struct { ConnectionSpeed int ConnectionType string DeviceID int LocationID int ProductID int SerialNumber string }
DeviceProperties contains important device related info like the udid which is named SerialNumber here
type FullPairRecordData ¶ added in v1.0.9
type GetAllValuesResponse ¶
type GetAllValuesResponse struct { Request string Value AllValuesType }
GetAllValuesResponse just the wrapper for AllValuesType
func GetValues ¶
func GetValues(device DeviceEntry) (GetAllValuesResponse, error)
GetValues returns all values of deviceInformation from lockdown
type LanguageConfiguration ¶
type LanguageConfiguration struct { Language string Locale string SupportedLocales []string SupportedLanguages []string }
LanguageConfiguration is a simple struct encapsulating a language and locale string
func GetLanguage ¶
func GetLanguage(device DeviceEntry) (LanguageConfiguration, error)
GetLanguage creates a new lockdown session for the device and retrieves the current language and locale as well as a list of all supported locales and languages. It returns a LanguageConfiguration or an error.
type ListenType ¶
type ListenType struct { MessageType string ProgName string ClientVersionString string ConnType int // contains filtered or unexported fields }
ListenType contains infos for creating a LISTEN message for USBMUX
type LockDownConnection ¶
type LockDownConnection struct {
// contains filtered or unexported fields
}
LockDownConnection allows you to interact with the Lockdown service on the phone. You can use this to grab basic info from the device and start other services on the phone.
func ConnectLockdownWithSession ¶
func ConnectLockdownWithSession(device DeviceEntry) (*LockDownConnection, error)
func NewLockDownConnection ¶
func NewLockDownConnection(dev DeviceConnectionInterface) *LockDownConnection
NewLockDownConnection creates a new LockDownConnection with empty sessionId and a PlistCodec.
func (*LockDownConnection) Close ¶
func (lockDownConn *LockDownConnection) Close()
Close closes the underlying DeviceConnection
func (*LockDownConnection) Conn ¶ added in v1.0.24
func (lockDownConn *LockDownConnection) Conn() net.Conn
func (LockDownConnection) DisableSessionSSL ¶
func (lockDownConn LockDownConnection) DisableSessionSSL()
DisableSessionSSL see documentation in DeviceConnection
func (LockDownConnection) EnableSessionSsl ¶
func (lockDownConn LockDownConnection) EnableSessionSsl(pairRecord PairRecord) error
EnableSessionSsl see documentation in DeviceConnection
func (LockDownConnection) EnableSessionSslServerMode ¶
func (lockDownConn LockDownConnection) EnableSessionSslServerMode(pairRecord PairRecord) error
EnableSessionSslServerMode see documentation in DeviceConnection
func (*LockDownConnection) GetProductVersion ¶
func (lockDownConn *LockDownConnection) GetProductVersion() (string, error)
GetProductVersion returns the ProductVersion of the device f.ex. "10.3"
func (*LockDownConnection) GetValue ¶
func (lockDownConn *LockDownConnection) GetValue(key string) (interface{}, error)
GetValue gets and returns the string value for the lockdown key
func (*LockDownConnection) GetValueForDomain ¶
func (lockDownConn *LockDownConnection) GetValueForDomain(key string, domain string) (interface{}, error)
GetValueForDomain gets and returns the string value for the lockdown key and domain
func (*LockDownConnection) GetValues ¶
func (lockDownConn *LockDownConnection) GetValues() (GetAllValuesResponse, error)
GetValues retrieves a GetAllValuesResponse containing all values lockdown returns
func (*LockDownConnection) ReadMessage ¶
func (lockDownConn *LockDownConnection) ReadMessage() ([]byte, error)
ReadMessage grabs the next LockDown Message using the PlistDecoder from the underlying DeviceConnection and returns the Plist as a byte slice.
func (LockDownConnection) Send ¶
func (lockDownConn LockDownConnection) Send(msg interface{}) error
Send takes a go struct, converts it to a PLIST and sends it with a 4 byte length field.
func (*LockDownConnection) SetValueForDomain ¶
func (lockDownConn *LockDownConnection) SetValueForDomain(key string, domain string, value interface{}) error
SetValueForDomain sets the string value for the lockdown key and domain. If the device returns an error it will be returned as a go error.
func (*LockDownConnection) StartService ¶
func (lockDownConn *LockDownConnection) StartService(serviceName string) (StartServiceResponse, error)
StartService sends a StartServiceRequest using the provided serviceName and returns the Port of the services in a BigEndian Integer. This port cann be used with a new UsbMuxClient and the Connect call.
func (*LockDownConnection) StartSession ¶
func (lockDownConn *LockDownConnection) StartSession(pairRecord PairRecord) (StartSessionResponse, error)
StartSession will send a StartSession Request to Lockdown, wait for the response and enable SSL on the underlying connection if necessary. The devices usually always requests to enable SSL. It returns a StartSessionResponse
func (*LockDownConnection) StopSession ¶
func (lockDownConn *LockDownConnection) StopSession()
StopSession sends a Lockdown StopSessionRequest to the device
type LockDownPairRequest ¶ added in v1.0.9
type LockDownPairRequest struct { Label string PairRecord FullPairRecordData Request string ProtocolVersion string PairingOptions PairingOptions }
type LockdownPairResponse ¶ added in v1.0.9
type MuxResponse ¶
MuxResponse is a generic response message sent by usbmuxd it contains a Number response code
func MuxResponsefromBytes ¶
func MuxResponsefromBytes(plistBytes []byte) MuxResponse
MuxResponsefromBytes parses a MuxResponse struct from bytes
func (MuxResponse) IsSuccessFull ¶
func (u MuxResponse) IsSuccessFull() bool
IsSuccessFull returns UsbMuxResponse.Number==0
type NonVolatileRAMType ¶
type NonVolatileRAMType struct { AutoBoot []byte `plist:"auto-boot"` BacklightLevel []byte `plist:"backlight-level"` BootArgs string `plist:"boot-args"` Bootdelay []byte `plist:"bootdelay"` ComAppleSystemTz0Size []byte `plist:"com.apple.System.tz0-size"` OblitBegins []byte `plist:"oblit-begins"` Obliteration []byte `plist:"obliteration"` }
NonVolatileRAMType contains some internal device info and can be retrieved by getting all values
type PairRecord ¶
type PairRecord struct { HostID string SystemBUID string HostCertificate []byte HostPrivateKey []byte DeviceCertificate []byte EscrowBag []byte WiFiMACAddress string RootCertificate []byte RootPrivateKey []byte }
PairRecord contains the HostID string, the SystemBUID string, the HostCertificate []byte and the HostPrivateKey []byte. It is needed for enabling SSL Connections over Lockdown
func PairRecordfromBytes ¶
func PairRecordfromBytes(plistBytes []byte) PairRecord
PairRecordfromBytes parsed a plist into a PairRecord
func ReadPairRecord ¶
func ReadPairRecord(udid string) (PairRecord, error)
ReadPairRecord creates a new USBMuxConnection just to read the pair record and closes it right after than.
type PairRecordData ¶
type PairRecordData struct {
PairRecordData []byte
}
PairRecordData only holds a []byte containing the PairRecord data as a serialized Plist.
type PairingOptions ¶ added in v1.0.9
type PairingOptions struct {
ExtendedPairingErrors bool
}
type PlistCodec ¶
type PlistCodec struct{}
PlistCodec is a codec for PLIST based services with [4 byte big endian length][plist-payload] based messages
func NewPlistCodec ¶
func NewPlistCodec() PlistCodec
NewPlistCodec create a codec for PLIST based services with [4 byte big endian length][plist-payload] based messages
func (PlistCodec) Decode ¶
func (plistCodec PlistCodec) Decode(r io.Reader) ([]byte, error)
Decode reads a Lockdown Message from the provided reader and sends it to the ResponseChannel
func (PlistCodec) Encode ¶
func (plistCodec PlistCodec) Encode(message interface{}) ([]byte, error)
Encode encodes a LockDown Struct to a byte[] with the lockdown plist format. It returns a byte array that contains a 4 byte length unsigned big endian integer followed by the plist as a string
type ReadDevicesType ¶
ReadDevicesType contains all the data necessary to request a DeviceList from usbmuxd. Can be created with newReadDevices
func NewReadDevices ¶
func NewReadDevices() ReadDevicesType
NewReadDevices creates a struct containing a request for a device list that can be sent to UsbMuxD.
type ReadPair ¶
type ReadPair struct { BundleID string ClientVersionString string MessageType string ProgName string LibUSBMuxVersion uint32 `plist:"kLibUSBMuxVersion"` PairRecordID string }
ReadPair contains all the Infos necessary to request a PairRecord from usbmuxd. use newReadPair(udid string) to create one.
type StartServiceResponse ¶
type StartServiceResponse struct { Port uint16 Request string Service string EnableServiceSSL bool Error string }
StartServiceResponse is sent by the phone after starting a service, it contains servicename, port and tells us whether we should enable SSL or not.
func StartService ¶
func StartService(device DeviceEntry, serviceName string) (StartServiceResponse, error)
StartService conveniently starts a service on a device and cleans up the used UsbMuxconnection. It returns the service port as a uint16 in BigEndian byte order.
type StartSessionResponse ¶
StartSessionResponse contains the information sent by the device as a response to a StartSessionRequest.
type UsbMuxConnection ¶
type UsbMuxConnection struct {
// contains filtered or unexported fields
}
UsbMuxConnection can send and read messages to the usbmuxd process to manage pairrecors, listen for device changes and connect to services on the phone. Usually messages follow a request-response pattern. there is a tag integer in the message header, that is increased with every sent message.
func NewUsbMuxConnection ¶
func NewUsbMuxConnection(deviceConn DeviceConnectionInterface) *UsbMuxConnection
NewUsbMuxConnection creates a new UsbMuxConnection from an already initialized DeviceConnectionInterface
func NewUsbMuxConnectionSimple ¶ added in v1.0.8
func NewUsbMuxConnectionSimple() (*UsbMuxConnection, error)
NewUsbMuxConnectionSimple creates a new UsbMuxConnection with a connection to /var/run/usbmuxd
func (*UsbMuxConnection) Close ¶ added in v1.0.9
func (muxConn *UsbMuxConnection) Close() error
Close calls close on the underlying DeviceConnection
func (*UsbMuxConnection) Connect ¶
func (muxConn *UsbMuxConnection) Connect(deviceID int, port uint16) error
Connect issues a Connect Message to UsbMuxd for the given deviceID on the given port enabling the newCodec for it. It returns an error containing the UsbMux error code should the connect fail.
func (*UsbMuxConnection) ConnectLockdown ¶
func (muxConn *UsbMuxConnection) ConnectLockdown(deviceID int) (*LockDownConnection, error)
ConnectLockdown connects this Usbmux connection to the LockDown service that always runs on the device on the same port. The connect call needs the deviceID which can be retrieved from a DeviceList using the ListDevices function. After this function is done, the UsbMuxConnection cannot be used anymore because the same underlying network connection is used for talking to Lockdown. Sending usbmux commands would break it. It returns a new LockDownConnection.
func (*UsbMuxConnection) ListDevices ¶
func (muxConn *UsbMuxConnection) ListDevices() (DeviceList, error)
ListDevices returns a DeviceList containing data about all currently connected iOS devices
func (*UsbMuxConnection) Listen ¶
func (muxConn *UsbMuxConnection) Listen() (func() (AttachedMessage, error), error)
Listen will send a listen command to usbmuxd which will cause this connection to stay open indefinitely and receive messages whenever devices are connected or disconnected
func (*UsbMuxConnection) ReadBuid ¶ added in v1.0.9
func (muxConn *UsbMuxConnection) ReadBuid() (string, error)
ReadBuid requests the BUID of the host It returns the deserialized BUID as a string.
func (*UsbMuxConnection) ReadMessage ¶
func (muxConn *UsbMuxConnection) ReadMessage() (UsbMuxMessage, error)
ReadMessage blocks until the next muxMessage is available on the underlying DeviceConnection and returns it.
func (*UsbMuxConnection) ReadPair ¶
func (muxConn *UsbMuxConnection) ReadPair(udid string) (PairRecord, error)
ReadPair reads the PairRecord from the usbmux socket for the given udid. It returns the deserialized PairRecord.
func (*UsbMuxConnection) ReleaseDeviceConnection ¶
func (muxConn *UsbMuxConnection) ReleaseDeviceConnection() DeviceConnectionInterface
ReleaseDeviceConnection dereferences this UsbMuxConnection from the underlying DeviceConnection and it returns the DeviceConnection for later use. This UsbMuxConnection cannot be used after calling this.
func (*UsbMuxConnection) Send ¶
func (muxConn *UsbMuxConnection) Send(msg interface{}) error
Send sends and encodes a Plist using the usbmux Encoder. Increases the connection tag by one.
func (*UsbMuxConnection) SendMuxMessage ¶
func (muxConn *UsbMuxConnection) SendMuxMessage(msg UsbMuxMessage) error
SendMuxMessage serializes and sends a UsbMuxMessage to the underlying DeviceConnection. This does not increase the tag on the connection. Is used mainly by the debug proxy to forward messages between device and host
type UsbMuxHeader ¶
UsbMuxHeader contains the header for plist messages for the usbmux daemon.
type UsbMuxMessage ¶
type UsbMuxMessage struct { Header UsbMuxHeader Payload []byte }
UsbMuxMessage contains header and payload for a message to usbmux
Source Files ¶
- batterydiagnostics.go
- buid.go
- connect.go
- crypto_utils.go
- deviceconnection.go
- listdevices.go
- listen.go
- lockdown.go
- lockdown_assistivetouch.go
- lockdown_language_locale.go
- lockdown_time_format.go
- lockdown_time_zone.go
- lockdown_value.go
- lockdown_voiceover.go
- lockdown_zoomtouch.go
- pair.go
- pair_read.go
- pair_save.go
- plistcodec.go
- startservice.go
- startsession.go
- stopsession.go
- usbmuxconnection.go
- usbmuxresponse.go
- utils.go