fix: Restore Windows 10 ISO downloads (#2027)

This commit is contained in:
Kroese
2026-07-30 04:15:43 +02:00
committed by GitHub
parent 9e8c1d0dda
commit 6a03ddff71
2 changed files with 110 additions and 55 deletions
+4
View File
@@ -1023,6 +1023,10 @@ getMido() {
sum="2cee70bd183df42b92a2e0da08cc2bb7a2a9ce3a3841955a012c0f77aeb3cb29" sum="2cee70bd183df42b92a2e0da08cc2bb7a2a9ce3a3841955a012c0f77aeb3cb29"
url="https://software-static.download.prss.microsoft.com/dbazure/998969d5-f34g-4e03-ac9d-1f9786c66749/26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_IOT_LTSC_EVAL_x64FRE_en-us.iso" url="https://software-static.download.prss.microsoft.com/dbazure/998969d5-f34g-4e03-ac9d-1f9786c66749/26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_IOT_LTSC_EVAL_x64FRE_en-us.iso"
;; ;;
"win10x64" )
size=6140975104
sum="a6f470ca6d331eb353b815c043e327a347f594f37ff525f17764738fe812852e"
;;
"win10x64-enterprise-eval" ) "win10x64-enterprise-eval" )
size=5550497792 size=5550497792
sum="ef7312733a9f5d7d51cfa04ac497671995674ca5e1058d5164d6028f0938d668" sum="ef7312733a9f5d7d51cfa04ac497671995674ca5e1058d5164d6028f0938d668"
+106 -55
View File
@@ -83,32 +83,22 @@ curlRequest() {
return 0 return 0
} }
downloadWindows() { downloadWindowsLink() {
local id="$1" local productId="$1"
local lang="$2" local url="$2"
local desc="$3" local agent="$3"
local language="$4"
local lang="$5"
local desc="$6"
local type="$7"
local ovToken="" ovTicks="" ovTime
local skuId skuJson local skuId skuJson
local linkJson link local linkJson link
local language ovData local ovData ovTime session
local session agent local ovToken="" ovTicks=""
local type winVer
local page productId
local profile="606624d44113" local profile="606624d44113"
agent=$(getAgent)
language=$(getLanguage "$lang" "name")
case "${id,,}" in
"win11x64" ) winVer="11" && type="1" ;;
"win11arm64" ) winVer="11arm64" && type="2" ;;
* ) error "Invalid VERSION specified, value \"$id\" is not recognized!" && return 1 ;;
esac
local url="https://www.microsoft.com/en-us/software-download/windows$winVer"
# uuidgen: For MacOS (installed by default) and other systems (e.g. with no /proc) that don't have a kernel interface for generating random UUIDs # uuidgen: For MacOS (installed by default) and other systems (e.g. with no /proc) that don't have a kernel interface for generating random UUIDs
if ! session=$(cat /proc/sys/kernel/random/uuid 2> /dev/null || uuidgen --random); then if ! session=$(cat /proc/sys/kernel/random/uuid 2> /dev/null || uuidgen --random); then
error "Failed to generate session ID!" error "Failed to generate session ID!"
@@ -122,23 +112,6 @@ downloadWindows() {
return 1 return 1
fi fi
# Get product edition ID for latest release of given Windows version
enabled "$DEBUG" && echo "Parsing download page: ${url}"
curlRequest page "Microsoft" "$agent" \
--header "Accept:" \
--max-filesize 1M \
-- "$url" || return 1
enabled "$DEBUG" && echo -n "Getting Product edition ID: "
productId=$(echo "$page" | grep -Eo '<option value="[0-9]+">Windows' | cut -d '"' -f 2 | head -n 1 | tr -cd '0-9' | head -c 16)
enabled "$DEBUG" && echo "$productId"
if [ -z "$productId" ]; then
error "Product edition ID not found!"
return 1
fi
# Microsoft download "protection" requires the sessionId to be whitelisted through vlscppe.microsoft.com/tags # Microsoft download "protection" requires the sessionId to be whitelisted through vlscppe.microsoft.com/tags
local orgId="y6jn8c31" local orgId="y6jn8c31"
@@ -206,7 +179,7 @@ downloadWindows() {
--max-filesize 100K \ --max-filesize 100K \
-- "$skuUrl" || return 1 -- "$skuUrl" || return 1
{ skuId=$(echo "$skuJson" | jq --arg LANG "$language" -r '.Skus[] | select(.Language==$LANG).Id') 2>/dev/null; local rc=$?; } || : { skuId=$(printf '%s\n' "$skuJson" | jq --arg LANG "$language" -r 'first(.Skus[]? | select(.Language == $LANG) | .Id) // empty') 2>/dev/null; local rc=$?; } || :
if [ -z "$skuId" ] || [[ "${skuId,,}" == "null" ]] || (( rc != 0 )); then if [ -z "$skuId" ] || [[ "${skuId,,}" == "null" ]] || (( rc != 0 )); then
language=$(getLanguage "$lang" "desc") language=$(getLanguage "$lang" "desc")
@@ -234,17 +207,17 @@ downloadWindows() {
return 1 return 1
fi fi
if echo "$linkJson" | grep -q "Sentinel marked this request as rejected."; then if grep -Fq "Sentinel marked this request as rejected." <<< "$linkJson"; then
error "Microsoft blocked the automated download request based on your IP address." error "Microsoft blocked the automated download request based on your IP address."
return 1 return 1
fi fi
if echo "$linkJson" | grep -q "We are unable to complete your request at this time."; then if grep -Fq "We are unable to complete your request at this time." <<< "$linkJson"; then
error "Microsoft blocked the automated download request." error "Microsoft blocked the automated download request."
return 1 return 1
fi fi
{ link=$(echo "$linkJson" | jq --argjson TYPE "$type" -r '.ProductDownloadOptions[] | select(.DownloadType==$TYPE).Uri') 2>/dev/null; rc=$?; } || : { link=$(printf '%s\n' "$linkJson" | jq --argjson TYPE "$type" -r 'first(.ProductDownloadOptions[]? | select(.DownloadType == $TYPE) | .Uri) // empty') 2>/dev/null; rc=$?; } || :
if [ -z "$link" ] || [[ "${link,,}" == "null" ]] || (( rc != 0 )); then if [ -z "$link" ] || [[ "${link,,}" == "null" ]] || (( rc != 0 )); then
error "Microsoft server gave us no download link to our request for an automated download!" error "Microsoft server gave us no download link to our request for an automated download!"
@@ -256,6 +229,82 @@ downloadWindows() {
return 0 return 0
} }
downloadWindows() {
local id="$1"
local lang="$2"
local desc="$3"
local agent language
local page productId
local type winVer
agent=$(getAgent)
language=$(getLanguage "$lang" "name")
case "${id,,}" in
"win10x64" )
productId="2618"
winVer="10"
type="1"
;;
"win11x64" )
productId="3321"
winVer="11"
type="1"
;;
"win11arm64" )
productId="3324"
winVer="11arm64"
type="2"
;;
* )
error "Invalid VERSION specified, value \"$id\" is not recognized!"
return 1
;;
esac
local url="https://www.microsoft.com/en-us/software-download/windows$winVer"
[[ "${id,,}" == "win10"* ]] && url+="ISO"
enabled "$DEBUG" && echo "Using Product edition ID: $productId"
if downloadWindowsLink "$productId" "$url" "$agent" "$language" "$lang" "$desc" "$type"; then
return 0
fi
sleep 1
local msg="retrying using a different method..."
info "Microsoft download request failed, $msg"
enabled "$DEBUG" && echo "Parsing download page: ${url}"
curlRequest page "Microsoft" "$agent" \
--header "Accept:" \
--max-filesize 1M \
-- "$url" || return 1
enabled "$DEBUG" && echo -n "Getting Product edition ID: "
productId=$(printf '%s' "$page" |
tr '\r\n' ' ' |
grep -Eio "<option[^>]*value=[\"'][0-9]+[\"'][^>]*>[[:space:]]*Windows[^<]*" |
sed -nE "s/.*value=[\"']([0-9]+)[\"'].*/\1/p" |
sed -n '1p' |
cut -c 1-16 || true)
enabled "$DEBUG" && echo "$productId"
if [ -z "$productId" ]; then
info "Failed to fetch the Product edition ID from the download page, $msg"
return 1
fi
if ! downloadWindowsLink "$productId" "$url" "$agent" "$language" "$lang" "$desc" "$type"; then
return 1
fi
return 0
}
downloadWindowsEval() { downloadWindowsEval() {
local id="$1" local id="$1"
@@ -318,13 +367,14 @@ downloadWindowsEval() {
enabled "$DEBUG" && echo "Getting download link.." enabled "$DEBUG" && echo "Getting download link.."
local filter="https://go.microsoft.com/fwlink/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country,,}" # Normalize HTML-encoded query separators before extracting fwlinks.
page=${page//&amp;/&}
page=${page//&#38;/&}
if ! echo "$page" | grep -io "$filter" > /dev/null; then links=$(printf '%s\n' "$page" |
filter="https://go.microsoft.com/fwlink/p/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country,,}" grep -Eio "https://go\.microsoft\.com/fwlink(/p)?/\?[^\"'<>[:space:]]+" |
fi grep -Ei '(^|[?&])culture='"${culture,,}"'(&|$)' |
grep -Ei '(^|[?&])country='"${country,,}"'(&|$)') || {
links=$(echo "$page" | grep -io "$filter") || {
# This should only happen if there's been some change to the download endpoint web address # This should only happen if there's been some change to the download endpoint web address
if [[ "${lang,,}" == "en" || "${lang,,}" == "en-"* ]]; then if [[ "${lang,,}" == "en" || "${lang,,}" == "en-"* ]]; then
error "Windows server download page gave us no download link!" error "Windows server download page gave us no download link!"
@@ -339,30 +389,30 @@ downloadWindowsEval() {
"iot" ) "iot" )
case "${PLATFORM,,}" in case "${PLATFORM,,}" in
"x64" ) "x64" )
link=$(echo "$links" | head -n 1) ;; link=$(printf '%s\n' "$links" | head -n 1) ;;
"arm64" ) "arm64" )
link=$(echo "$links" | head -n 2 | tail -n 1) ;; link=$(printf '%s\n' "$links" | head -n 2 | tail -n 1) ;;
esac ;; esac ;;
"ltsc" ) "ltsc" )
case "${PLATFORM,,}" in case "${PLATFORM,,}" in
"x64" ) "x64" )
link=$(echo "$links" | head -n 2 | tail -n 1) ;; link=$(printf '%s\n' "$links" | head -n 2 | tail -n 1) ;;
esac ;; esac ;;
"enterprise" ) "enterprise" )
case "${PLATFORM,,}" in case "${PLATFORM,,}" in
"x64" ) "x64" )
if [[ "$winVer" != "windows-10"* ]]; then if [[ "$winVer" != "windows-10"* ]]; then
link=$(echo "$links" | head -n 1) link=$(printf '%s\n' "$links" | head -n 1)
else else
link=$(echo "$links" | head -n 2 | tail -n 1) link=$(printf '%s\n' "$links" | head -n 2 | tail -n 1)
fi ;; fi ;;
"arm64" ) "arm64" )
link=$(echo "$links" | head -n 2 | tail -n 1) ;; link=$(printf '%s\n' "$links" | head -n 2 | tail -n 1) ;;
esac ;; esac ;;
"server" ) "server" )
case "${PLATFORM,,}" in case "${PLATFORM,,}" in
"x64" ) "x64" )
link=$(echo "$links" | head -n 1) ;; link=$(printf '%s\n' "$links" | head -n 1) ;;
esac ;; esac ;;
* ) * )
error "Invalid type specified, value \"$type\" is not recognized!" && return 1 ;; error "Invalid type specified, value \"$type\" is not recognized!" && return 1 ;;
@@ -547,6 +597,7 @@ getWindows() {
esac esac
case "${version,,}" in case "${version,,}" in
"win10x64" ) ;;
"win11${PLATFORM,,}" ) ;; "win11${PLATFORM,,}" ) ;;
"win11${PLATFORM,,}-enterprise"* ) ;; "win11${PLATFORM,,}-enterprise"* ) ;;
* ) * )
@@ -558,7 +609,7 @@ getWindows() {
esac esac
case "${version,,}" in case "${version,,}" in
"win11${PLATFORM,,}" ) "win10x64" | "win11${PLATFORM,,}" )
if downloadWindows "$version" "$lang" "$edition"; then if downloadWindows "$version" "$lang" "$edition"; then
MIDO_SOURCE="$version" MIDO_SOURCE="$version"