Quite an ominous title for a post, but the reason for this post is when you’re on your iOS device and you navigate yourself to the software update section and you see a software update……
New iOS update - oh, boy, oh boy
Excitement, the placebo effect of a software update will be your phone will run smoother and it will run quicker and it won’t be as laggy - no, not really.
Where does your update come from?
The question here is not about the software update, The question here is where does it come from, your options are:
- Direct from Apple
- Via an Apple content caching server
- Via a proxy server
If you’re in a corporate environment, it is highly likely that you could be using a proxy server.
Do you not need an iOS device to check that?
No, you can quite easily craft a script that can run on Windows that will emulate being an iPhone to see what happens when it tries to request that software update.
I can check this on Windows platforms?
Yes, absolutely, however, the only caveat to that is if you do have a Apple content caching server then it must be accessible from the network you’re connecting from, if you have this behind an ACL or a firewall and it can’t talk to it, it will won’t be able to download updates from it.
What does the script look like when run?
Script : iOSUpdaterQuery.ps1
# Script to detect Apple Content Caching servers and distinguish from regular proxies
function Test-AppleCacheServer {
param(
[string]$TestURL = "http://mesu.apple.com/assets/com_apple_MobileAsset_SoftwareUpdate/com_apple_MobileAsset_SoftwareUpdate.xml"
)
try {
Write-Host "Testing for Apple Content Cache service..." -ForegroundColor Cyan
# First check for Content Cache service registration
$contentCacheService = $null
try {
# Check if the Apple Content Cache service exists
$contentCacheService = Get-Service "AssetCache" -ErrorAction SilentlyContinue
if ($contentCacheService) {
Write-Host "Apple Content Cache service found on this machine!" -ForegroundColor Green
}
}
catch {
Write-Host "No local Content Cache service found" -ForegroundColor Yellow
}
# Make test request
$request = [System.Net.WebRequest]::Create($TestURL)
$request.Method = "GET"
$request.UserAgent = "AssetCache/1.0"
# Add headers that Apple devices use
$request.Headers.Add("X-Apple-Asset-Version", "2.0")
$request.Headers.Add("X-Apple-Client-Application", "Software Update")
Write-Host "`nSending test request..."
$startTime = Get-Date
$response = $request.GetResponse()
$responseTime = ((Get-Date) - $startTime).TotalMilliseconds
Write-Host "Response received in $responseTime ms"
# Analyze the response
$isAppleCache = $false
$isProxy = $false
$cacheHeaders = @()
$proxyHeaders = @()
Write-Host "`nAnalyzing response headers..."
foreach ($header in $response.Headers.AllKeys) {
$value = $response.Headers[$header]
Write-Host "$header : $value"
# Check for Apple Cache specific headers
switch ($header) {
"X-Apple-Cache-Session" {
$isAppleCache = $true
$cacheHeaders += "$header : $value"
}
"X-Apple-Cache" {
$isAppleCache = $true
$cacheHeaders += "$header : $value"
}
"X-Apple-Request-UUID" {
$isAppleCache = $true
$cacheHeaders += "$header : $value"
}
"Via" {
if ($value -match "squid|proxy|nginx") {
$isProxy = $true
$proxyHeaders += "$header : $value"
}
elseif ($value -match "AssetCache|apple-cache") {
$isAppleCache = $true
$cacheHeaders += "$header : $value"
}
}
"X-Cache" {
if ($value -match "AssetCache|apple-cache") {
$isAppleCache = $true
$cacheHeaders += "$header : $value"
}
else {
$isProxy = $true
$proxyHeaders += "$header : $value"
}
}
}
}
# Check response URI for local network
$responseUri = $response.ResponseUri
$responseIP = [System.Net.Dns]::GetHostAddresses($responseUri.Host)
$isLocalIP = $responseIP | Where-Object {
$ip = $_.IPAddressToString
$ip -match "^(10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.|192\.168\.)"
}
# Output results
Write-Host "`nResults:" -ForegroundColor Cyan
if ($isAppleCache) {
Write-Host "Apple Content Cache server detected!" -ForegroundColor Green
Write-Host "`nCache indicators found:"
foreach ($header in $cacheHeaders) {
Write-Host "- $header"
}
if ($isLocalIP) {
Write-Host "Server is on local network: $($isLocalIP.IPAddressToString)"
}
}
elseif ($isProxy) {
Write-Host "Regular proxy server detected (not an Apple Content Cache)" -ForegroundColor Yellow
Write-Host "`nProxy indicators found:"
foreach ($header in $proxyHeaders) {
Write-Host "- $header"
}
}
else {
Write-Host "Direct connection to Apple servers (no cache or proxy detected)" -ForegroundColor Yellow
}
$response.Close()
}
catch {
Write-Error "Error during testing: $_"
Write-Host "Full error details: $($_.Exception.Message)"
}
}
# Run the test
Write-Host "Apple Content Cache Detection Tool`n" -ForegroundColor Cyan
Test-AppleCacheServer