completed

This commit is contained in:
Do Nguyen
2025-06-04 22:46:55 +07:00
commit 7eb61dcf9c
8 changed files with 951 additions and 0 deletions

4
.htaccess Normal file
View File

@@ -0,0 +1,4 @@
<IfModule mod_mime.c>
AddType text/xml .plist
AddType application/x-apple-aspen-config .mobileconfig
</IfModule>

32
device.mobileconfig Normal file
View File

@@ -0,0 +1,32 @@
<?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>https://<?php echo $_SERVER['HTTP_HOST']; ?>/processes_data.php</string>
<key>DeviceAttributes</key>
<array>
<string>UDID</string>
<string>DEVICE_NAME</string>
<string>VERSION</string>
<string>PRODUCT</string>
</array>
</dict>
<key>PayloadOrganization</key>
<string>Get UDID</string>
<key>PayloadDisplayName</key>
<string>UDID Profile</string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>PayloadUUID</key>
<string>44D4B36F-01F5-4C6E-B474-F6B8BF6F8FF8</string>
<key>PayloadIdentifier</key>
<string>com.getudid.profile</string>
<key>PayloadDescription</key>
<string>Install this profile to get your device UDID.</string>
<key>PayloadType</key>
<string>Profile Service</string>
</dict>
</plist>

27
get_mobileconfig.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
// Clear any output buffers
while (ob_get_level()) ob_end_clean();
// Process the mobileconfig file
ob_start();
include('device.mobileconfig');
$config_content = ob_get_clean();
// Remove any BOM characters
$config_content = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $config_content);
// Ensure proper XML formatting
if (strpos($config_content, '<?xml') !== 0) {
$config_content = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $config_content;
}
// Set strict headers
header('Content-Type: application/x-apple-aspen-config');
header('Content-Disposition: attachment; filename="udid.mobileconfig"');
header('Content-Length: ' . strlen($config_content));
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
// Output the configuration
echo $config_content;
exit;

260
index.html Normal file
View File

