0


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.com/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>com.apple.ldap.account</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
            <key>PayloadUUID</key>
            <string>6df7a612-ce0a-4b4b-bce2-7b844e3c9df0</string>
            <key>PayloadIdentifier</key>
            <string>com.example.iPhone.settings.ldap</string>
            <key>LDAPAccountDescription</key>
            <string>Company Contacts</string>
            <key>LDAPAccountHostName</key>
            <string>ldap.example.com</string>
            <key>LDAPAccountUseSSL</key>
            <false />
            <key>LDAPAccountUserName</key>
            <string>uid=username,dc=example,dc=com</string>
            <key>LDAPSearchSettings</key>
            <array>
                <dict>
                    <key>LDAPSearchSettingDescription</key>
                    <string>Company 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=com</string>
                    <key>LDAPSearchSettingScope</key>
                    <string>LDAPSearchSettingScopeSubtree</string>
                </dict>
            </array>
        </dict>
        <dict>
            <key>PayloadDisplayName</key>
            <string>Email Settings</string>
            <key>PayloadType</key>
            <string>com.apple.mail.managed</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
            <key>PayloadUUID</key>
            <string>362e5c11-a332-4dfb-b18b-f6f0aac032fd</string>
            <key>PayloadIdentifier</key>
            <string>com.example.iPhone.settings.email</string>
            <key>EmailAccountDescription</key>
            <string>Company E-mail</string>
            <key>EmailAccountName</key>
            <string>Full Name</string>
            <key>EmailAccountType</key>
            <string>EmailTypeIMAP</string>
            <key>EmailAddress</key>
            <string>[email protected]</string>
            <key>IncomingMailServerAuthentication</key>
            <string>EmailAuthPassword</string>
            <key>IncomingMailServerHostName</key>
            <string>imap.example.com</string>
            <key>IncomingMailServerUseSSL</key>
            <true />
            <key>IncomingMailServerUsername</key>
            <string>[email protected]</string>
            <key>OutgoingPasswordSameAsIncomingPassword</key>
            <true />
            <key>OutgoingMailServerAuthentication</key>
            <string>EmailAuthPassword</string>
            <key>OutgoingMailServerHostName</key>
            <string>smtp.example.com</string>
            <key>OutgoingMailServerUseSSL</key>
            <true />
            <key>OutgoingMailServerUsername</key>
            <string>[email protected]</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>com.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.com/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>ICCID</string>
             <string>VERSION</string>
             <string>PRODUCT</string>
         </array>
     </dict>
     <key>PayloadOrganization</key>
     <string>com.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'] == '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'];
标签: ios 前端

本文转载自: https://blog.csdn.net/qq_24138677/article/details/128546025
版权归原作者 刘兆河 所有, 如有侵权,请联系我们删除。

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

还没有评论