Compare commits
41 Commits
1fc14b6fd4
...
master
Author | SHA1 | Date | |
---|---|---|---|
37cefa11c6 | |||
862d157672 | |||
e433df62cf | |||
1933521e0d | |||
7b3cd4eb10 | |||
c1f00cecbd | |||
8b576e4496 | |||
21b1500490 | |||
fb2c89b2f8 | |||
846feb2629 | |||
5e31a6f724 | |||
faa3b7fa45 | |||
42b1091c0b | |||
aa2dbd2938 | |||
42c1c12405 | |||
092e968f0c | |||
d58f53de42 | |||
ca81835609 | |||
d10e24cf5b | |||
140613f657 | |||
4694c8dc00 | |||
0477fd5fa6 | |||
1ef84cb879 | |||
9e618c405a | |||
7711645f23 | |||
d597a83422 | |||
d0bad95c11 | |||
2a57ae0fe6 | |||
7bdc01bdb9 | |||
b13403cf59 | |||
5777ff09b6 | |||
954547ea84 | |||
db1e155c8d | |||
543e4c52e4 | |||
3855dc9ac4 | |||
8959eb14a4 | |||
ada8ae6011 | |||
492fd22e46 | |||
03258c7bfe | |||
c7512dd40d | |||
b1d8121507 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
||||
shared/cookie.json
|
169
fetchupd.php
169
fetchupd.php
@ -21,6 +21,90 @@ require_once dirname(__FILE__).'/shared/cache.php';
|
||||
require_once dirname(__FILE__).'/shared/fileinfo.php';
|
||||
require_once dirname(__FILE__).'/listid.php';
|
||||
|
||||
function uupApiPrivateParseFlags($str) {
|
||||
$split = explode('+', $str);
|
||||
$flagsSafe = [];
|
||||
|
||||
if(isset($split[1])) {
|
||||
$flags = array_unique(explode(',', strtolower($split[1])));
|
||||
$flagsSafe = array_intersect(getAllowedFlags(), $flags);
|
||||
}
|
||||
|
||||
return [$split[0], $flagsSafe];
|
||||
}
|
||||
|
||||
function uupApiPrivateGetLatestBuild() {
|
||||
$builds = array('22000.1');
|
||||
|
||||
$ids = uupListIds();
|
||||
if(isset($ids['error'])) {
|
||||
$ids['builds'] = array();
|
||||
}
|
||||
|
||||
if(empty($ids['builds'])) {
|
||||
$build = $builds[0];
|
||||
} else {
|
||||
$build = $ids['builds'][0]['build'];
|
||||
}
|
||||
|
||||
return $build;
|
||||
}
|
||||
|
||||
function uupApiPrivateIsAcceptableBranch($branch) {
|
||||
if(!uupApiConfigIsTrue('production_mode')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$branches = [
|
||||
'auto',
|
||||
'rs2_release',
|
||||
'rs3_release',
|
||||
'rs4_release',
|
||||
'rs5_release',
|
||||
'rs5_release_svc_hci',
|
||||
'19h1_release',
|
||||
'vb_release',
|
||||
'fe_release_10x',
|
||||
'fe_release',
|
||||
'co_release',
|
||||
'ni_release',
|
||||
'zn_release',
|
||||
'ge_release',
|
||||
'ge_prerelease',
|
||||
'rs_prerelease',
|
||||
];
|
||||
|
||||
return in_array($branch, $branches);
|
||||
}
|
||||
|
||||
function uupApiPrivateNormalizeFetchParams($params) {
|
||||
$np = array_replace([
|
||||
'arch' => 'amd64',
|
||||
'ring' => 'WIF',
|
||||
'flight' => 'Active',
|
||||
'branch' => 'ge_release',
|
||||
'build' => 'latest',
|
||||
'minor' => 0,
|
||||
'sku' => 48,
|
||||
'type' => 'Production',
|
||||
'flags' => [],
|
||||
], $params);
|
||||
|
||||
if(!is_array($np['flags'])) $np['flags'] = [];
|
||||
|
||||
$np['arch'] = strtolower($np['arch']);
|
||||
$np['ring'] = strtoupper($np['ring']);
|
||||
$np['flight'] = ucwords(strtolower($np['flight']));
|
||||
$np['branch'] = strtolower($np['branch']);
|
||||
$np['build'] = strtolower($np['build']);
|
||||
$np['minor'] = intval($np['minor']);
|
||||
$np['sku'] = intval($np['sku']);
|
||||
$np['type'] = ucwords(strtolower($np['type']));
|
||||
$np['flags'] = array_map('strtolower', $np['flags']);
|
||||
|
||||
return $np;
|
||||
}
|
||||
|
||||
function uupFetchUpd(
|
||||
$arch = 'amd64',
|
||||
$ring = 'WIF',
|
||||
@ -31,35 +115,52 @@ function uupFetchUpd(
|
||||
$type = 'Production',
|
||||
$cacheRequests = 0
|
||||
) {
|
||||
uupApiPrintBrand();
|
||||
[$build, $flags] = uupApiPrivateParseFlags($build);
|
||||
|
||||
$arch = strtolower($arch);
|
||||
$ring = strtoupper($ring);
|
||||
$flight = ucwords(strtolower($flight));
|
||||
$flight = 'Active';
|
||||
$params = [
|
||||
'arch' => $arch,
|
||||
'ring' => $ring,
|
||||
'flight' => $flight,
|
||||
'build' => $build,
|
||||
'minor' => $minor,
|
||||
'sku' => $sku,
|
||||
'type' => $type,
|
||||
'flags' => $flags,
|
||||
];
|
||||
|
||||
if($build == 'latest' || (!$build)) {
|
||||
$builds = array('17134.1');
|
||||
|
||||
$ids = uupListIds();
|
||||
if(isset($ids['error'])) {
|
||||
$ids['builds'] = array();
|
||||
return uupFetchUpd2($params, $cacheRequests);
|
||||
}
|
||||
|
||||
$build = $ids['builds'][0]['build'];
|
||||
unset($builds, $ids);
|
||||
function uupFetchUpd2($params, $cacheRequests = 0) {
|
||||
uupApiPrintBrand();
|
||||
|
||||
$np = uupApiPrivateNormalizeFetchParams($params);
|
||||
|
||||
$arch = $np['arch'];
|
||||
$ring = $np['ring'];
|
||||
$flight = 'Active';
|
||||
$branch = $np['branch'];
|
||||
$build = $np['build'];
|
||||
$minor = $np['minor'];
|
||||
$sku = $np['sku'];
|
||||
$type = $np['type'];
|
||||
$flags = $np['flags'];
|
||||
|
||||
$flagsStr = implode(',', $flags);
|
||||
|
||||
if(strtolower($build) == 'latest' || (!$build)) {
|
||||
$build = uupApiPrivateGetLatestBuild();
|
||||
}
|
||||
|
||||
$build = explode('.', $build);
|
||||
if(isset($build[1])) $minor = intval($build[1]);
|
||||
$build = intval($build[0]);
|
||||
$sku = intval($sku);
|
||||
|
||||
if(!($arch == 'amd64' || $arch == 'x86' || $arch == 'arm64' || $arch == 'arm' || $arch == 'all')) {
|
||||
return array('error' => 'UNKNOWN_ARCH');
|
||||
}
|
||||
|
||||
if(!($ring == 'DEV' || $ring == 'BETA' || $ring == 'RELEASEPREVIEW' || $ring == 'WIF' || $ring == 'WIS' || $ring == 'RP' || $ring == 'RETAIL' || $ring == 'MSIT')) {
|
||||
if(!($ring == 'CANARY' || $ring == 'DEV' || $ring == 'BETA' || $ring == 'RELEASEPREVIEW' || $ring == 'WIF' || $ring == 'WIS' || $ring == 'RP' || $ring == 'RETAIL' || $ring == 'MSIT')) {
|
||||
return array('error' => 'UNKNOWN_RING');
|
||||
}
|
||||
|
||||
@ -79,6 +180,9 @@ function uupFetchUpd(
|
||||
return array('error' => 'ILLEGAL_MINOR');
|
||||
}
|
||||
|
||||
if(!uupApiPrivateIsAcceptableBranch($branch))
|
||||
$branch = 'auto';
|
||||
|
||||
if($ring == 'DEV') $ring = 'WIF';
|
||||
if($ring == 'BETA') $ring = 'WIS';
|
||||
if($ring == 'RELEASEPREVIEW') $ring = 'RP';
|
||||
@ -92,16 +196,20 @@ function uupFetchUpd(
|
||||
$type = 'Production';
|
||||
}
|
||||
|
||||
$res = "api-fetch-$arch-$ring-$flight-$build-$minor-$sku-$type";
|
||||
$res = "api-fetch-$arch-$ring-$flight-$branch-$build-$flagsStr-$minor-$sku-$type";
|
||||
$cache = new UupDumpCache($res);
|
||||
$fromCache = $cache->get();
|
||||
if($fromCache !== false) return $fromCache;
|
||||
|
||||
consoleLogger('Fetching information from the server...');
|
||||
$postData = composeFetchUpdRequest(uupDevice(), uupEncryptedData(), $arch, $flight, $ring, $build, $sku, $type);
|
||||
$out = sendWuPostRequest('https://fe3cr.delivery.mp.microsoft.com/ClientWebService/client.asmx', $postData);
|
||||
$composerArgs = [$arch, $flight, $ring, $build, $sku, $type, $flags, $branch];
|
||||
$out = sendWuPostRequestHelper('client', 'composeFetchUpdRequest', $composerArgs);
|
||||
if($out === false || $out['error'] != 200) {
|
||||
consoleLogger('The request has failed');
|
||||
return array('error' => 'WU_REQUEST_FAILED');
|
||||
}
|
||||
|
||||
$out = html_entity_decode($out);
|
||||
$out = html_entity_decode($out['out']);
|
||||
consoleLogger('Information has been successfully fetched.');
|
||||
|
||||
preg_match_all('/<UpdateInfo>.*?<\/UpdateInfo>/', $out, $updateInfos);
|
||||
@ -122,7 +230,7 @@ function uupFetchUpd(
|
||||
$num++;
|
||||
consoleLogger("Checking build information for update {$num} of {$updatesNum}...");
|
||||
|
||||
$info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build, $sku, $type);
|
||||
$info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build, $sku, $type, $flags, $branch);
|
||||
if(isset($info['error'])) {
|
||||
$errorCount++;
|
||||
continue;
|
||||
@ -152,7 +260,7 @@ function uupFetchUpd(
|
||||
return $data;
|
||||
}
|
||||
|
||||
function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku, $type) {
|
||||
function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku, $type, $flags, $branch) {
|
||||
$updateNumId = preg_replace('/<UpdateInfo><ID>|<\/ID>.*/i', '', $updateInfo);
|
||||
|
||||
$updates = preg_replace('/<Update>/', "\n<Update>", $out);
|
||||
@ -194,6 +302,15 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
|
||||
$foundBuild = @$info[3];
|
||||
}
|
||||
|
||||
$isNet = 0;
|
||||
if(strpos($foundArch, 'netfx') !== false) {
|
||||
$isNet = 1;
|
||||
preg_match('/ProductReleaseInstalled Name\=".*\.(.*?)\.(.*?)" Version\=".*\.\d{5}\.(.*?)"/', $updateInfo, $info);
|
||||
$foundType = @strtolower($info[1]);
|
||||
$foundArch = @strtolower($info[2]);
|
||||
$foundBuild = @$info[3];
|
||||
}
|
||||
|
||||
$updateTitle = preg_grep('/<Title>.*<\/Title>/', $updateMeta);
|
||||
sort($updateTitle);
|
||||
|
||||
@ -213,8 +330,12 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
|
||||
$isCumulativeUpdate = 0;
|
||||
if(preg_match('/\d{4}-\d{2}.+Update|Cumulative Update|Microsoft Edge|Windows Feature Experience Pack|Cumulative security Hotpatch/i', $updateTitle)) {
|
||||
$isCumulativeUpdate = 1;
|
||||
if($isNet) {
|
||||
$updateTitle = preg_replace("/3.5 and 4.8.1 |3.5 and 4.8 | for $foundArch| for x64| \(KB.*?\)/i", '', $updateTitle);
|
||||
} else {
|
||||
$updateTitle = preg_replace('/ for .{3,5}-based systems| \(KB.*?\)/i', '', $updateTitle);
|
||||
}
|
||||
}
|
||||
|
||||
$updateTitle = preg_replace("/ ?\d{4}-\d{2}\D ?| ?$foundArch ?| ?x64 ?/i", '', $updateTitle);
|
||||
|
||||
@ -330,7 +451,9 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
|
||||
$temp['title'] = $updateTitle;
|
||||
$temp['ring'] = $ring;
|
||||
$temp['flight'] = $flight;
|
||||
$temp['branch'] = $branch;
|
||||
$temp['arch'] = $foundArch;
|
||||
$temp['fetchArch'] = $arch == 'all' ? 'amd64' : $arch;
|
||||
$temp['build'] = $foundBuild;
|
||||
$temp['checkBuild'] = $build;
|
||||
$temp['sku'] = $sku;
|
||||
@ -343,6 +466,10 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
|
||||
$temp['releasetype'] = $type;
|
||||
}
|
||||
|
||||
if(!empty($flags)) {
|
||||
$temp['flags'] = $flags;
|
||||
}
|
||||
|
||||
$temp['created'] = time();
|
||||
$temp['sha256ready'] = true;
|
||||
$temp['files'] = $shaArray;
|
||||
|
54
get.php
54
get.php
@ -48,7 +48,7 @@ function uupGetFiles(
|
||||
}
|
||||
|
||||
$edition = is_array($desiredEdition) ? implode('_', $desiredEdition) : $desiredEdition;
|
||||
$res = "api-get-${updateId}_${usePack}_${edition}_${requestType}";
|
||||
$res = "api-get-{$updateId}_{$usePack}_{$edition}_{$requestType}";
|
||||
$cache = new UupDumpCache($res);
|
||||
$fromCache = $cache->get();
|
||||
if($fromCache !== false) return $fromCache;
|
||||
@ -76,8 +76,10 @@ function uupGetFiles(
|
||||
$info['sku'] = 48;
|
||||
}
|
||||
|
||||
$genPack = [];
|
||||
|
||||
if($usePack) {
|
||||
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
|
||||
$genPack = uupApiGetPacks($updateId);
|
||||
if(empty($genPack)) return array('error' => 'UNSUPPORTED_COMBINATION');
|
||||
|
||||
if(!isset($genPack[$usePack])) {
|
||||
@ -113,14 +115,18 @@ function uupGetFiles(
|
||||
case 'UPDATEONLY': break;
|
||||
|
||||
case 'APP': $appEdition = 1;
|
||||
case 'APP_MOMENT': $appEdition = 1;
|
||||
|
||||
default:
|
||||
if(!isset($genPack[$usePack][$desiredEdition])) {
|
||||
return array('error' => 'UNSUPPORTED_COMBINATION');
|
||||
}
|
||||
|
||||
$filesPacksList = $genPack[$usePack][$desiredEdition];
|
||||
$fileListSource = 'GENERATEDPACKS';
|
||||
$filesPacksList = $genPack[$usePack][$desiredEdition];
|
||||
if($desiredEdition == 'APP' && isset($genPack[$usePack]['APP_MOMENT'])) {
|
||||
$filesPacksList = array_merge($filesPacksList, $genPack[$usePack]['APP_MOMENT']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -133,6 +139,7 @@ function uupGetFiles(
|
||||
return array('error' => 'UNSUPPORTED_COMBINATION');
|
||||
}
|
||||
|
||||
if($edition == 'APP' || $edition == 'APP_MOMENT') $appEdition = 1;
|
||||
$filesPacksList = array_merge($filesPacksList, $genPack[$usePack][$edition]);
|
||||
}
|
||||
}
|
||||
@ -175,16 +182,34 @@ function uupGetFiles(
|
||||
if(isset($filesInfoList[$val])) unset($filesInfoList[$val]);
|
||||
}
|
||||
|
||||
$baseless = preg_grep('/^baseless_|Windows(10|11)\.0-KB.*-EXPRESS|SSU-.*-EXPRESS/i', array_keys($filesInfoList));
|
||||
$baseless = preg_grep('/^baseless_/i', array_keys($filesInfoList));
|
||||
foreach($baseless as $val) {
|
||||
if(isset($filesInfoList[$val])) unset($filesInfoList[$val]);
|
||||
}
|
||||
|
||||
$expresscab = preg_grep('/Windows(10|11)\.0-KB.*-EXPRESS|SSU-.*-EXPRESS/i', array_keys($filesInfoList));
|
||||
|
||||
$expresspsf = array();
|
||||
foreach($expresscab as $val) {
|
||||
$name = preg_replace('/-EXPRESS.cab$/i', '', $val);
|
||||
$expresspsf[] = $name;
|
||||
if(isset($filesInfoList[$val])) unset($filesInfoList[$val]);
|
||||
}
|
||||
unset($index, $name, $expresscab);
|
||||
|
||||
foreach($expresspsf as $val) {
|
||||
if(isset($filesInfoList[$val.'.cab'])) {
|
||||
if(isset($filesInfoList[$val.'.psf'])) unset($filesInfoList[$val.'.psf']);
|
||||
}
|
||||
}
|
||||
unset($expresspsf);
|
||||
|
||||
$psf = array_keys($filesInfoList);
|
||||
$psf = preg_grep('/\.psf$/i', $psf);
|
||||
|
||||
$psfk = preg_grep('/Windows(10|11)\.0-KB.*/i', $psf);
|
||||
$psfk = preg_grep('/.*-EXPRESS/i', $psfk, PREG_GREP_INVERT);
|
||||
if($build < 17763) $psfk = preg_grep('/Windows(10|11)\.0-KB.*_\d\.psf$/i', $psfk, PREG_GREP_INVERT);
|
||||
foreach($psfk as $key => $val) {
|
||||
if(isset($psf[$key])) unset($psf[$key]);
|
||||
}
|
||||
@ -227,7 +252,7 @@ function uupGetFiles(
|
||||
switch($fileListSource) {
|
||||
case 'UPDATEONLY':
|
||||
$skipPackBuild = 1;
|
||||
$removeFiles = preg_grep('/Windows(10|11)\.0-KB.*-EXPRESS|Windows(10|11)\.0-KB.*-baseless|SSU-.*-.{3,5}-EXPRESS/i', $filesInfoKeys);
|
||||
$removeFiles = preg_grep('/Windows(10|11)\.0-KB.*-baseless/i', $filesInfoKeys);
|
||||
|
||||
foreach($removeFiles as $val) {
|
||||
if(isset($filesInfoList[$val])) unset($filesInfoList[$val]);
|
||||
@ -273,9 +298,9 @@ function uupGetFiles(
|
||||
unset($removeMSUs);
|
||||
$filesInfoKeys = array_keys($filesInfoList);
|
||||
|
||||
$temp = preg_grep('/Windows(10|11)\.0-KB.*-EXPRESS|Windows(10|11)\.0-KB.*-baseless|SSU-.*-.{3,5}-EXPRESS/i', $filesInfoKeys, PREG_GREP_INVERT);
|
||||
$temp = preg_grep('/Windows(10|11)\.0-KB.*-baseless/i', $filesInfoKeys, PREG_GREP_INVERT);
|
||||
if($appEdition) {
|
||||
$temp = preg_grep('/.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp);
|
||||
$temp = preg_grep('/.*?AggregatedMetadata.*?\.cab/i', $temp);
|
||||
} else if($build > 21380) {
|
||||
$temp = preg_grep('/Windows(10|11)\.0-KB|SSU-.*?\....$|.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp);
|
||||
} else {
|
||||
@ -349,6 +374,7 @@ function uupGetFiles(
|
||||
'build' => $updateBuild,
|
||||
'sku' => $updateSku,
|
||||
'hasUpdates' => $hasUpdates,
|
||||
'appxPresent' => uupAreAppxPresent($genPack),
|
||||
'files' => $files,
|
||||
];
|
||||
|
||||
@ -361,7 +387,7 @@ function uupGetFiles(
|
||||
}
|
||||
|
||||
function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests, $type) {
|
||||
$res = "api-get-online-${updateId}_rev.$rev";
|
||||
$res = "api-get-online-{$updateId}_rev.$rev";
|
||||
$cache = new UupDumpCache($res);
|
||||
$fromCache = $cache->get();
|
||||
$cached = ($fromCache !== false);
|
||||
@ -372,8 +398,16 @@ function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests, $type) {
|
||||
} else {
|
||||
$fetchTime = time();
|
||||
consoleLogger('Fetching information from the server...');
|
||||
$postData = composeFileGetRequest($updateId, uupDevice(), $info, $rev, $type);
|
||||
$out = sendWuPostRequest('https://fe3cr.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', $postData);
|
||||
|
||||
$composerArgs = [$updateId, $info, $rev, $type];
|
||||
$out = sendWuPostRequestHelper('clientSecured', 'composeFileGetRequest', $composerArgs);
|
||||
|
||||
if($out === false || $out['error'] != 200) {
|
||||
consoleLogger('The request has failed');
|
||||
return array('error' => 'WU_REQUEST_FAILED');
|
||||
}
|
||||
|
||||
$out = $out['out'];
|
||||
consoleLogger('Information has been successfully fetched.');
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright 2022 UUP dump API authors
|
||||
Copyright 2023 UUP dump API authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -17,60 +17,35 @@ limitations under the License.
|
||||
|
||||
require_once dirname(__FILE__).'/shared/main.php';
|
||||
require_once dirname(__FILE__).'/shared/packs.php';
|
||||
require_once dirname(__FILE__).'/updateinfo.php';
|
||||
|
||||
function uupListEditions($lang = 'en-us', $updateId = 0) {
|
||||
if($updateId) {
|
||||
$info = uupUpdateInfo($updateId, false, true);
|
||||
}
|
||||
|
||||
if(!$lang) {
|
||||
return array('error' => 'UNSUPPORTED_LANG');
|
||||
}
|
||||
|
||||
if(isset($info['info'])) $info = $info['info'];
|
||||
|
||||
if(isset($info['build'])) {
|
||||
$build = explode('.', $info['build']);
|
||||
$build = $build[0];
|
||||
} else {
|
||||
$build = 15063;
|
||||
}
|
||||
|
||||
if(!isset($info['arch'])) {
|
||||
$info['arch'] = null;
|
||||
}
|
||||
|
||||
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
|
||||
$fancyTexts = uupGetInfoTexts();
|
||||
$fancyEditionNames = $fancyTexts['fancyEditionNames'];
|
||||
|
||||
if($lang) {
|
||||
$lang = strtolower($lang);
|
||||
$genPack = uupApiGetPacks($updateId);
|
||||
$fancyEditionNames = uupGetInfoTexts()['fancyEditionNames'];
|
||||
|
||||
if(!isset($genPack[$lang])) {
|
||||
return array('error' => 'UNSUPPORTED_LANG');
|
||||
}
|
||||
}
|
||||
|
||||
$editionList = array();
|
||||
$editionListFancy = array();
|
||||
$editionList = [];
|
||||
$editionListFancy = [];
|
||||
|
||||
foreach(array_keys($genPack[$lang]) as $edition) {
|
||||
if($edition == 'LXP') continue;
|
||||
if($edition == 'FOD') continue;
|
||||
if(in_array($edition, ['LXP', 'FOD'])) continue;
|
||||
|
||||
if(isset($fancyEditionNames[$edition])) {
|
||||
$fancyName = $fancyEditionNames[$edition];
|
||||
} else {
|
||||
$fancyName = $edition;
|
||||
}
|
||||
$fancyName = isset($fancyEditionNames[$edition]) ? $fancyEditionNames[$edition] : $edition;
|
||||
|
||||
$editionList[] = $edition;
|
||||
$editionListFancy[$edition] = $fancyName;
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
'apiVersion' => uupApiVersion(),
|
||||
'editionList' => $editionList,
|
||||
'editionFancyNames' => $editionListFancy,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ function uupListIds($search = null, $sortByDate = 0) {
|
||||
$cache->put($builds, 60);
|
||||
}
|
||||
|
||||
if($search != null) {
|
||||
if(count($builds) && $search != null) {
|
||||
if(!preg_match('/^regex:/', $search)) {
|
||||
$searchSafe = preg_quote($search, '/');
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright 2022 UUP dump API authors
|
||||
Copyright 2023 UUP dump API authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -19,63 +19,45 @@ require_once dirname(__FILE__).'/shared/main.php';
|
||||
require_once dirname(__FILE__).'/shared/packs.php';
|
||||
require_once dirname(__FILE__).'/updateinfo.php';
|
||||
|
||||
function uupListLangs($updateId = 0) {
|
||||
if($updateId) {
|
||||
$info = uupUpdateInfo($updateId, false, true);
|
||||
}
|
||||
function uupListLangsInternal($updateId) {
|
||||
$genPack = uupApiGetPacks($updateId);
|
||||
$fancyLangNames = uupGetInfoTexts()['fancyLangNames'];
|
||||
|
||||
if(isset($info['info'])) {
|
||||
$info = $info['info'];
|
||||
unset($info['files']);
|
||||
}
|
||||
$langList = [];
|
||||
$langListFancy = [];
|
||||
|
||||
if(isset($info['build'])) {
|
||||
$build = explode('.', $info['build']);
|
||||
$build = $build[0];
|
||||
} else {
|
||||
$build = 15063;
|
||||
}
|
||||
|
||||
if(!isset($info['arch'])) {
|
||||
$info['arch'] = null;
|
||||
}
|
||||
|
||||
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
|
||||
$fancyTexts = uupGetInfoTexts();
|
||||
$fancyLangNames = $fancyTexts['fancyLangNames'];
|
||||
|
||||
$langList = array();
|
||||
$langListFancy = array();
|
||||
foreach($genPack as $key => $val) {
|
||||
if(!count(array_diff(array_keys($val), array('LXP')))) {
|
||||
continue;
|
||||
}
|
||||
if(!count(array_diff(array_keys($val), array('FOD')))) {
|
||||
if(!count(array_diff(array_keys($val), ['LXP', 'FOD']))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(isset($fancyLangNames[$key])) {
|
||||
$fancyName = $fancyLangNames[$key];
|
||||
} else {
|
||||
$fancyName = $key;
|
||||
}
|
||||
$fancyName = isset($fancyLangNames[$key]) ? $fancyLangNames[$key] : $key;
|
||||
|
||||
$langList[] = $key;
|
||||
$langListFancy[$key] = $fancyName;
|
||||
}
|
||||
|
||||
if(isset($info)) {
|
||||
return array(
|
||||
'apiVersion' => uupApiVersion(),
|
||||
return [
|
||||
'langList' => $langList,
|
||||
'langFancyNames' => $langListFancy,
|
||||
'updateInfo' => $info
|
||||
);
|
||||
} else {
|
||||
return array(
|
||||
'apiVersion' => uupApiVersion(),
|
||||
'langList' => $langList,
|
||||
'langFancyNames' => $langListFancy
|
||||
);
|
||||
'appxPresent' => uupAreAppxPresent($genPack),
|
||||
];
|
||||
}
|
||||
|
||||
function uupListLangs($updateId = 0, $returnInfo = true) {
|
||||
if($returnInfo) {
|
||||
$info = uupUpdateInfo($updateId, ignoreFiles: true);
|
||||
$info = isset($info['info']) ? $info['info'] : false;
|
||||
}
|
||||
|
||||
$langList = uupListLangsInternal($updateId);
|
||||
|
||||
$response = array_merge(
|
||||
['apiVersion' => uupApiVersion()],
|
||||
$langList
|
||||
);
|
||||
|
||||
if($returnInfo) $response['updateInfo'] = $info;
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
12
readme.md
12
readme.md
@ -10,7 +10,7 @@ Parameters:
|
||||
- **Supported values:** `amd64`, `x86`, `arm64`, `all`
|
||||
|
||||
- `ring` - Channel to use when fetching information (Previously called Ring)
|
||||
- **Supported values:** `Dev`, `Beta`, `ReleasePreview`, `Retail`
|
||||
- **Supported values:** `Canary`, `Dev`, `Beta`, `ReleasePreview`, `Retail`
|
||||
- **Supported Ring values :** `WIF`, `WIS`, `RP`
|
||||
|
||||
- `flight` - Content type to use when fetching information (Previously called Flight)
|
||||
@ -18,10 +18,10 @@ Parameters:
|
||||
- **Supported Flight values:** `Active`, `Skip`, `Current`
|
||||
- **NOTE:** `Skip` is for `WIF` ring only. `Current` is for `RP` ring only.
|
||||
|
||||
- `build` - Build number to use when fetching information
|
||||
- **Supported values:** >= 9841 and <= PHP_INT_MAX-1
|
||||
- `build` - Build number to use when fetching information. Can also be used to provide optional fetch flags in `major.minor+flag1,flag2` format.
|
||||
- **Supported values:** Any correctly formatted build (`major` or `major.minor`) from range of 9841 and `PHP_INT_MAX-1`.
|
||||
|
||||
- `minor` - Build minor to use when fetching information
|
||||
- `minor` - Build minor to use when fetching information. Unused when build is formatted in `major.minor` format
|
||||
- **Supported values:** >= 0 and <= PHP_INT_MAX-1
|
||||
|
||||
- `sku` - SKU number to use when fetching information
|
||||
@ -80,6 +80,8 @@ Outputs list of languages supported for specified Update ID.
|
||||
Parameters:
|
||||
- `updateId` - Update identifier (optional)
|
||||
- **Supported values:** any update UUID
|
||||
- `returnInfo` - Should the full update inforation be returned with a list of languages
|
||||
- **Supported values:** `true` or `false`
|
||||
|
||||
|
||||
#### updateinfo.php: `uupUpdateInfo($updateId, $onlyInfo, $ignoreFiles);`
|
||||
@ -132,6 +134,7 @@ Parameters:
|
||||
- ILLEGAL_MINOR
|
||||
- NO_UPDATE_FOUND
|
||||
- EMPTY_FILELIST
|
||||
- WU_REQUEST_FAILED
|
||||
|
||||
**get.php**
|
||||
- UNSUPPORTED_LANG
|
||||
@ -142,6 +145,7 @@ Parameters:
|
||||
- MISSING_FILES
|
||||
- NO_FILES
|
||||
- XML_PARSE_ERROR
|
||||
- WU_REQUEST_FAILED
|
||||
|
||||
**listeditions.php**
|
||||
- UNSUPPORTED_LANG
|
||||
|
@ -25,19 +25,46 @@ function uupDevice() {
|
||||
return base64_encode(chunk_split($data, 1, "\0"));
|
||||
}
|
||||
|
||||
function uupSaveCookieFromResponse($out) {
|
||||
$outDecoded = html_entity_decode($out);
|
||||
preg_match('/<NewCookie>.*?<\/NewCookie>|<GetCookieResult>.*?<\/GetCookieResult>/', $outDecoded, $cookieData);
|
||||
|
||||
if(empty($cookieData))
|
||||
return false;
|
||||
|
||||
preg_match('/<Expiration>.*<\/Expiration>/', $cookieData[0], $expirationDate);
|
||||
preg_match('/<EncryptedData>.*<\/EncryptedData>/', $cookieData[0], $encryptedData);
|
||||
|
||||
$expirationDate = preg_replace('/<Expiration>|<\/Expiration>/', '', $expirationDate[0]);
|
||||
$encryptedData = preg_replace('/<EncryptedData>|<\/EncryptedData>/', '', $encryptedData[0]);
|
||||
|
||||
$cookieData = array(
|
||||
'expirationDate' => $expirationDate,
|
||||
'encryptedData' => $encryptedData,
|
||||
);
|
||||
|
||||
$cookieStorage = new UupDumpCache('WuRequestCookie', false);
|
||||
$cookieStorage->put($cookieData, false);
|
||||
|
||||
return $cookieData;
|
||||
}
|
||||
|
||||
function uupInvalidateCookie() {
|
||||
$cookieStorage = new UupDumpCache('WuRequestCookie', false);
|
||||
$cookieInfo = $cookieStorage->delete();
|
||||
}
|
||||
|
||||
function uupEncryptedData() {
|
||||
$cookieInfo = @file_get_contents(dirname(__FILE__).'/cookie.json');
|
||||
$cookieInfo = json_decode($cookieInfo, 1);
|
||||
$cookieStorage = new UupDumpCache('WuRequestCookie', false);
|
||||
$cookieInfo = $cookieStorage->get();
|
||||
|
||||
if(empty($cookieInfo)) {
|
||||
$postData = composeGetCookieRequest(uupDevice());
|
||||
sendWuPostRequest('https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx', $postData);
|
||||
$data = sendWuPostRequestHelper('client', 'composeGetCookieRequest', [], false);
|
||||
if($data === false || $data['error'] != 200)
|
||||
return false;
|
||||
|
||||
$encData = uupEncryptedData();
|
||||
} else {
|
||||
$encData = $cookieInfo['encryptedData'];
|
||||
$cookieInfo = uupSaveCookieFromResponse($data['out']);
|
||||
}
|
||||
|
||||
return $encData;
|
||||
return $cookieInfo['encryptedData'];
|
||||
}
|
||||
?>
|
||||
|
@ -35,6 +35,10 @@ class UupDumpCache {
|
||||
}
|
||||
|
||||
public function get() {
|
||||
if(!uupApiConfigIsTrue('production_mode')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cacheFile = $this->cacheFile;
|
||||
|
||||
if(!file_exists($cacheFile)) {
|
||||
@ -58,6 +62,10 @@ class UupDumpCache {
|
||||
}
|
||||
|
||||
public function put($content, $validity) {
|
||||
if(!uupApiConfigIsTrue('production_mode')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cacheFile = $this->cacheFile;
|
||||
$expires = $validity ? time() + $validity : false;
|
||||
|
||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
function uupApiVersion() {
|
||||
return '1.39.3';
|
||||
return '1.49.0';
|
||||
}
|
||||
|
||||
require_once dirname(__FILE__).'/auths.php';
|
||||
|
@ -63,6 +63,7 @@ function uupGetInfoTexts() {
|
||||
|
||||
$fancyEditionNames = array(
|
||||
'APP' => 'Microsoft Store Inbox Apps',
|
||||
'APP_MOMENT' => 'Microsoft Store Moment Apps',
|
||||
'FOD' => 'Features on Demand (Capabilities)',
|
||||
'CLOUD' => 'Windows S',
|
||||
'CLOUDN' => 'Windows S N',
|
||||
@ -82,6 +83,7 @@ function uupGetInfoTexts() {
|
||||
'PPIPRO' => 'Windows Team',
|
||||
'PROFESSIONAL' => 'Windows Pro',
|
||||
'PROFESSIONALN' => 'Windows Pro N',
|
||||
'PROFESSIONALCOUNTRYSPECIFIC' => 'Windows Pro China Only',
|
||||
'SERVERSTANDARD' => 'Windows Server Standard',
|
||||
'SERVERSTANDARDCORE' => 'Windows Server Standard, Core',
|
||||
'SERVERDATACENTER' => 'Windows Server Datacenter',
|
||||
@ -201,7 +203,7 @@ function uupGetInfoTexts() {
|
||||
);
|
||||
}
|
||||
|
||||
function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
|
||||
function uupApiGetPacks($updateId) {
|
||||
if(empty($updateId)) return [];
|
||||
if(!file_exists('packs/'.$updateId.'.json.gz')) return [];
|
||||
|
||||
@ -211,3 +213,7 @@ function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
|
||||
$genPack = json_decode($genPack, 1);
|
||||
return $genPack;
|
||||
}
|
||||
|
||||
function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
|
||||
return uupApiGetPacks($updateId);
|
||||
}
|
||||
|
@ -16,8 +16,10 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// Composes DeviceAttributes parameter needed to fetch data
|
||||
function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
|
||||
function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $flags, $branch) {
|
||||
if($branch == 'auto')
|
||||
$branch = branchFromBuild($build);
|
||||
|
||||
$blockUpgrades = 0;
|
||||
$flightEnabled = 1;
|
||||
$isRetail = 0;
|
||||
@ -31,12 +33,14 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
|
||||
|
||||
$dvcFamily = 'Windows.Desktop';
|
||||
$insType = 'Client';
|
||||
$prodType = 'WinNT';
|
||||
if($sku == 119) {
|
||||
$dvcFamily = 'Windows.Team';
|
||||
}
|
||||
if(uupApiIsServer($sku)) {
|
||||
$dvcFamily = 'Windows.Server';
|
||||
$insType = 'Server';
|
||||
$prodType = 'ServerNT';
|
||||
$blockUpgrades = 1;
|
||||
}
|
||||
/*/ Hololens
|
||||
@ -50,12 +54,12 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
|
||||
$insType = 'FactoryOS';
|
||||
}
|
||||
|
||||
$fltBranch = '';
|
||||
$fltContent = 'Mainline';
|
||||
$fltRing = 'External';
|
||||
$flight = 'Active';
|
||||
|
||||
if($ring == 'RETAIL') {
|
||||
$fltBranch = '';
|
||||
$fltContent = $flight;
|
||||
$fltRing = 'Retail';
|
||||
$flightEnabled = 0;
|
||||
@ -94,6 +98,11 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
|
||||
$fltRing = 'Internal';
|
||||
}
|
||||
|
||||
if($ring == 'CANARY') {
|
||||
$fltBranch = 'CanaryChannel';
|
||||
$ring = 'WIF';
|
||||
}
|
||||
|
||||
$bldnum = explode('.', $build);
|
||||
$bldnum = $bldnum[2];
|
||||
|
||||
@ -107,14 +116,24 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
|
||||
$attrib = array(
|
||||
'App=WU_OS',
|
||||
'AppVer='.$build,
|
||||
'AttrDataVer=177',
|
||||
'AttrDataVer=281',
|
||||
'AllowInPlaceUpgrade=1',
|
||||
'AllowOptionalContent=1',
|
||||
'AllowUpgradesWithUnsupportedTPMOrCPU=1',
|
||||
'BlockFeatureUpdates='.$blockUpgrades,
|
||||
'BranchReadinessLevel=CB',
|
||||
'CIOptin=1',
|
||||
'CurrentBranch='.$branch,
|
||||
'DataExpDateEpoch_GE24H2='.(time()+82800),
|
||||
'DataExpDateEpoch_GE24H2Setup='.(time()+82800),
|
||||
'DataExpDateEpoch_CU23H2='.(time()+82800),
|
||||
'DataExpDateEpoch_CU23H2Setup='.(time()+82800),
|
||||
'DataExpDateEpoch_NI22H2='.(time()+82800),
|
||||
'DataExpDateEpoch_NI22H2Setup='.(time()+82800),
|
||||
'DataExpDateEpoch_CO21H2='.(time()+82800),
|
||||
'DataExpDateEpoch_CO21H2Setup='.(time()+82800),
|
||||
'DataExpDateEpoch_23H2='.(time()+82800),
|
||||
'DataExpDateEpoch_22H2='.(time()+82800),
|
||||
'DataExpDateEpoch_21H2='.(time()+82800),
|
||||
'DataExpDateEpoch_21H1='.(time()+82800),
|
||||
'DataExpDateEpoch_20H1='.(time()+82800),
|
||||
@ -122,14 +141,23 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
|
||||
'DataVer_RS5=2000000000',
|
||||
'DefaultUserRegion=191',
|
||||
'DeviceFamily='.$dvcFamily,
|
||||
'DeviceInfoGatherSuccessful=1',
|
||||
'EKB19H2InstallCount=1',
|
||||
'EKB19H2InstallTimeEpoch=1255000000',
|
||||
'FlightingBranchName='.$fltBranch,
|
||||
//'FlightContent='.$fltContent,
|
||||
'FlightRing='.$fltRing,
|
||||
'Free=gt64',
|
||||
'GStatus_GE24H2=2',
|
||||
'GStatus_GE24H2Setup=2',
|
||||
'GStatus_CU23H2=2',
|
||||
'GStatus_CU23H2Setup=2',
|
||||
'GStatus_NI23H2=2',
|
||||
'GStatus_NI22H2=2',
|
||||
'GStatus_NI22H2Setup=2',
|
||||
'GStatus_CO21H2=2',
|
||||
'GStatus_CO21H2Setup=2',
|
||||
'GStatus_22H2=2',
|
||||
'GStatus_21H2=2',
|
||||
'GStatus_21H1=2',
|
||||
'GStatus_20H1=2',
|
||||
@ -144,27 +172,38 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
|
||||
'IsDeviceRetailDemo=0',
|
||||
'IsFlightingEnabled='.$flightEnabled,
|
||||
'IsRetailOS='.$isRetail,
|
||||
'LCUVer=0.0.0.0',
|
||||
'MediaBranch=',
|
||||
'MediaVersion='.$build,
|
||||
'CloudPBR=1',
|
||||
'DUScan=1',
|
||||
'OEMModel=Asus ROG Maximus Z690 Extreme',
|
||||
'OEMModelBaseBoard=ROG MAXIMUS Z690 EXTREME',
|
||||
'OEMName_Uncleaned=ASUSTeK COMPUTER INC.',
|
||||
'OEMModel=21F6CTO1WW',
|
||||
'OEMModelBaseBoard=21F6CTO1WW',
|
||||
'OEMName_Uncleaned=LENOVO',
|
||||
'OemPartnerRing=UPSFlighting',
|
||||
'OSArchitecture='.$arch,
|
||||
'OSSkuId='.$sku,
|
||||
'OSUILocale=en-US',
|
||||
'OSVersion='.$build,
|
||||
'ProcessorIdentifier=Intel64 Family 6 Model 151 Stepping 2',
|
||||
'ProcessorIdentifier=Intel64 Family 6 Model 186 Stepping 3',
|
||||
'ProcessorManufacturer=GenuineIntel',
|
||||
'ProcessorModel=12th Gen Intel(R) Core(TM) i9-12900K',
|
||||
'ProcessorModel=13th Gen Intel(R) Core(TM) i7-1355U',
|
||||
'ProductType='.$prodType,
|
||||
'ReleaseType='.$type,
|
||||
'SdbVer_20H1=2000000000',
|
||||
'SdbVer_19H1=2000000000',
|
||||
'SecureBootCapable=1',
|
||||
'TelemetryLevel=3',
|
||||
'TimestampEpochString_GE24H2='.(time()-3600),
|
||||
'TimestampEpochString_GE24H2Setup='.(time()-3600),
|
||||
'TimestampEpochString_CU23H2='.(time()-3600),
|
||||
'TimestampEpochString_CU23H2Setup='.(time()-3600),
|
||||
'TimestampEpochString_NI23H2='.(time()-3600),
|
||||
'TimestampEpochString_NI22H2='.(time()-3600),
|
||||
'TimestampEpochString_NI22H2Setup='.(time()-3600),
|
||||
'TimestampEpochString_CO21H2='.(time()-3600),
|
||||
'TimestampEpochString_CO21H2Setup='.(time()-3600),
|
||||
'TimestampEpochString_22H2='.(time()-3600),
|
||||
'TimestampEpochString_21H2='.(time()-3600),
|
||||
'TimestampEpochString_21H1='.(time()-3600),
|
||||
'TimestampEpochString_20H1='.(time()-3600),
|
||||
@ -172,19 +211,32 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
|
||||
'TPMVersion=2',
|
||||
'UpdateManagementGroup=2',
|
||||
'UpdateOfferedDays=0',
|
||||
'UpgEx_GE24H2Setup=Green',
|
||||
'UpgEx_GE24H2=Green',
|
||||
'UpgEx_CU23H2=Green',
|
||||
'UpgEx_NI23H2=Green',
|
||||
'UpgEx_NI22H2=Green',
|
||||
'UpgEx_CO21H2=Green',
|
||||
'UpgEx_23H2=Green',
|
||||
'UpgEx_22H2=Green',
|
||||
'UpgEx_21H2=Green',
|
||||
'UpgEx_21H1=Green',
|
||||
'UpgEx_20H1=Green',
|
||||
'UpgEx_19H1=Green',
|
||||
'UpgEx_RS5=Green',
|
||||
'UpgradeAccepted=1',
|
||||
'UpgradeEligible=1',
|
||||
'UserInPlaceUpgrade=1',
|
||||
'VBSState=2',
|
||||
'Version_RS5=2000000000',
|
||||
'WuClientVer='.$build,
|
||||
);
|
||||
|
||||
if($ring == 'MSIT' && uupApiConfigIsTrue('allow_corpnet')) {
|
||||
if(in_array('thisonly', $flags)) {
|
||||
$attrib[] = 'MediaBranch='.$branch;
|
||||
}
|
||||
|
||||
if(in_array('corpnet', $flags) && uupApiConfigIsTrue('allow_corpnet')) {
|
||||
$attrib[] = 'DUInternal=1';
|
||||
}
|
||||
|
||||
@ -237,7 +289,6 @@ function branchFromBuild($build) {
|
||||
|
||||
case 20348:
|
||||
case 20349:
|
||||
case 20350:
|
||||
$branch = 'fe_release';
|
||||
break;
|
||||
|
||||
@ -246,9 +297,21 @@ function branchFromBuild($build) {
|
||||
break;
|
||||
|
||||
case 22621:
|
||||
case 22631:
|
||||
case 22635:
|
||||
$branch = 'ni_release';
|
||||
break;
|
||||
|
||||
case 25398:
|
||||
$branch = 'zn_release';
|
||||
break;
|
||||
|
||||
case 26100:
|
||||
case 26120:
|
||||
case 26200:
|
||||
$branch = 'ge_release';
|
||||
break;
|
||||
|
||||
default:
|
||||
$branch = 'rs_prerelease';
|
||||
break;
|
||||
@ -258,7 +321,8 @@ function branchFromBuild($build) {
|
||||
}
|
||||
|
||||
// Composes POST data for gathering list of urls for download
|
||||
function composeFileGetRequest($updateId, $device, $info, $rev = 1, $type = 'Production') {
|
||||
function composeFileGetRequest($updateId, $info, $rev = 1, $type = 'Production') {
|
||||
$device = uupDevice();
|
||||
$uuid = genUUID();
|
||||
|
||||
$createdTime = time();
|
||||
@ -267,15 +331,23 @@ function composeFileGetRequest($updateId, $device, $info, $rev = 1, $type = 'Pro
|
||||
$created = gmdate(DATE_W3C, $createdTime);
|
||||
$expires = gmdate(DATE_W3C, $expiresTime);
|
||||
|
||||
//$branch = branchFromBuild($info['checkBuild']);
|
||||
$arch = 'amd64';
|
||||
|
||||
if(isset($info['fetchArch'])) {
|
||||
$arch = $info['fetchArch'];
|
||||
} elseif(isset($info['arch'])) {
|
||||
$arch = $info['arch'];
|
||||
}
|
||||
|
||||
$deviceAttributes = composeDeviceAttributes(
|
||||
$info['flight'],
|
||||
$info['ring'],
|
||||
$info['checkBuild'],
|
||||
$info['arch'],
|
||||
$info['sku'],
|
||||
$type
|
||||
isset($info['flight']) ? $info['flight'] : 'Active',
|
||||
isset($info['ring']) ? $info['ring'] : 'RETAIL',
|
||||
isset($info['checkBuild']) ? $info['checkBuild'] : '10.0.19041.1',
|
||||
$arch,
|
||||
isset($info['sku']) ? $info['sku'] : 48,
|
||||
$type,
|
||||
isset($info['flags']) ? $info['flags'] : [],
|
||||
isset($info['branch']) ? $info['branch'] : 'auto',
|
||||
);
|
||||
|
||||
return <<<XML
|
||||
@ -319,7 +391,12 @@ XML;
|
||||
}
|
||||
|
||||
// Composes POST data for fetching the latest update information from Windows Update
|
||||
function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build, $sku = 48, $type = 'Production') {
|
||||
function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type = 'Production', $flags = [], $branch = 'auto') {
|
||||
$encData = uupEncryptedData();
|
||||
if($encData === false)
|
||||
return false;
|
||||
|
||||
$device = uupDevice();
|
||||
$uuid = genUUID();
|
||||
|
||||
$createdTime = time();
|
||||
@ -330,6 +407,7 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build
|
||||
$expires = gmdate(DATE_W3C, $expiresTime);
|
||||
$cookieExpires = gmdate(DATE_W3C, $cookieExpiresTime);
|
||||
|
||||
if($branch == 'auto')
|
||||
$branch = branchFromBuild($build);
|
||||
|
||||
$mainProduct = 'Client.OS.rs2';
|
||||
@ -352,6 +430,10 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build
|
||||
if($sku == 189) {
|
||||
$mainProduct = 'WCOSDevice0.OS';
|
||||
}
|
||||
// WNC
|
||||
if($sku == 210) {
|
||||
$mainProduct = 'WNC.OS';
|
||||
}
|
||||
|
||||
if($arch == 'all') {
|
||||
$arch = array(
|
||||
@ -371,7 +453,9 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build
|
||||
$products[] = "PN=$mainProduct.$currArch&Branch=$branch&PrimaryOSProduct=1&Repairable=1&V=$build&ReofferUpdate=1";
|
||||
$products[] = "PN=Adobe.Flash.$currArch&Repairable=1&V=0.0.0.0";
|
||||
$products[] = "PN=Microsoft.Edge.Stable.$currArch&Repairable=1&V=0.0.0.0";
|
||||
$products[] = "PN=Microsoft.NETFX.$currArch&V=2018.12.2.0";
|
||||
$products[] = "PN=Microsoft.NETFX.$currArch&V=0.0.0.0";
|
||||
$products[] = "PN=Windows.Autopilot.$currArch&Repairable=1&V=0.0.0.0";
|
||||
$products[] = "PN=Windows.AutopilotOOBE.$currArch&Repairable=1&V=0.0.0.0";
|
||||
$products[] = "PN=Windows.Appraiser.$currArch&Repairable=1&V=$build";
|
||||
$products[] = "PN=Windows.AppraiserData.$currArch&Repairable=1&V=$build";
|
||||
$products[] = "PN=Windows.EmergencyUpdate.$currArch&V=$build";
|
||||
@ -403,11 +487,12 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build
|
||||
$build,
|
||||
$arch,
|
||||
$sku,
|
||||
$type
|
||||
$type,
|
||||
$flags,
|
||||
$branch
|
||||
);
|
||||
|
||||
$syncCurrent = uupApiConfigIsTrue('fetch_sync_current_only');
|
||||
$syncCurrentStr = $syncCurrent ? 'true' : 'false';
|
||||
$syncCurrent = in_array('thisonly', $flags) ? 'true' : 'false';
|
||||
|
||||
return <<<XML
|
||||
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
@ -489,6 +574,7 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build
|
||||
<int>2359977</int>
|
||||
<int>24513870</int>
|
||||
<int>28880263</int>
|
||||
<int>296374060</int>
|
||||
<int>3</int>
|
||||
<int>30077688</int>
|
||||
<int>30486944</int>
|
||||
@ -530,7 +616,7 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build
|
||||
</ExtendedUpdateInfoParameters>
|
||||
<ClientPreferredLanguages/>
|
||||
<ProductsParameters>
|
||||
<SyncCurrentVersionOnly>$syncCurrentStr</SyncCurrentVersionOnly>
|
||||
<SyncCurrentVersionOnly>$syncCurrent</SyncCurrentVersionOnly>
|
||||
<DeviceAttributes>$deviceAttributes</DeviceAttributes>
|
||||
<CallerAttributes>$callerAttrib</CallerAttributes>
|
||||
<Products>$products</Products>
|
||||
@ -543,7 +629,8 @@ XML;
|
||||
}
|
||||
|
||||
// Composes POST data for Get Cookie request
|
||||
function composeGetCookieRequest($device) {
|
||||
function composeGetCookieRequest() {
|
||||
$device = uupDevice();
|
||||
$uuid = genUUID();
|
||||
|
||||
$createdTime = time();
|
||||
|
@ -51,7 +51,7 @@ function genUUID() {
|
||||
);
|
||||
}
|
||||
|
||||
function sendWuPostRequest($url, $postData) {
|
||||
function sendWuPostRequestInternal($url, $postData, $saveCookie = true) {
|
||||
$req = curl_init($url);
|
||||
|
||||
$proxy = uupDumpApiGetConfig();
|
||||
@ -64,8 +64,12 @@ function sendWuPostRequest($url, $postData) {
|
||||
curl_setopt($req, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($req, CURLOPT_ENCODING, '');
|
||||
curl_setopt($req, CURLOPT_POSTFIELDS, $postData);
|
||||
|
||||
if(uupApiConfigIsTrue('production_mode')) {
|
||||
curl_setopt($req, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
curl_setopt($req, CURLOPT_TIMEOUT, 15);
|
||||
}
|
||||
|
||||
curl_setopt($req, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($req, CURLOPT_HTTPHEADER, array(
|
||||
'User-Agent: Windows-Update-Agent/10.0.10011.16384 Client-Protocol/2.50',
|
||||
@ -77,38 +81,43 @@ function sendWuPostRequest($url, $postData) {
|
||||
|
||||
curl_close($req);
|
||||
|
||||
/*
|
||||
Replace an expired cookie with a new one by replacing it in existing
|
||||
postData. This has to be done this way, because handling it properly would
|
||||
most likely require a rewrite of half of the project.
|
||||
*/
|
||||
if($error == 500 && preg_match('/<ErrorCode>(ConfigChanged|CookieExpired)<\/ErrorCode>/', $out)) {
|
||||
$oldCookie = uupEncryptedData();
|
||||
@unlink(dirname(__FILE__).'/cookie.json');
|
||||
$postData = str_replace($oldCookie, uupEncryptedData(), $postData);
|
||||
if($saveCookie === true)
|
||||
uupSaveCookieFromResponse($out);
|
||||
|
||||
return sendWuPostRequest($url, $postData);
|
||||
return [
|
||||
'error' => $error,
|
||||
'out' => $out
|
||||
];
|
||||
}
|
||||
|
||||
$outDecoded = html_entity_decode($out);
|
||||
preg_match('/<NewCookie>.*?<\/NewCookie>|<GetCookieResult>.*?<\/GetCookieResult>/', $outDecoded, $cookieData);
|
||||
|
||||
if(!empty($cookieData)) {
|
||||
preg_match('/<Expiration>.*<\/Expiration>/', $cookieData[0], $expirationDate);
|
||||
preg_match('/<EncryptedData>.*<\/EncryptedData>/', $cookieData[0], $encryptedData);
|
||||
|
||||
$expirationDate = preg_replace('/<Expiration>|<\/Expiration>/', '', $expirationDate[0]);
|
||||
$encryptedData = preg_replace('/<EncryptedData>|<\/EncryptedData>/', '', $encryptedData[0]);
|
||||
|
||||
$fileData = array(
|
||||
'expirationDate' => $expirationDate,
|
||||
'encryptedData' => $encryptedData,
|
||||
);
|
||||
|
||||
@file_put_contents(dirname(__FILE__).'/cookie.json', json_encode($fileData));
|
||||
function sendWuPostRequest($url, $postData) {
|
||||
return sendWuPostRequestInternal($url, $postData)['out'];
|
||||
}
|
||||
|
||||
return $out;
|
||||
function sendWuPostRequestHelper(
|
||||
$endpoint,
|
||||
$postComposer,
|
||||
$postComposerArgs,
|
||||
$saveCookie = true
|
||||
) {
|
||||
$endpoints = [
|
||||
'client' => 'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx',
|
||||
'clientSecured' => 'https://fe3cr.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured'
|
||||
];
|
||||
|
||||
$postData = call_user_func_array($postComposer, $postComposerArgs);
|
||||
if($postData === false)
|
||||
return false;
|
||||
|
||||
$data = sendWuPostRequestInternal($endpoints[$endpoint], $postData, $saveCookie);
|
||||
|
||||
if($data['error'] == 500 && preg_match('/<ErrorCode>(ConfigChanged|CookieExpired|InvalidCookie)<\/ErrorCode>/', $data['out'])) {
|
||||
uupInvalidateCookie();
|
||||
$postData = call_user_func_array($postComposer, $postComposerArgs);
|
||||
return sendWuPostRequestInternal($endpoints[$endpoint], $postData, $saveCookie);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function consoleLogger($message, $showTime = 1) {
|
||||
@ -185,3 +194,16 @@ function uupApiConfigIsTrue($config) {
|
||||
|
||||
return $data[$config] == true;
|
||||
}
|
||||
|
||||
function getAllowedFlags() {
|
||||
$flags = ['thisonly'];
|
||||
|
||||
if(uupApiConfigIsTrue('allow_corpnet'))
|
||||
$flags[] = 'corpnet';
|
||||
|
||||
return $flags;
|
||||
}
|
||||
|
||||
function uupAreAppxPresent($genPack) {
|
||||
return isset($genPack['neutral']['APP']);
|
||||
}
|
||||
|
Reference in New Issue
Block a user