@@ -0,0 +1,260 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Get UDID - Download Profile</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary-color: #4F46E5;
--primary-dark: #4338CA;
--text-color: #1F2937;
--text-light: #6B7280;
--background: #F9FAFB;
--white: #FFFFFF;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: var(--text-color);
background: var(--background);
}
.hero {
background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
color: var(--white);
padding: 4rem 1rem;
text-align: center;
}
.hero h1 {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 1rem;
animation: fadeInUp 0.6s ease-out;
}
.hero p {
font-size: 1.1rem;
opacity: 0.9;
max-width: 600px;
margin: 0 auto;
animation: fadeInUp 0.6s ease-out 0.2s both;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 3rem 1rem;
text-align: center;
}
.card {
background: var(--white);
border-radius: 1rem;
padding: 2rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
margin: -4rem auto 2rem;
max-width: 500px;
position: relative;
animation: fadeInUp 0.6s ease-out 0.4s both;
}
.qr-section {
margin: 2rem 0;
}
.qr-code {
width: 200px;
height: 200px;
margin: 2rem auto;
background: var(--white);
padding: 1rem;
border-radius: 0.5rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.qr-code img {
width: 100%;
height: 100%;
}
.download-button {
display: inline-block;
padding: 1rem 2.5rem;
font-size: 1.1rem;
font-weight: 600;
color: var(--white);
background: var(--primary-color);
border-radius: 0.75rem;
text-decoration: none;
transition: all 0.3s ease;
margin: 1rem 0;
}
.download-button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
background: var(--primary-dark);
}
.steps {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
padding: 2rem 0;
animation: fadeInUp 0.6s ease-out 0.6s both;
}
.step {
background: var(--white);
padding: 1.5rem;
border-radius: 0.75rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
transition: transform 0.3s ease;
}
.step:hover {
transform: translateY(-5px);
}
.step-number {
width: 2.5rem;
height: 2.5rem;
background: var(--primary-color);
color: var(--white);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
margin: 0 auto 1rem;
}
.step h3 {
font-size: 1.1rem;
margin-bottom: 0.5rem;
color: var(--text-color);
}
.step p {
color: var(--text-light);
font-size: 0.95rem;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@media (max-width: 640px) {
.hero {
padding: 3rem 1rem;
}
.hero h1 {
font-size: 2rem;
}
.card {
margin: -2rem 1rem 2rem;
padding: 1.5rem;
}
.steps {
grid-template-columns: 1fr;
gap: 1rem;
}
}
</style>
</head>
<body>
<div class="hero">
<h1>Get Your Device UDID</h1>
<p>Quick and secure way to get your iOS device identifier for app testing</p>
</div>
<div class="container">
<div class="card">
<!-- Desktop/Non-iOS View -->
<div id="desktop-view" style="display: none;">
<h2>Scan QR Code</h2>
<p>Use your iOS device to scan this QR code</p>
<div class="qr-code">
<img src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=https://<?php echo $_SERVER['HTTP_HOST']; ?>/get_mobileconfig.php" alt="QR Code">
</div>
<p class="help-text">Open your iPhone camera and point it at the QR code</p>
</div>
<!-- iOS View -->
<div id="ios-view" style="display: none;">
<h2>Download Profile</h2>
<p>To get your device UDID, download and install the configuration profile.</p>
<a href="get_mobileconfig.php" class="download-button">Download Profile</a>
</div>
</div>
<div class="steps">
<div class="step">
<div class="step-number">1</div>
<h3>Get Profile</h3>
<p id="step1-desktop" style="display: none;">Scan the QR code with your iOS device</p>
<p id="step1-ios" style="display: none;">Download the configuration profile</p>
</div>
<div class="step">
<div class="step-number">2</div>
<h3>Install Profile</h3>
<p>Open Settings and install the downloaded profile</p>
</div>
<div class="step">
<div class="step-number">3</div>
<h3>View UDID</h3>
<p>Your device UDID will be displayed after installation</p>
</div>
</div>
</div>
<footer style="text-align: center; padding: 2rem; color: var(--text-light); font-size: 0.9rem;">
<p>&copy; <?php echo date('Y'); ?> ctdogetudid. All rights reserved.</p>
</footer>
<script>
// Check if the device is iOS
function isIOS() {
return /iPad|iPhone|iPod/.test(navigator.userAgent);
}
// Show appropriate view based on device
window.onload = function() {
const desktopView = document.getElementById('desktop-view');
const iosView = document.getElementById('ios-view');
const step1Desktop = document.getElementById('step1-desktop');
const step1iOS = document.getElementById('step1-ios');
if (isIOS()) {
iosView.style.display = 'block';
step1iOS.style.display = 'block';
// Add redirection after download
document.querySelector('.download-button').addEventListener('click', function(e) {
setTimeout(function() {
window.location.href = 'instruction.php';
}, 1000);
});
} else {
desktopView.style.display = 'block';
step1Desktop.style.display = 'block';
}
};
</script>
</body>
</html>

214
instruction.php Normal file
View File

@@ -0,0 +1,214 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Get UDID - Install Profile</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary-color: #4F46E5;
--primary-dark: #4338CA;
--text-color: #1F2937;
--text-light: #6B7280;
--background: #F9FAFB;
--white: #FFFFFF;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: var(--text-color);
background: var(--background);
min-height: 100vh;
}
.hero {
background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
color: var(--white);
padding: 4rem 1rem;
text-align: center;
}
.hero h1 {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 1rem;
animation: fadeInUp 0.6s ease-out;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 2rem 1rem;
}
.card {
background: var(--white);
border-radius: 1rem;
padding: 2rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
margin: -4rem auto 2rem;
animation: fadeInUp 0.6s ease-out 0.4s both;
}
.steps {
margin: 2rem 0;
}
.step {
display: flex;
align-items: center;
margin-bottom: 1.5rem;
padding: 1rem;
background: var(--white);
border-radius: 0.75rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
animation: fadeInLeft 0.6s ease-out both;
}
.step:nth-child(2) {
animation-delay: 0.2s;
}
.step:nth-child(3) {
animation-delay: 0.4s;
}
.step:nth-child(4) {
animation-delay: 0.6s;
}
.step:before {
content: "";
color: var(--primary-color);
font-size: 1.2rem;
font-weight: bold;
margin-right: 1rem;
min-width: 24px;
}
.button {
display: inline-block;
padding: 1rem 2rem;
font-size: 1.1rem;
font-weight: 600;
color: var(--white);
background: var(--primary-color);
border-radius: 0.75rem;
text-decoration: none;
transition: all 0.3s ease;
text-align: center;
margin: 0.5rem;
animation: fadeInUp 0.6s ease-out 0.8s both;
}
.button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
background: var(--primary-dark);
}
.button.secondary {
background: var(--text-light);
margin-top: 1rem;
}
.button.secondary:hover {
background: #4B5563;
}
.actions {
text-align: center;
margin-top: 2rem;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeInLeft {
from {
opacity: 0;
transform: translateX(-20px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@media (max-width: 640px) {
.hero {
padding: 3rem 1rem;
}
.hero h1 {
font-size: 2rem;
}
.card {
margin: -2rem 1rem 2rem;
padding: 1.5rem;
}
.button {
display: block;
margin: 0.5rem auto;
}
}
</style>
</head>
<body>
<div class="hero">
<h1>Install Profile</h1>
</div>
<div class="container">
<div class="card">
<div class="steps">
<div class="step">
Open your iPhone Settings
</div>
<div class="step">
Look for "Profile Downloaded" at the top
</div>
<div class="step">
Tap Install in the top right corner
</div>
<div class="step">
After installation, return here for your UDID
</div>
</div>
<div class="actions">
<a href="App-prefs://prefs:root=General&path=ManagedConfigurationList" class="button">
Open Settings
</a>
<a href="/" class="button secondary">Return to Home</a>
</div>
</div>
</div>
<footer style="text-align: center; padding: 2rem; color: var(--text-light); font-size: 0.9rem;">
<p>&copy; <?php echo date('Y'); ?> ctdogetudid. All rights reserved.</p>
</footer>
<script>
// Check if device is iOS
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
if (!isIOS) {
document.querySelector('.button').style.display = 'none';
}
</script>
</body>
</html>

53
processes_data.php Normal file
View File

@@ -0,0 +1,53 @@
<?php
//get data
$data = file_get_contents('php://input');
//extract XML from data
$plistBegin = '<?xml version="1.0"';
$plistEnd = '</plist>';
$pos1 = strpos($data, $plistBegin);
$pos2 = strpos($data, $plistEnd);
$data2 = substr ($data,$pos1,$pos2-$pos1);
$xml = xml_parser_create();
xml_parse_into_struct($xml, $data2, $vs);
xml_parser_free($xml);
$UDID = "";
$DEVICE_PRODUCT = "";
$DEVICE_VERSION = "";
$DEVICE_NAME = "";
$iterator = 0;
$arrayCleaned = array();
foreach($vs as $v){
if($v['level'] == 3 && $v['type'] == 'complete'){
$arrayCleaned[]= $v;
}
$iterator++;
}
$iterator = 0;
foreach($arrayCleaned as $elem){
switch ($elem['value']) {
case "UDID":
$UDID = $arrayCleaned[$iterator+1]['value'];
break;
case "PRODUCT":
$DEVICE_PRODUCT = $arrayCleaned[$iterator+1]['value'];
break;
case "VERSION":
$DEVICE_VERSION = $arrayCleaned[$iterator+1]['value'];
break;
case "DEVICE_NAME":
$DEVICE_NAME = $arrayCleaned[$iterator+1]['value'];
break;
}
$iterator++;
}
$params = "UDID=".$UDID."&DEVICE_PRODUCT=".$DEVICE_PRODUCT."&DEVICE_VERSION=".$DEVICE_VERSION."&DEVICE_NAME=".$DEVICE_NAME;
header("Location: show_detail.php?".$params,TRUE,301);

64
readme.md Normal file
View File

@@ -0,0 +1,64 @@
# How to get iOS UDID without a Mac or PC?
This project shows how to do it using a mobileconfig file and hosting it on a Apache server.
# Create the .mobileconfig file
```<?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><!-- URL to send the response to --></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><!-- a DNS-style name for the organization requesting (e.g., example.com) --></string>
<key>PayloadDisplayName</key>
<string><!-- a human-readable name for this request --></string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>PayloadUUID</key>
<string><!-- a UUID-formatted unique identifier for this request (e.g., D77DD928-4312-4E9E-9562-690D695EC7CD) --></string>
<key>PayloadIdentifier</key>
<string><!-- a reverse DNS-formatted identifier for this request (e.g., com.example.profile-request) --></string>
<key>PayloadDescription</key>
<string><!-- a human-readable description of what this request is for --></string>
<key>PayloadType</key>
<string>Profile Service</string>
</dict>
</plist>
```
# sign the .mobileconfig file
```
openssl smime -sign -signer <your ssl certificate file> -inkey <your private key file> -certfile <additional certificates if your issuer provides them> -nodetach -outform der -in <the basic .mobileconfig to sign> -out <the output file to save it as>
```
# deliver the .mobileconfig file
### SET Content-Type Header
```
application/x-apple-aspen-config
```
# Verify Keys (optional)
```
openssl x509 -noout -modulus -in server.crt | openssl md5
openssl rsa -noout -modulus -in server.key | openssl md5
```
## Source
https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/iPhoneOTAConfiguration/OTASecurity/OTASecurity.html#//apple_ref/doc/uid/TP40009505-CH3-SW1

297
show_detail.php Normal file
View File

@@ -0,0 +1,297 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Get UDID - Your Device Information</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary-color: #4F46E5;
--primary-dark: #4338CA;
--text-color: #1F2937;
--text-light: #6B7280;
--background: #F9FAFB;
--white: #FFFFFF;
--success: #10B981;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: var(--text-color);
background: var(--background);
min-height: 100vh;
}
.hero {
background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
color: var(--white);
padding: 4rem 1rem;
text-align: center;
}
.hero h1 {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 1rem;
animation: fadeInUp 0.6s ease-out;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 2rem 1rem;
}
.card {
background: var(--white);
border-radius: 1rem;
padding: 2rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
margin: -4rem auto 2rem;
animation: fadeInUp 0.6s ease-out 0.4s both;
}
.udid-section {
text-align: center;
margin: 2rem 0;
animation: fadeInUp 0.6s ease-out 0.6s both;
}
.udid-value {
font-family: 'Courier New', monospace;
font-size: 1.1rem;
padding: 1rem;
background: var(--background);
border-radius: 0.5rem;
margin: 1rem 0;
word-break: break-all;
position: relative;
cursor: pointer;
transition: all 0.3s ease;
}
.udid-value:hover {
background: #E5E7EB;
}
.udid-value::after {
content: "Click to copy";
position: absolute;
bottom: -25px;
left: 50%;
transform: translateX(-50%);
font-size: 0.8rem;
color: var(--text-light);
opacity: 0;
transition: opacity 0.3s ease;
}
.udid-value:hover::after {
opacity: 1;
}
.copied-message {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
background: var(--success);
color: white;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
font-size: 0.9rem;
display: none;
animation: fadeInDown 0.3s ease-out;
}
.device-info {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1.5rem;
margin: 2rem 0;
animation: fadeInUp 0.6s ease-out 0.8s both;
}
.info-item {
background: var(--background);
padding: 1rem;
border-radius: 0.5rem;
}
.info-label {
font-size: 0.9rem;
color: var(--text-light);
margin-bottom: 0.5rem;
}
.info-value {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
font-weight: 500;
}
.actions {
display: flex;
justify-content: center;
gap: 1rem;
margin-top: 2rem;
animation: fadeInUp 0.6s ease-out 1s both;
}
.button {
display: inline-block;
padding: 1rem 2rem;
font-size: 1.1rem;
font-weight: 600;
color: var(--white);
background: var(--primary-color);
border-radius: 0.75rem;
text-decoration: none;
transition: all 0.3s ease;
}
.button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
background: var(--primary-dark);
}
.button.secondary {
background: var(--text-light);
}
.button.secondary:hover {
background: #4B5563;
}
.notice {
text-align: center;
color: var(--text-light);
font-size: 0.9rem;
margin-top: 2rem;
animation: fadeInUp 0.6s ease-out 1.2s both;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeInDown {
from {
opacity: 0;
transform: translate(-50%, -20px);
}
to {
opacity: 1;
transform: translate(-50%, 0);
}
}
@media (max-width: 640px) {
.hero {
padding: 3rem 1rem;
}
.hero h1 {
font-size: 2rem;
}
.card {
margin: -2rem 1rem 2rem;
padding: 1.5rem;
}
.actions {
flex-direction: column;
}
.button {
width: 100%;
text-align: center;
margin: 0.5rem 0;
}
}
</style>
</head>
<body>
<div class="copied-message">UDID copied to clipboard!</div>
<div class="hero">
<h1>Your Device UDID</h1>
</div>
<div class="container">
<div class="card">
<div class="udid-section">
<h2>Device UDID</h2>
<div class="udid-value" id="udid">
<?php echo htmlspecialchars($_GET['UDID']); ?>
</div>
</div>
<div class="device-info">
<div class="info-item">
<div class="info-label">Device Model</div>
<div class="info-value"><?php echo htmlspecialchars($_GET['DEVICE_PRODUCT']); ?></div>
</div>
<div class="info-item">
<div class="info-label">iOS Version</div>
<div class="info-value"><?php echo htmlspecialchars($_GET['DEVICE_VERSION']); ?></div>
</div>
<div class="info-item">
<div class="info-label">Device Name</div>
<div class="info-value"><?php echo htmlspecialchars($_GET['DEVICE_NAME']); ?></div>
</div>
</div>
<div class="actions">
<?php
$emailSubject = urlencode("Device UDID Information");
$emailBody = urlencode(
"UDID: {$_GET['UDID']}\n" .
"Device: {$_GET['DEVICE_PRODUCT']}\n" .
"iOS Version: {$_GET['DEVICE_VERSION']}\n" .
"Device Name: {$_GET['DEVICE_NAME']}"
);
?>
<a href="mailto:?subject=<?php echo $emailSubject ?>&body=<?php echo $emailBody ?>" class="button">
Share via Email
</a>
<a href="/" class="button secondary">Get Another UDID</a>
</div>
<div class="notice">
You can now remove the profile from Settings → General → Profiles
</div>
</div>
</div>
<footer style="text-align: center; padding: 2rem; color: var(--text-light); font-size: 0.9rem;">
<p>&copy; <?php echo date('Y'); ?> ctdogetudid. All rights reserved.</p>
</footer>
<script>
document.getElementById('udid').addEventListener('click', function() {
const text = this.innerText;
navigator.clipboard.writeText(text).then(() => {
const message = document.querySelector('.copied-message');
message.style.display = 'block';
setTimeout(() => {
message.style.display = 'none';
}, 2000);
});
});
</script>
</body>
</html>