IOS系统mobileconfig的作用,mobileconfig文件如何使用,苹果超级签实现

IOS系统mobileconfig的作用,mobileconfig文件如何使用,苹果超级签实现

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

官方介绍:

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

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

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

1、代码示例

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.***/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PayloadContent</key>
    <array>
        <dict>
            <key>PayloadDisplayName</key>
            <string>LDAP Settings</string>
            <key>PayloadType</key>
            <string>***.apple.ldap.a***ount</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
            <key>PayloadUUID</key>
            <string>6df7a612-ce0a-4b4b-bce2-7b844e3c9df0</string>
            <key>PayloadIdentifier</key>
            <string>***.example.iPhone.settings.ldap</string>
            <key>LDAPA***ountDescription</key>
            <string>***pany Contacts</string>
            <key>LDAPA***ountHostName</key>
            <string>ldap.example.***</string>
            <key>LDAPA***ountUseSSL</key>
            <false />
            <key>LDAPA***ountUserName</key>
            <string>uid=username,dc=example,dc=***</string>
            <key>LDAPSearchSettings</key>
            <array>
                <dict>
                    <key>LDAPSearchSettingDescription</key>
                    <string>***pany Contacts</string>
                    <key>LDAPSearchSettingSearchBase</key>
                    <string></string>
                    <key>LDAPSearchSettingScope</key>
                    <string>LDAPSearchSettingScopeSubtree</string>
                </dict>
                <dict>
                    <key>LDAPSearchSettingDescription</key>
                    <string>Sales Departments</string>
                    <key>LDAPSearchSettingSearchBase</key>
                    <string>ou=Sales,dc=example,dc=***</string>
                    <key>LDAPSearchSettingScope</key>
                    <string>LDAPSearchSettingScopeSubtree</string>
                </dict>
            </array>
        </dict>
        <dict>
            <key>PayloadDisplayName</key>
            <string>Email Settings</string>
            <key>PayloadType</key>
            <string>***.apple.mail.managed</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
            <key>PayloadUUID</key>
            <string>362e5c11-a332-4dfb-b18b-f6f0aac032fd</string>
            <key>PayloadIdentifier</key>
            <string>***.example.iPhone.settings.email</string>
            <key>EmailA***ountDescription</key>
            <string>***pany E-mail</string>
            <key>EmailA***ountName</key>
            <string>Full Name</string>
            <key>EmailA***ountType</key>
            <string>EmailTypeIMAP</string>
            <key>EmailAddress</key>
            <string>username@example.***</string>
            <key>In***ingMailServerAuthentication</key>
            <string>EmailAuthPassword</string>
            <key>In***ingMailServerHostName</key>
            <string>imap.example.***</string>
            <key>In***ingMailServerUseSSL</key>
            <true />
            <key>In***ingMailServerUsername</key>
            <string>username@es2eng.***</string>
            <key>OutgoingPasswordSameAsIn***ingPassword</key>
            <true />
            <key>OutgoingMailServerAuthentication</key>
            <string>EmailAuthPassword</string>
            <key>OutgoingMailServerHostName</key>
            <string>smtp.example.***</string>
            <key>OutgoingMailServerUseSSL</key>
            <true />
            <key>OutgoingMailServerUsername</key>
            <string>username@example.***</string>
        </dict>
    </array>
    <key>PayloadOrganization</key>
    <string>Your Organization's Name</string>
    <key>PayloadDisplayName</key>
    <string>Organization iPhone Settings</string>
    <key>PayloadVersion</key>
    <integer>1</integer>
    <key>PayloadUUID</key>
    <string>954e6e8b-5489-484c-9b1d-0c9b7bf18e32</string>
    <key>PayloadIdentifier</key>
    <string>***.example.iPhone.settings</string>
    <key>PayloadDescription</key>
    <string>Sets up Organization's LDAP directories and email on the iPhone</string>
    <key>PayloadType</key>
    <string>Configuration</string>
</dict>
</plist>

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

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.***/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
 <dict>
     <key>PayloadContent</key>
     <dict>
         <key>URL</key>
         <string>http://127.0.0.1/receive.php</string> <!--接收数据的接⼝地址-->
         <key>DeviceAttributes</key>
         <array>
             <string>UDID</string>
             <string>IMEI</string>
             <string>I***ID</string>
             <string>VERSION</string>
             <string>PRODUCT</string>
         </array>
     </dict>
     <key>PayloadOrganization</key>
     <string>***.sssss.orgName</string>  <!--组织名称-->
     <key>PayloadDisplayName</key>
     <string>获取设备UDID</string>  <!--安装时显⽰的标题-->
     <key>PayloadVersion</key>
     <integer>1</integer>
     <key>PayloadUUID</key>
     <string>3C4DC7D2-E475-3375-489C-0BB8D737A653</string>  <!--随机填写的字符串-->
     <key>PayloadIdentifier</key>
     <string>dev.skyfox.profile-service</string>
     <key>PayloadDescription</key>
     <string>获取设备UDID</string>   <!--描述-->
     <key>PayloadType</key>
     <string>Profile Service</string>
 </dict>
</plist>

3、PHP服务端接收receive.php

$data = file_get_contents('php://input');
$plistBegin     = '<?xml version="1.0"';
$plistEnd       = '</plist>';
$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'] == '***plete') {
                $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'];

转载请说明出处内容投诉
CSS教程_站长资源网 » IOS系统mobileconfig的作用,mobileconfig文件如何使用,苹果超级签实现

发表评论

欢迎 访客 发表评论

一个令你着迷的主题!

查看演示 官网购买