Retail ring support

This commit is contained in:
mkuba50 2017-10-23 22:53:33 +02:00
parent d1df967ded
commit f9997dee4b
4 changed files with 61 additions and 10 deletions

View File

@ -31,7 +31,7 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
return array('error' => 'UNKNOWN_ARCH'); return array('error' => 'UNKNOWN_ARCH');
} }
if(!($ring == 'WIF' || $ring == 'WIS' || $ring == 'RP')) { if(!($ring == 'WIF' || $ring == 'WIS' || $ring == 'RP' || $ring == 'RETAIL')) {
return array('error' => 'UNKNOWN_RING'); return array('error' => 'UNKNOWN_RING');
} }
@ -105,13 +105,28 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
$updateTitle = 'Windows 10 build '.$foundBuild; $updateTitle = 'Windows 10 build '.$foundBuild;
} }
$updateTitle = preg_replace('/ for .{3,5}-based systems/i', '', $updateTitle);
if(preg_match('/Feature update/i', $updateTitle)) {
$updateTitle = $updateTitle.' ('.$foundBuild.')';
}
preg_match('/UpdateID=".*?"/', $updateInfo[0], $updateId); preg_match('/UpdateID=".*?"/', $updateInfo[0], $updateId);
preg_match('/RevisionNumber=".*?"/', $updateInfo[0], $updateRev);
$updateId = preg_replace('/UpdateID="|"$/', '', $updateId[0]); $updateId = preg_replace('/UpdateID="|"$/', '', $updateId[0]);
$updateRev = preg_replace('/RevisionNumber="|"$/', '', $updateRev[0]);
consoleLogger('Successfully checked build information.'); consoleLogger('Successfully checked build information.');
consoleLogger('BUILD: '.$updateTitle.' '.$arch); consoleLogger('BUILD: '.$updateTitle.' '.$arch);
$updateString = $updateId;
if($updateRev != 1) {
$updateString = $updateId.'_rev.'.$updateRev;
}
$fileWrite = 'NO_SAVE'; $fileWrite = 'NO_SAVE';
if(!file_exists('fileinfo/'.$updateId.'.json')) { if(!file_exists('fileinfo/'.$updateString.'.json')) {
consoleLogger('WARNING: This build is NOT in the database. It will be saved now.'); consoleLogger('WARNING: This build is NOT in the database. It will be saved now.');
consoleLogger('Parsing information to write...'); consoleLogger('Parsing information to write...');
if(!file_exists('fileinfo')) mkdir('fileinfo'); if(!file_exists('fileinfo')) mkdir('fileinfo');
@ -161,7 +176,7 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
consoleLogger('Successfully parsed the information.'); consoleLogger('Successfully parsed the information.');
consoleLogger('Writing new build information to the disk...'); consoleLogger('Writing new build information to the disk...');
$success = file_put_contents('fileinfo/'.$updateId.'.json', json_encode($temp)."\n"); $success = file_put_contents('fileinfo/'.$updateString.'.json', json_encode($temp)."\n");
if($success) { if($success) {
consoleLogger('Successfully written build information to the disk.'); consoleLogger('Successfully written build information to the disk.');
$fileWrite = 'INFO_WRITTEN'; $fileWrite = 'INFO_WRITTEN';
@ -179,7 +194,7 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
foreach($ids as $val) { foreach($ids as $val) {
$testName = $val['build'].' '.$val['title'].' '.$val['arch']; $testName = $val['build'].' '.$val['title'].' '.$val['arch'];
if($buildName == $testName && $val['uuid'] != $updateId) { if($buildName == $testName && $val['uuid'] != $updateString) {
unlink(realpath('fileinfo/'.$val['uuid'].'.json')); unlink(realpath('fileinfo/'.$val['uuid'].'.json'));
consoleLogger('Removed superseded update: '.$val['uuid']); consoleLogger('Removed superseded update: '.$val['uuid']);
} }
@ -188,7 +203,7 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
return array( return array(
'apiVersion' => uupApiVersion(), 'apiVersion' => uupApiVersion(),
'updateId' => $updateId, 'updateId' => $updateString,
'updateTitle' => $updateTitle, 'updateTitle' => $updateTitle,
'foundBuild' => $foundBuild, 'foundBuild' => $foundBuild,
'arch' => $arch, 'arch' => $arch,

View File

@ -89,8 +89,14 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
if($info['needsFix'] == true) $uupFix = 1; if($info['needsFix'] == true) $uupFix = 1;
} }
$rev = 1;
if(preg_match('/_rev\./', $updateId)) {
$rev = preg_replace('/.*_rev\./', '', $updateId);
$updateId = preg_replace('/_rev\..*/', '', $updateId);
}
consoleLogger('Fetching information from the server...'); consoleLogger('Fetching information from the server...');
$postData = composeFileGetRequest($updateId, uupDevice(), $info); $postData = composeFileGetRequest($updateId, uupDevice(), $info, $rev);
$out = sendWuPostRequest('https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', $postData); $out = sendWuPostRequest('https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', $postData);
consoleLogger('Information was successfully fetched.'); consoleLogger('Information was successfully fetched.');

View File

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

View File

@ -16,14 +16,44 @@ limitations under the License.
*/ */
// Composes POST data for gathering list of urls for download // Composes POST data for gathering list of urls for download
function composeFileGetRequest($updateId, $device, $info) { function composeFileGetRequest($updateId, $device, $info, $rev = 1) {
$uuid = randStr(8).'-'.randStr(4).'-'.randStr(4).'-'.randStr(4).'-'.randStr(12); $uuid = randStr(8).'-'.randStr(4).'-'.randStr(4).'-'.randStr(4).'-'.randStr(12);
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>2017-01-01T01:00:00.000Z</Created><Expires>2020-01-01T02:00:00.000Z</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>1</RevisionNumber></UpdateIdentity></updateIDs><infoTypes><XmlUpdateFragmentType>FileUrl</XmlUpdateFragmentType><XmlUpdateFragmentType>FileDecryption</XmlUpdateFragmentType></infoTypes><deviceAttributes>App=WU;AppVer=10.0.16251.1000;AttrDataVer=22;BranchReadinessLevel=CB;CurrentBranch=rs_prerelease;DeviceFamily=Windows.Desktop;FirmwareVersion=6.00;FlightContent='.$info['flight'].';FlightingBranchName=external;FlightRing='.$info['ring'].';InstallationType=Client;InstallLanguage=en-US;IsDeviceRetailDemo=0;IsFlightingEnabled=1;OSSkuId=48;OSUILocale=en-US;OSVersion='.$info['checkBuild'].';TelemetryLevel=3;UpdateManagementGroup=2;</deviceAttributes></GetExtendedUpdateInfo2></s:Body></s:Envelope>';
$createdTime = time();
$expiresTime = $createdTime + 120;
$created = gmdate(DATE_W3C, $createdTime);
$expires = gmdate(DATE_W3C, $expiresTime);
$flightEnabled = 1;
$branch = 'rs_prerelease';
if($info['ring'] == 'Retail') {
$flightEnabled = 0;
$branch = 'rs2_release';
}
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>BranchReadinessLevel=CB;GStatus_RS3=2;CurrentBranch='.$branch.';FlightContent='.$info['flight'].';FlightingBranchName=external;FlightRing='.$info['ring'].';AttrDataVer=25;InstallLanguage=en-US;OSUILocale=en-US;InstallationType=Client;FirmwareVersion=6.00;OSSkuId=48;App=WU;AppVer='.$info['checkBuild'].';UpgEx_RS3=Green;OSArchitecture=AMD64;UpdateManagementGroup=2;IsFlightingEnabled='.$flightEnabled.';IsDeviceRetailDemo=0;TelemetryLevel=1;WuClientVer='.$info['checkBuild'].';Free=32to64;OSVersion='.$info['checkBuild'].';DeviceFamily=Windows.Desktop;</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) {
$uuid = randStr(8).'-'.randStr(4).'-'.randStr(4).'-'.randStr(4).'-'.randStr(12); $uuid = randStr(8).'-'.randStr(4).'-'.randStr(4).'-'.randStr(4).'-'.randStr(12);
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>2017-01-01T01:00:00.000Z</Created><Expires>2020-01-01T02:00:00.000Z</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>App=WU;AppVer='.$build.';AttrDataVer=22;BranchReadinessLevel=CB;CurrentBranch=rs_prerelease;DeviceFamily=Windows.Desktop;FirmwareVersion=6.00;FlightContent='.$flight.';FlightingBranchName=external;FlightRing='.$ring.';InstallationType=Client;InstallLanguage=en-US;IsDeviceRetailDemo=0;IsFlightingEnabled=1;OSSkuId=48;OSUILocale=en-US;OSVersion='.$build.';TelemetryLevel=3;UpdateManagementGroup=2;</DeviceAttributes><CallerAttributes>Interactive=1;IsSeeker=0;</CallerAttributes><Products>PN=Client.OS.rs2.'.$arch.'&amp;Branch=rs_prerelease&amp;PrimaryOSProduct=1&amp;V='.$build.';</Products></ProductsParameters></parameters></SyncUpdates></s:Body></s:Envelope>';
$createdTime = time();
$expiresTime = $createdTime + 120;
$created = gmdate(DATE_W3C, $createdTime);
$expires = gmdate(DATE_W3C, $expiresTime);
$flightEnabled = 1;
$branch = 'rs_prerelease';
if($ring == 'Retail') {
$flightEnabled = 0;
$branch = 'rs2_release';
}
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>BranchReadinessLevel=CB;GStatus_RS3=2;CurrentBranch='.$branch.';FlightContent='.$flight.';FlightingBranchName=external;FlightRing='.$ring.';AttrDataVer=25;InstallLanguage=en-US;OSUILocale=en-US;InstallationType=Client;FirmwareVersion=6.00;OSSkuId=48;App=WU;AppVer='.$build.';UpgEx_RS3=Green;OSArchitecture=AMD64;UpdateManagementGroup=2;IsFlightingEnabled='.$flightEnabled.';IsDeviceRetailDemo=0;TelemetryLevel=1;WuClientVer='.$build.';Free=32to64;OSVersion='.$build.';DeviceFamily=Windows.Desktop;</DeviceAttributes><CallerAttributes>Interactive=1;IsSeeker=1;</CallerAttributes><Products>PN=Client.OS.rs2.'.$arch.'&amp;Branch='.$branch.'&amp;PrimaryOSProduct=1&amp;V='.$build.';</Products></ProductsParameters></parameters></SyncUpdates></s:Body></s:Envelope>';
} }
?> ?>