UUP dump API 1.14.0

- Added support of pregenerated update packs
- Added support of fetching updates that need custom SKU ID
This commit is contained in:
mkuba50 2018-04-29 21:33:19 +02:00
parent 6eaa55dad1
commit 5b62a1699c
14 changed files with 139 additions and 81 deletions

View File

@ -19,7 +19,7 @@ require_once dirname(__FILE__).'/shared/main.php';
require_once dirname(__FILE__).'/shared/requests.php'; require_once dirname(__FILE__).'/shared/requests.php';
require_once dirname(__FILE__).'/listid.php'; require_once dirname(__FILE__).'/listid.php';
function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build = '16251', $minor = '0') { function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build = '16251', $minor = '0', $sku = '48') {
uupApiPrintBrand(); uupApiPrintBrand();
$arch = strtolower($arch); $arch = strtolower($arch);
@ -30,6 +30,7 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
$build = explode('.', $build); $build = explode('.', $build);
if(isset($build[1])) $minor = intval($build[1]); if(isset($build[1])) $minor = intval($build[1]);
$build = intval($build[0]); $build = intval($build[0]);
$sku = intval($sku);
if(!($arch == 'amd64' || $arch == 'x86' || $arch == 'arm64')) { if(!($arch == 'amd64' || $arch == 'x86' || $arch == 'arm64')) {
return array('error' => 'UNKNOWN_ARCH'); return array('error' => 'UNKNOWN_ARCH');
@ -60,7 +61,7 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
$build = '10.0.'.$build.'.'.$minor; $build = '10.0.'.$build.'.'.$minor;
consoleLogger('Fetching information from the server...'); consoleLogger('Fetching information from the server...');
$postData = composeFetchUpdRequest(uupDevice(), uupEncryptedData(), $arch, $flight, $ring, $build); $postData = composeFetchUpdRequest(uupDevice(), uupEncryptedData(), $arch, $flight, $ring, $build, $sku);
$out = sendWuPostRequest('https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx', $postData); $out = sendWuPostRequest('https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx', $postData);
$out = html_entity_decode($out); $out = html_entity_decode($out);
@ -84,7 +85,7 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
$num++; $num++;
consoleLogger("Checking build information for update {$num} of {$updatesNum}..."); consoleLogger("Checking build information for update {$num} of {$updatesNum}...");
$info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build); $info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build, $sku);
if(isset($info['error'])) { if(isset($info['error'])) {
$errorCount++; $errorCount++;
continue; continue;
@ -108,7 +109,7 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
); );
} }
function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build) { function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku = '48') {
$updateNumId = preg_replace('/<UpdateInfo><ID>|<\/ID>.*/i', '', $updateInfo); $updateNumId = preg_replace('/<UpdateInfo><ID>|<\/ID>.*/i', '', $updateInfo);
$updates = preg_replace('/<Update>/', "\n<Update>", $out); $updates = preg_replace('/<Update>/', "\n<Update>", $out);
@ -218,6 +219,7 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build) {
$temp['arch'] = $arch; $temp['arch'] = $arch;
$temp['build'] = $foundBuild; $temp['build'] = $foundBuild;
$temp['checkBuild'] = $build; $temp['checkBuild'] = $build;
$temp['sku'] = $sku;
if($isCumulativeUpdate) { if($isCumulativeUpdate) {
$temp['containsCU'] = 1; $temp['containsCU'] = 1;
@ -248,6 +250,9 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build) {
$testName = $val['build'].' '.$val['title'].' '.$val['arch']; $testName = $val['build'].' '.$val['title'].' '.$val['arch'];
if($buildName == $testName && $val['uuid'] != $updateString) { if($buildName == $testName && $val['uuid'] != $updateString) {
unlink(realpath('fileinfo/'.$val['uuid'].'.json')); unlink(realpath('fileinfo/'.$val['uuid'].'.json'));
if(file_exists('packs/'.$val['uuid'].'.json.gz')) {
unlink(realpath('packs/'.$val['uuid'].'.json.gz'));
}
consoleLogger('Removed superseded update: '.$val['uuid']); consoleLogger('Removed superseded update: '.$val['uuid']);
} }
} }

70
get.php
View File

@ -29,6 +29,7 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
'flight' => 'Active', 'flight' => 'Active',
'arch' => 'amd64', 'arch' => 'amd64',
'checkBuild' => '10.0.16251.0', 'checkBuild' => '10.0.16251.0',
'sku' => '48',
'files' => array(), 'files' => array(),
); );
} else { } else {
@ -42,6 +43,10 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
$build = 9841; $build = 9841;
} }
if(!isset($info['sku'])) {
$info['sku'] = 48;
}
$packs = uupGetPacks($build); $packs = uupGetPacks($build);
$packsForLangs = $packs['packsForLangs']; $packsForLangs = $packs['packsForLangs'];
$editionPacks = $packs['editionPacks']; $editionPacks = $packs['editionPacks'];
@ -53,6 +58,25 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
$noLangPack = 0; $noLangPack = 0;
$noNeutral = 0; $noNeutral = 0;
$useGeneratedPacks = 0;
if(file_exists('packs/'.$updateId.'.json.gz') && $usePack) {
$genPack = @gzdecode(@file_get_contents('packs/'.$updateId.'.json.gz'));
if(!empty($genPack)) {
$genPack = json_decode($genPack, 1);
if(!isset($genPack[$usePack])) {
return array('error' => 'UNSUPPORTED_LANG');
}
$packsForLangs = array();
$packsForLangs[$usePack] = array(0);
$useGeneratedPacks = 1;
}
}
if($usePack) { if($usePack) {
$usePack = strtolower($usePack); $usePack = strtolower($usePack);
if(!isset($packsForLangs[$usePack])) { if(!isset($packsForLangs[$usePack])) {
@ -63,7 +87,22 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
$desiredEdition = strtoupper($desiredEdition); $desiredEdition = strtoupper($desiredEdition);
switch($desiredEdition) { switch($desiredEdition) {
case '0': break; case '0':
if($useGeneratedPacks) {
$desiredEdition = 'GENERATEDPACKS';
$filesList = array();
foreach($genPack[$usePack] as $val) {
foreach($val as $package) {
$filesList[] = $package;
}
}
array_unique($filesList);
sort($filesList);
}
break;
case 'WUBFILE': break; case 'WUBFILE': break;
case 'UPDATEONLY': case 'UPDATEONLY':
@ -73,9 +112,20 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
break; break;
default: default:
if($useGeneratedPacks) {
if(!isset($genPack[$usePack][$desiredEdition])) {
return array('error' => 'UNSUPPORTED_COMBINATION');
}
$filesList = $genPack[$usePack][$desiredEdition];
$desiredEdition = 'GENERATEDPACKS';
break;
}
if(!$usePack) { if(!$usePack) {
return array('error' => 'UNSPECIFIED_LANG'); return array('error' => 'UNSPECIFIED_LANG');
} }
if(!isset($editionPacks[$desiredEdition])) { if(!isset($editionPacks[$desiredEdition])) {
return array('error' => 'UNSUPPORTED_EDITION'); return array('error' => 'UNSUPPORTED_EDITION');
} }
@ -253,6 +303,10 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
$filesKeys = preg_grep('/WindowsUpdateBox.exe/i', $filesKeys); $filesKeys = preg_grep('/WindowsUpdateBox.exe/i', $filesKeys);
break; break;
case 'GENERATEDPACKS':
$skipPackBuild = 1;
break;
default: default:
$skipPackBuild = 0; $skipPackBuild = 0;
break; break;
@ -314,6 +368,20 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
unset($filesTemp, $temp, $val, $num); unset($filesTemp, $temp, $val, $num);
} }
if($desiredEdition == 'GENERATEDPACKS') {
$newFiles = array();
foreach($filesList as $val) {
$name = preg_replace('/~31bf3856ad364e35/', '', $val);
$name = preg_replace('/~~\.|~\./', '.', $name);
$name = preg_replace('/~/', '-', $name);
$newFiles[$name] = $files[$name];
}
$files = $newFiles;
$filesKeys = array_keys($files);
}
if(empty($filesKeys)) { if(empty($filesKeys)) {
return array('error' => 'NO_FILES'); return array('error' => 'NO_FILES');
} }

View File

@ -36,6 +36,24 @@ function uupListEditions($lang = 'en-us', $updateId = 0) {
$fancyEditionNames = $packs['fancyEditionNames']; $fancyEditionNames = $packs['fancyEditionNames'];
$packs = $packs['packs']; $packs = $packs['packs'];
if(file_exists('packs/'.$updateId.'.json.gz')) {
$genPack = @gzdecode(@file_get_contents('packs/'.$updateId.'.json.gz'));
if(!empty($genPack)) {
$genPack = json_decode($genPack, 1);
if(!isset($genPack[$lang])) {
return array('error' => 'UNSUPPORTED_LANG');
}
$packsForLangs = array();
$packsForLangs[$lang] = array(0);
$packs = array();
$packs[0] = $genPack[$lang];
}
}
if($lang) { if($lang) {
$lang = strtolower($lang); $lang = strtolower($lang);
if(!isset($packsForLangs[$lang])) { if(!isset($packsForLangs[$lang])) {
@ -55,9 +73,8 @@ function uupListEditions($lang = 'en-us', $updateId = 0) {
$fancyName = $edition; $fancyName = $edition;
} }
$temp = array($edition => $fancyName); $editionList[] = $edition;
$editionList = array_merge($editionList, array($edition)); $editionListFancy[$edition] = $fancyName;
$editionListFancy = array_merge($editionListFancy, $temp);
} }
} }

View File

@ -35,18 +35,26 @@ function uupListLangs($updateId = 0) {
$packsForLangs = $packs['packsForLangs']; $packsForLangs = $packs['packsForLangs'];
$fancyLangNames = $packs['fancyLangNames']; $fancyLangNames = $packs['fancyLangNames'];
if(file_exists('packs/'.$updateId.'.json.gz')) {
$genPack = @gzdecode(@file_get_contents('packs/'.$updateId.'.json.gz'));
if(!empty($genPack)) {
$genPack = json_decode($genPack, 1);
$packsForLangs = $genPack;
}
}
$langList = array(); $langList = array();
$langListFancy = array(); $langListFancy = array();
foreach($packsForLangs as $key => $val) { foreach($packsForLangs as $key => $val) {
if(isset($packsForLangs[$key])) { if(isset($fancyLangNames[$key])) {
$fancyName = $fancyLangNames[$key]; $fancyName = $fancyLangNames[$key];
} else { } else {
$fancyName = $key; $fancyName = $key;
} }
$temp = array($key => $fancyName); $langList[] = $key;
$langList = array_merge($langList, array($key)); $langListFancy[$key] = $fancyName;
$langListFancy = array_merge($langListFancy, $temp);
} }
return array( return array(

View File

@ -16,7 +16,7 @@ limitations under the License.
*/ */
function uupApiVersion() { function uupApiVersion() {
return '1.13.3'; return '1.14.0';
} }
function uupApiPrintBrand() { function uupApiPrintBrand() {

View File

@ -57,6 +57,23 @@ function uupGetPacks($build = 15063) {
'zh-tw' => 'Chinese (Traditional)', 'zh-tw' => 'Chinese (Traditional)',
); );
$fancyEditionNames = array(
'CLOUD' => 'Windows 10 S',
'CLOUDN' => 'Windows 10 S N',
'CLOUDE' => 'Windows 10 CloudE',
'CORE' => 'Windows 10 Home',
'CORECOUNTRYSPECIFIC' => 'Windows 10 Home China',
'COREN' => 'Windows 10 Home N',
'CORESINGLELANGUAGE' => 'Windows 10 Home Single Language',
'EDUCATION' => 'Windows 10 Education',
'EDUCATIONN' => 'Windows 10 Education N',
'ENTERPRISE' => 'Windows 10 Enterprise',
'ENTERPRISEN' => 'Windows 10 Enterprise N',
'PPIPRO' => 'Windows 10 Team',
'PROFESSIONAL' => 'Windows 10 Pro',
'PROFESSIONALN' => 'Windows 10 Pro N',
);
$allEditions = array( $allEditions = array(
'ANALOGONECORE', 'ANALOGONECORE',
'ANDROMEDA', 'ANDROMEDA',

View File

@ -176,14 +176,6 @@ $editionPacks = array(
'PROFESSIONALN' => 1, 'PROFESSIONALN' => 1,
); );
$fancyEditionNames = array(
'CORE' => 'Windows 10 Home',
'CORECOUNTRYSPECIFIC' => 'Windows 10 Home China',
'COREN' => 'Windows 10 Home N',
'PROFESSIONAL' => 'Windows 10 Pro',
'PROFESSIONALN' => 'Windows 10 Pro N',
);
$skipNeutral = array(); $skipNeutral = array();
$skipLangPack = array(); $skipLangPack = array();
?> ?>

View File

@ -177,14 +177,6 @@ $editionPacks = array(
'PROFESSIONALN' => 1, 'PROFESSIONALN' => 1,
); );
$fancyEditionNames = array(
'CORE' => 'Windows 10 Home',
'CORECOUNTRYSPECIFIC' => 'Windows 10 Home China',
'COREN' => 'Windows 10 Home N',
'PROFESSIONAL' => 'Windows 10 Pro',
'PROFESSIONALN' => 'Windows 10 Pro N',
);
$skipNeutral = array(); $skipNeutral = array();
$skipLangPack = array(); $skipLangPack = array();
?> ?>

View File

@ -181,14 +181,6 @@ $editionPacks = array(
'PROFESSIONALN' => 1, 'PROFESSIONALN' => 1,
); );
$fancyEditionNames = array(
'CORE' => 'Windows 10 Home',
'CORECOUNTRYSPECIFIC' => 'Windows 10 Home China',
'COREN' => 'Windows 10 Home N',
'PROFESSIONAL' => 'Windows 10 Pro',
'PROFESSIONALN' => 'Windows 10 Pro N',
);
$skipNeutral = array(); $skipNeutral = array();
$skipLangPack = array(); $skipLangPack = array();
?> ?>

View File

@ -184,14 +184,6 @@ $editionPacks = array(
'PROFESSIONALN' => 1, 'PROFESSIONALN' => 1,
); );
$fancyEditionNames = array(
'CORE' => 'Windows 10 Home',
'CORECOUNTRYSPECIFIC' => 'Windows 10 Home China',
'COREN' => 'Windows 10 Home N',
'PROFESSIONAL' => 'Windows 10 Pro',
'PROFESSIONALN' => 'Windows 10 Pro N',
);
$skipNeutral = array(); $skipNeutral = array();
$skipLangPack = array(); $skipLangPack = array();
?> ?>

View File

@ -186,14 +186,7 @@ $editionPacks = array(
'PROFESSIONALN' => 1, 'PROFESSIONALN' => 1,
); );
$fancyEditionNames = array( $fancyEditionNames['CLOUDE'] = 'Windows 10 Lean';
'CLOUDE' => 'Windows 10 Lean',
'CORE' => 'Windows 10 Home',
'CORECOUNTRYSPECIFIC' => 'Windows 10 Home China',
'COREN' => 'Windows 10 Home N',
'PROFESSIONAL' => 'Windows 10 Pro',
'PROFESSIONALN' => 'Windows 10 Pro N',
);
$skipNeutral = array( $skipNeutral = array(
'CLOUDE' => 1, 'CLOUDE' => 1,

View File

@ -179,6 +179,8 @@ $packsForLangs = array(
'zh-tw' => array(0, 6), 'zh-tw' => array(0, 6),
); );
$packsForLangs = array();
$editionPacks = array( $editionPacks = array(
'CLOUDE' => 0, 'CLOUDE' => 0,
'CORE' => 0, 'CORE' => 0,
@ -188,14 +190,7 @@ $editionPacks = array(
'PROFESSIONALN' => 1, 'PROFESSIONALN' => 1,
); );
$fancyEditionNames = array( $fancyEditionNames['CLOUDE'] = 'Windows 10 Lean';
'CLOUDE' => 'Windows 10 Lean',
'CORE' => 'Windows 10 Home',
'CORECOUNTRYSPECIFIC' => 'Windows 10 Home China',
'COREN' => 'Windows 10 Home N',
'PROFESSIONAL' => 'Windows 10 Pro',
'PROFESSIONALN' => 'Windows 10 Pro N',
);
$skipNeutral = array( $skipNeutral = array(
'CLOUDE' => 1, 'CLOUDE' => 1,

View File

@ -253,21 +253,6 @@ $editionPacks = array(
'PROFESSIONALN' => 1, 'PROFESSIONALN' => 1,
); );
$fancyEditionNames = array(
'CLOUD' => 'Windows 10 S',
'CLOUDN' => 'Windows 10 S N',
'CORE' => 'Windows 10 Home',
'CORECOUNTRYSPECIFIC' => 'Windows 10 Home China',
'COREN' => 'Windows 10 Home N',
'CORESINGLELANGUAGE' => 'Windows 10 Home Single Language',
'EDUCATION' => 'Windows 10 Education',
'EDUCATIONN' => 'Windows 10 Education N',
'ENTERPRISE' => 'Windows 10 Enterprise',
'ENTERPRISEN' => 'Windows 10 Enterprise N',
'PROFESSIONAL' => 'Windows 10 Pro',
'PROFESSIONALN' => 'Windows 10 Pro N',
);
$skipNeutral = array(); $skipNeutral = array();
$skipLangPack = array(); $skipLangPack = array();
?> ?>

View File

@ -16,7 +16,7 @@ limitations under the License.
*/ */
// Composes DeviceAttributes parameter needed to fetch data // Composes DeviceAttributes parameter needed to fetch data
function composeDeviceAttributes($flight, $ring, $build, $arch) { function composeDeviceAttributes($flight, $ring, $build, $arch, $sku) {
$branch = branchFromBuild($build); $branch = branchFromBuild($build);
if($ring == 'RETAIL') { if($ring == 'RETAIL') {
@ -46,7 +46,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch) {
'OEMModel=Microsoft', 'OEMModel=Microsoft',
'OEMName_Uncleaned=Microsoft', 'OEMName_Uncleaned=Microsoft',
'OSArchitecture='.$arch, 'OSArchitecture='.$arch,
'OSSkuId=48', 'OSSkuId='.$sku,
'OSUILocale=en-US', 'OSUILocale=en-US',
'OSVersion='.$build, 'OSVersion='.$build,
'PonchAllow=1', 'PonchAllow=1',
@ -100,14 +100,15 @@ function composeFileGetRequest($updateId, $device, $info, $rev = 1) {
$info['flight'], $info['flight'],
$info['ring'], $info['ring'],
$info['checkBuild'], $info['checkBuild'],
$info['arch'] $info['arch'],
$info['sku']
); );
return '<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><a:Action s:mustUnderstand="1">http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetExtendedUpdateInfo2</a:Action><a:MessageID>urn:uuid:'.$uuid.'</a:MessageID><a:To s:mustUnderstand="1">https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured</a:To><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><Created>'.$created.'</Created><Expires>'.$expires.'</Expires></Timestamp><wuws:WindowsUpdateTicketsToken wsu:id="ClientMSA" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wuws="http://schemas.microsoft.com/msus/2014/10/WindowsUpdateAuthorization"><TicketType Name="MSA" Version="1.0" Policy="MBI_SSL"><Device>'.$device.'</Device></TicketType></wuws:WindowsUpdateTicketsToken></o:Security></s:Header><s:Body><GetExtendedUpdateInfo2 xmlns="http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService"><updateIDs><UpdateIdentity><UpdateID>'.$updateId.'</UpdateID><RevisionNumber>'.$rev.'</RevisionNumber></UpdateIdentity></updateIDs><infoTypes><XmlUpdateFragmentType>FileUrl</XmlUpdateFragmentType><XmlUpdateFragmentType>FileDecryption</XmlUpdateFragmentType></infoTypes><deviceAttributes>'.$deviceAttributes.'</deviceAttributes></GetExtendedUpdateInfo2></s:Body></s:Envelope>'; return '<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><a:Action s:mustUnderstand="1">http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetExtendedUpdateInfo2</a:Action><a:MessageID>urn:uuid:'.$uuid.'</a:MessageID><a:To s:mustUnderstand="1">https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured</a:To><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><Created>'.$created.'</Created><Expires>'.$expires.'</Expires></Timestamp><wuws:WindowsUpdateTicketsToken wsu:id="ClientMSA" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wuws="http://schemas.microsoft.com/msus/2014/10/WindowsUpdateAuthorization"><TicketType Name="MSA" Version="1.0" Policy="MBI_SSL"><Device>'.$device.'</Device></TicketType></wuws:WindowsUpdateTicketsToken></o:Security></s:Header><s:Body><GetExtendedUpdateInfo2 xmlns="http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService"><updateIDs><UpdateIdentity><UpdateID>'.$updateId.'</UpdateID><RevisionNumber>'.$rev.'</RevisionNumber></UpdateIdentity></updateIDs><infoTypes><XmlUpdateFragmentType>FileUrl</XmlUpdateFragmentType><XmlUpdateFragmentType>FileDecryption</XmlUpdateFragmentType></infoTypes><deviceAttributes>'.$deviceAttributes.'</deviceAttributes></GetExtendedUpdateInfo2></s:Body></s:Envelope>';
} }
// Composes POST data for fetching the latest update information from Windows Update // Composes POST data for fetching the latest update information from Windows Update
function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build) { function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build, $sku = 48) {
$uuid = randStr(8).'-'.randStr(4).'-'.randStr(4).'-'.randStr(4).'-'.randStr(12); $uuid = randStr(8).'-'.randStr(4).'-'.randStr(4).'-'.randStr(4).'-'.randStr(12);
$createdTime = time(); $createdTime = time();
@ -138,7 +139,8 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build
$flight, $flight,
$ring, $ring,
$build, $build,
$arch $arch,
$sku
); );
return '<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><a:Action s:mustUnderstand="1">http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/SyncUpdates</a:Action><a:MessageID>urn:uuid:'.$uuid.'</a:MessageID><a:To s:mustUnderstand="1">https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx</a:To><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><Created>'.$created.'</Created><Expires>'.$expires.'</Expires></Timestamp><wuws:WindowsUpdateTicketsToken wsu:id="ClientMSA" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wuws="http://schemas.microsoft.com/msus/2014/10/WindowsUpdateAuthorization"><TicketType Name="MSA" Version="1.0" Policy="MBI_SSL"><Device>'.$device.'</Device></TicketType></wuws:WindowsUpdateTicketsToken></o:Security></s:Header><s:Body><SyncUpdates xmlns="http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService"><cookie><Expiration>2045-04-07T12:38:34Z</Expiration><EncryptedData>'.$encData.'</EncryptedData></cookie><parameters><ExpressQuery>false</ExpressQuery><InstalledNonLeafUpdateIDs></InstalledNonLeafUpdateIDs><OtherCachedUpdateIDs></OtherCachedUpdateIDs><SkipSoftwareSync>false</SkipSoftwareSync><NeedTwoGroupOutOfScopeUpdates>true</NeedTwoGroupOutOfScopeUpdates><AlsoPerformRegularSync>true</AlsoPerformRegularSync><ComputerSpec/><ExtendedUpdateInfoParameters><XmlUpdateFragmentTypes><XmlUpdateFragmentType>Extended</XmlUpdateFragmentType><XmlUpdateFragmentType>LocalizedProperties</XmlUpdateFragmentType><XmlUpdateFragmentType>Eula</XmlUpdateFragmentType></XmlUpdateFragmentTypes><Locales><string>en-US</string></Locales></ExtendedUpdateInfoParameters><ClientPreferredLanguages></ClientPreferredLanguages><ProductsParameters><SyncCurrentVersionOnly>false</SyncCurrentVersionOnly><DeviceAttributes>'.$deviceAttributes.'</DeviceAttributes><CallerAttributes>'.$callerAttrib.'</CallerAttributes><Products>'.$products.'</Products></ProductsParameters></parameters></SyncUpdates></s:Body></s:Envelope>'; return '<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><a:Action s:mustUnderstand="1">http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/SyncUpdates</a:Action><a:MessageID>urn:uuid:'.$uuid.'</a:MessageID><a:To s:mustUnderstand="1">https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx</a:To><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><Created>'.$created.'</Created><Expires>'.$expires.'</Expires></Timestamp><wuws:WindowsUpdateTicketsToken wsu:id="ClientMSA" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wuws="http://schemas.microsoft.com/msus/2014/10/WindowsUpdateAuthorization"><TicketType Name="MSA" Version="1.0" Policy="MBI_SSL"><Device>'.$device.'</Device></TicketType></wuws:WindowsUpdateTicketsToken></o:Security></s:Header><s:Body><SyncUpdates xmlns="http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService"><cookie><Expiration>2045-04-07T12:38:34Z</Expiration><EncryptedData>'.$encData.'</EncryptedData></cookie><parameters><ExpressQuery>false</ExpressQuery><InstalledNonLeafUpdateIDs></InstalledNonLeafUpdateIDs><OtherCachedUpdateIDs></OtherCachedUpdateIDs><SkipSoftwareSync>false</SkipSoftwareSync><NeedTwoGroupOutOfScopeUpdates>true</NeedTwoGroupOutOfScopeUpdates><AlsoPerformRegularSync>true</AlsoPerformRegularSync><ComputerSpec/><ExtendedUpdateInfoParameters><XmlUpdateFragmentTypes><XmlUpdateFragmentType>Extended</XmlUpdateFragmentType><XmlUpdateFragmentType>LocalizedProperties</XmlUpdateFragmentType><XmlUpdateFragmentType>Eula</XmlUpdateFragmentType></XmlUpdateFragmentTypes><Locales><string>en-US</string></Locales></ExtendedUpdateInfoParameters><ClientPreferredLanguages></ClientPreferredLanguages><ProductsParameters><SyncCurrentVersionOnly>false</SyncCurrentVersionOnly><DeviceAttributes>'.$deviceAttributes.'</DeviceAttributes><CallerAttributes>'.$callerAttrib.'</CallerAttributes><Products>'.$products.'</Products></ProductsParameters></parameters></SyncUpdates></s:Body></s:Envelope>';