2017-09-22 21:24:31 +02:00
|
|
|
<?php
|
|
|
|
/*
|
2018-02-10 01:10:57 +01:00
|
|
|
Copyright 2018 UUP dump API authors
|
2017-09-22 21:24:31 +02:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-09-23 17:47:19 +02:00
|
|
|
function uupApiVersion() {
|
2018-07-16 01:17:27 +02:00
|
|
|
return '1.15.2';
|
2017-09-23 17:47:19 +02:00
|
|
|
}
|
2017-09-22 21:24:31 +02:00
|
|
|
|
2017-09-23 17:47:19 +02:00
|
|
|
function uupApiPrintBrand() {
|
2017-09-30 16:38:26 +02:00
|
|
|
global $uupApiBrandPrinted;
|
2017-10-16 18:03:26 +02:00
|
|
|
|
2017-09-30 16:38:26 +02:00
|
|
|
if(!isset($uupApiBrandPrinted)) {
|
|
|
|
consoleLogger('UUP dump API v'.uupApiVersion());
|
|
|
|
$uupApiBrandPrinted = 1;
|
|
|
|
}
|
2017-09-22 21:24:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function randStr($length = 4) {
|
|
|
|
$characters = '0123456789abcdef';
|
|
|
|
$charactersLength = strlen($characters);
|
|
|
|
$randomString = '';
|
|
|
|
for ($i = 0; $i < $length; $i++) {
|
|
|
|
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
|
|
|
}
|
|
|
|
return $randomString;
|
|
|
|
}
|
|
|
|
|
|
|
|
function sendWuPostRequest($url, $postData) {
|
|
|
|
$req = curl_init($url);
|
|
|
|
|
|
|
|
curl_setopt($req, CURLOPT_HEADER, 0);
|
|
|
|
curl_setopt($req, CURLOPT_POST, 1);
|
|
|
|
curl_setopt($req, CURLOPT_RETURNTRANSFER, 1);
|
2017-10-27 21:38:31 +02:00
|
|
|
curl_setopt($req, CURLOPT_ENCODING, '');
|
2017-09-22 21:24:31 +02:00
|
|
|
curl_setopt($req, CURLOPT_POSTFIELDS, $postData);
|
|
|
|
curl_setopt($req, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
|
curl_setopt($req, CURLOPT_HTTPHEADER, array(
|
|
|
|
'User-Agent: Windows-Update-Agent/10.0.10011.16384 Client-Protocol/1.70',
|
|
|
|
'Content-Type: application/soap+xml; charset=utf-8',
|
|
|
|
));
|
|
|
|
|
|
|
|
$out = curl_exec($req);
|
|
|
|
curl_close($req);
|
|
|
|
|
2018-07-16 01:17:27 +02:00
|
|
|
$outDecoded = html_entity_decode($out);
|
|
|
|
preg_match('/<NewCookie>.*?<\/NewCookie>/', $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));
|
|
|
|
}
|
|
|
|
|
2017-09-22 21:24:31 +02:00
|
|
|
return $out;
|
|
|
|
}
|
|
|
|
|
|
|
|
function consoleLogger($message, $showTime = 1) {
|
|
|
|
if(php_sapi_name() != 'cli') return
|
|
|
|
$currTime = '';
|
|
|
|
if($showTime) {
|
|
|
|
$currTime = '['.date('Y-m-d H:i:s T', time()).'] ';
|
|
|
|
}
|
|
|
|
|
|
|
|
$msg = $currTime.$message;
|
|
|
|
fwrite(STDERR, $msg."\n");
|
|
|
|
}
|
|
|
|
|
2017-09-23 17:47:19 +02:00
|
|
|
function uupDevice() {
|
|
|
|
return 'dAA9AEUAdwBBAHcAQQBzAE4AMwBCAEEAQQBVADEAYgB5AHMAZQBtAGIAZQBEAFYAQwArADMAZgBtADcAbwBXAHkASAA3AGIAbgBnAEcAWQBtAEEAQQBHADcAVwBtAGUAWQBmAGkAdwAxAGMAdgByAEoAbwBvAGkAUQBzAFoAZABqAHEAawBQAEkARwA5AHUAVQBQAFcAMQB3ADMAQgBVAE8ALwBKAC8AdwBwAGUAcgBhAHQAZAB2AFgAQgB6AFkAbABaAHAAYgBzAHQANAB4AHkAbABHADcAQwBSADQANABBAFoARwB4AG4ARAAvAHIAYwBVAGoAdwBEAFAAVQBXAHkAMABPAEwAaABqAFAAZABWAEgAOQBVAFkATAA4AE0AVgBJAFIAbQA5ADEALwAwAGwATQBjAHUAMwBQAFMAOQB5AFoARwBFADIAZgBOAEcAWAA2AE8AbABrAFoAaABiAG0AbAB1AGsAdwBXAEsAdQBQAHcAcABGADQARQB5AFgAcgBTAHgALwBwAEsATgArAFoANgBOAEoAdQArAFYASwBqAFoANwBoADIAUgBBADIAWQBBAEEAQQBpAEUAWQBjADgAawBnAFoAYQBsAEgAWQBBAEIASwBIADEAZAAvAEoAZABEAFUAeAB5ADIAegBkAEoAMwA0AEIAbABYAGMAYwBsAFoANABJAE4ANQBuAHcAYQBLAE4AWgA3ADEAcQA4AEMAcQBVAFgAYwBQAGMAQgBjAGEAVQBXAFgAVgBGAEMASgBsAEEAegBTAGwAQQBtAHEALwBvAFQAQQBVAFcAYQBOAEgAWQBRADAAWQBNADEAVQAzAHEATAAvAFEAdQBhAEcAMgBuAE4AdQBvADYAVwBqAFEAcQ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BwAD0A';
|
|
|
|
}
|
|
|
|
|
|
|
|
function uupEncryptedData() {
|
2018-07-16 01:17:27 +02:00
|
|
|
$encData = 'o2vRpZuat2Ot2MKdwG29/fwtUpuU1XOgAr1Lrzo+dWejpj0CZiCSo6v05klhJbSrT0iylYNs8JXPA0owZvOmvvWYSs5+8u/hqUFtMgT/6Z99nhPNYD0Y00jol58NwB1RJcYWy3hzJz/5cAiZ60GRwa8zMDVbsI8qgF1AT/XKjbwsoOQNRTW5gVPDX/Fs/uICWI968NXQjiV7p2AP8poB/CCwA1cpgZPx';
|
|
|
|
|
|
|
|
$cookieInfo = @file_get_contents(dirname(__FILE__).'/cookie.json');
|
|
|
|
$cookieInfo = json_decode($cookieInfo, 1);
|
|
|
|
|
|
|
|
if(!empty($cookieInfo)) {
|
|
|
|
$encData = $cookieInfo['encryptedData'];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $encData;
|
2017-09-23 17:47:19 +02:00
|
|
|
}
|
2017-09-22 21:24:31 +02:00
|
|
|
?>
|