.mobileconfig是苹果系统配置描述文件,目前常用于苹果超级签获取设备UDID。

官方介绍:

配置描述⽂件是XML ⽂件,包含以下内容:设备安全策略、VPN 配置信息、Wi-Fi 设置、APN 设置、Exchange帐户设置、邮件设置以及允许 iPhone 和 iPod touch 与企业系统配合使⽤的证书。

“iPhone配置实⽤⼯具”可让您轻松地创建、维护和安装配置描述⽂件及对配置描述⽂件进⾏加密,跟踪和安装预置描述⽂件与授权的应⽤程序,以及采集包括控制台⽇志在内的设备信息。(这个⼯具可以从官⽹上进⾏下载)

⽬前所知的,安装这个配置⽂件除了上述的使⽤“iphone配置实⽤⼯具”之外,还可以通过邮件附件或通过使⽤safari浏览包含有下载的⽹页的⽅式激活安装(install profile窗⼝)。

1、代码示例

PayloadContentPayloadDisplayNameLDAP SettingsPayloadTypecom.apple.ldap.accountPayloadVersion1PayloadUUID6df7a612-ce0a-4b4b-bce2-7b844e3c9df0PayloadIdentifiercom.example.iPhone.settings.ldapLDAPAccountDescriptionCompany ContactsLDAPAccountHostNameldap.example.comLDAPAccountUseSSLLDAPAccountUserNameuid=username,dc=example,dc=comLDAPSearchSettingsLDAPSearchSettingDescriptionCompany ContactsLDAPSearchSettingSearchBaseLDAPSearchSettingScopeLDAPSearchSettingScopeSubtreeLDAPSearchSettingDescriptionSales DepartmentsLDAPSearchSettingSearchBaseou=Sales,dc=example,dc=comLDAPSearchSettingScopeLDAPSearchSettingScopeSubtreePayloadDisplayNameEmail SettingsPayloadTypecom.apple.mail.managedPayloadVersion1PayloadUUID362e5c11-a332-4dfb-b18b-f6f0aac032fdPayloadIdentifiercom.example.iPhone.settings.emailEmailAccountDescriptionCompany E-mailEmailAccountNameFull NameEmailAccountTypeEmailTypeIMAPEmailAddressusername@example.comIncomingMailServerAuthenticationEmailAuthPasswordIncomingMailServerHostNameimap.example.comIncomingMailServerUseSSLIncomingMailServerUsernameusername@es2eng.comOutgoingPasswordSameAsIncomingPasswordOutgoingMailServerAuthenticationEmailAuthPasswordOutgoingMailServerHostNamesmtp.example.comOutgoingMailServerUseSSLOutgoingMailServerUsernameusername@example.comPayloadOrganizationYour Organization's NamePayloadDisplayNameOrganization iPhone SettingsPayloadVersion1PayloadUUID954e6e8b-5489-484c-9b1d-0c9b7bf18e32PayloadIdentifiercom.example.iPhone.settingsPayloadDescriptionSets up Organization's LDAP directories and email on the iPhonePayloadTypeConfiguration

2、超级签获取UDID mobileconfig文件示例

  PayloadContent  URL http://127.0.0.1/receive.php  DeviceAttributesUDID IMEI ICCID VERSION PRODUCT   PayloadOrganization com.sssss.orgName PayloadDisplayName 获取设备UDID PayloadVersion 1 PayloadUUID 3C4DC7D2-E475-3375-489C-0BB8D737A653 PayloadIdentifier dev.skyfox.profile-service PayloadDescription 获取设备UDID  PayloadType Profile Service 

3、PHP服务端接收receive.php

$data = file_get_contents('php://input');$plistBegin = '<?xml version="1.0"';$plistEnd = '';$data2= substr($data, strpos($data, $plistBegin), strpos($data, $plistEnd) - strpos($data, $plistBegin));$xml= xml_parser_create();$UDID = "";$CHALLENGE= "";$DEVICE_NAME= "";$DEVICE_PRODUCT = "";$DEVICE_VERSION = "";$iterator = 0;$arrayCleaned = array();$data = "";xml_parse_into_struct($xml, $data2, $vs);xml_parser_free($xml);foreach ($vs as $v) {if ($v['level'] == 3 && $v['type'] == 'complete') {$arrayCleaned[] = $v; }} foreach ($arrayCleaned as $elem) {switch ($elem['value']) {case "CHALLENGE":$CHALLENGE = $arrayCleaned[$iterator + 1]['value'];break;case "DEVICE_NAME":$DEVICE_NAME = $arrayCleaned[$iterator + 1]['value'];break;case "PRODUCT":$DEVICE_PRODUCT = $arrayCleaned[$iterator + 1]['value'];break;case "UDID":$UDID = $arrayCleaned[$iterator + 1]['value'];break;case "VERSION":$DEVICE_VERSION = $arrayCleaned[$iterator + 1]['value'];break;}$iterator++;}header('HTTP/1.1 301 Moved Permanently');//这⾥⼀定要301跳转,否则设备安装会提⽰"⽆效的描述⽂件"$url = "127.0.0.1/udid.php?udid=".$UDID."&version='.$DEVICE_VERSION.'&device_name='.$DEVICE_PRODUCT;header("Location: ".$url);

4、PHP服务端信息处理 udid.php

$UDID =$_GET['UDID'];$version =$_GET['version'];$device_name =$_GET['device_name'];