Compare commits

...

6 Commits
v1.49 ... v1.55

Author SHA1 Message Date
Pete Batard
4e6f25f351 Work around the latest Microsoft server restrictions
* It looks like Microsoft are actively filtering our script by detecting our first request with the
  spoofed user-agent, so work around that.
* Also switch to using 'curl' instead of 'Invoke-WebRequest'. May break PowerShell 7.0, but I'm only
  concerned about Rufus usage for now.
* Also add timeouts on web requests.
* Closes #88.
2024-02-07 15:55:59 +00:00
Pete Batard
d43d7aeee3 Add Windows 11 23H2 v2 downloads
* With thanks to @ave9858.
* Closes #83.
2023-12-19 10:27:44 +00:00
Pete Batard
d8b2d24242 Add UEFI Shell 23H2 ISO downloads
* Also fix Windows 11 23H2 build version since Microsoft are *UTTERLY USELESS*
  at providing an accurate product version number in the .wim's XML versioning
  files they are in bloody charge of populating...
2023-11-25 17:55:01 +00:00
Pete Batard
903cae2f00 Add Windows 11 23H2 downloads
* Replaces Windows 11 22H2, since past history indicates that Microsoft is
  not going to keep the Windows 11 22H2 ISOs available for much longer.
* Note that Microsoft has *no* plans to ever release a Windows 10 23H2.
* Closes #76.
2023-10-31 19:23:43 +01:00
Pete Batard
5d4a4d7d14 Fix a regression with IgnoreWarnings
* Commit 1d88deac7c removed the IgnoreWarnings flag which was
  needed as a fix for pbatard/rufus#2030.
* Contributed by @Tom-EllisEVENTS.
* Closes pbatard/rufus#2315.
2023-09-08 18:35:53 +01:00
Pete Batard
4a694421af Add UEFI Shell 2.2 23H1 download 2023-06-06 13:49:50 +01:00

View File

@@ -1,5 +1,5 @@
#
# Fido v1.49 - Feature ISO Downloader, for retail Windows images and UEFI Shell
# Fido v1.55 - Feature ISO Downloader, for retail Windows images and UEFI Shell
# Copyright © 2019-2023 Pete Batard <pete@akeo.ie>
# Command line support: Copyright © 2021 flx5
# ConvertTo-ImageSource: Copyright © 2016 Chris Carter
@@ -97,6 +97,7 @@ $Signature = @{
ReferencedAssemblies = $Drawing_Assembly
ErrorAction = "Stop"
WarningAction = "Ignore"
IgnoreWarnings = $true
MemberDefinition = @"
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = true, BestFitMapping = false, ThrowOnUnmappableChar = true)]
internal static extern int ExtractIconEx(string sFile, int iIndex, out IntPtr piLargeVersion, out IntPtr piSmallVersion, int amountIcons);
@@ -137,9 +138,9 @@ $WindowsVersions = @(
@(
@("Windows 11", "windows11"),
@(
"22H2 v2 (Build 22621.1702 - 2023.05)",
@("Windows 11 Home/Pro/Edu", 2616),
@("Windows 11 Home China ", ($zh + 2617))
"23H2 v2 (Build 22631.2861 - 2023.12)",
@("Windows 11 Home/Pro/Edu", 2935),
@("Windows 11 Home China ", ($zh + 2936))
)
),
@(
@@ -163,6 +164,16 @@ $WindowsVersions = @(
),
@(
@("UEFI Shell 2.2", "UEFI_SHELL 2.2"),
@(
"23H2 (edk2-stable202311)",
@("Release", 0),
@("Debug", 1)
),
@(
"23H1 (edk2-stable202305)",
@("Release", 0),
@("Debug", 1)
),
@(
"22H2 (edk2-stable202211)",
@("Release", 0),
@@ -426,6 +437,7 @@ function Get-RandomDate()
#region Globals
$ErrorActionPreference = "Stop"
$DefaultTimeout = 30
$dh = 58
$Stage = 0
$SelectedIndex = 0
@@ -497,8 +509,18 @@ function Check-Locale
if ($Verbosity -ge 2) {
Write-Host Querying $url
}
Invoke-WebRequest -UseBasicParsing -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
# Looks Microsoft are filtering our script according to the first query it performs with the spoofed user agent.
# So, to continue this pointless cat and mouse game, we simply add an extra first query with the default user agent.
# Also: "Hi Microsoft. You sure have A LOT OF RESOURCES TO WASTE to have assigned folks of yours to cripple scripts
# that merely exist because you have chosen to make the user experience from your download website utterly subpar.
# And while I am glad senpai noticed me (UwU), I feel compelled to ask: Don't you guys have better things to do?"
curl -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 $url | Out-Null
curl -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
} catch {
# Of course PowerShell 7 had to BREAK $_.Exception.Status on timeouts...
if ($_.Exception.Status -eq "Timeout" -or $_.Exception.GetType().Name -eq "TaskCanceledException") {
Write-Host Operation Timed out
}
$script:QueryLocale = "en-US"
}
}
@@ -553,7 +575,7 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition)
Write-Host Querying $url
}
try {
Invoke-WebRequest -UseBasicParsing -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
curl -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
} catch {
Error($_.Exception.Message)
return @()
@@ -572,7 +594,7 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition)
$script:SelectedIndex = 0
try {
$r = Invoke-WebRequest -Method Post -UseBasicParsing -UserAgent $UserAgent -SessionVariable "Session" $url
$r = curl -Method Post -UseBasicParsing -TimeoutSec $DefaultTimeout -UserAgent $UserAgent -SessionVariable "Session" $url
if ($r -match "errorModalMessage") {
Throw-Error -Req $r -Alt "Could not retrieve languages from server"
}
@@ -662,7 +684,7 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
$Is64 = [Environment]::Is64BitOperatingSystem
# Must add a referer for this request, else Microsoft's servers will deny it
$ref = "https://www.microsoft.com/software-download/windows11"
$r = Invoke-WebRequest -Method Post -Headers @{ "Referer" = $ref } -UseBasicParsing -UserAgent $UserAgent -WebSession $Session $url
$r = curl -Method Post -Headers @{ "Referer" = $ref } -UseBasicParsing -TimeoutSec $DefaultTimeout -UserAgent $UserAgent -WebSession $Session $url
if ($r -match "errorModalMessage") {
$Alt = [regex]::Match($r.Content, '<p id="errorModalMessage">(.+?)<\/p>').Groups[1].Value -replace "<[^>]+>" -replace "\s+", " " -replace "\?\?\?", "-"
$Alt = [System.Text.Encoding]::UTF8.GetString([byte[]][char[]]$Alt)
@@ -715,7 +737,7 @@ function Process-Download-Link([string]$Url)
$pattern = '.*\/(.*\.iso).*'
$File = [regex]::Match($Url, $pattern).Groups[1].Value
# PowerShell implicit conversions are iffy, so we need to force them...
$str_size = (Invoke-WebRequest -UseBasicParsing -Uri $Url -Method Head).Headers.'Content-Length'
$str_size = (curl -UseBasicParsing -TimeoutSec $DefaultTimeout -Uri $Url -Method Head).Headers.'Content-Length'
$tmp_size = [uint64]::Parse($str_size)
$Size = Size-To-Human-Readable $tmp_size
Write-Host "Downloading '$File' ($Size)..."
@@ -1048,8 +1070,8 @@ exit $ExitCode
# SIG # Begin signature block
# MIIkWAYJKoZIhvcNAQcCoIIkSTCCJEUCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDs/90zfCBKVjL6
# NsWYvK3K9j/kIecureg1h1y07zjzR6CCElkwggVvMIIEV6ADAgECAhBI/JO0YFWU
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBHf44+d5nlaax1
# zDK20N+s1BjbUkc/aTGHLUQuXBU9BqCCElkwggVvMIIEV6ADAgECAhBI/JO0YFWU
# jTanyYqJ1pQWMA0GCSqGSIb3DQEBDAUAMHsxCzAJBgNVBAYTAkdCMRswGQYDVQQI
# DBJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoM
# EUNvbW9kbyBDQSBMaW1pdGVkMSEwHwYDVQQDDBhBQUEgQ2VydGlmaWNhdGUgU2Vy
@@ -1152,22 +1174,22 @@ exit $ExitCode
# aWMgQ29kZSBTaWduaW5nIENBIEVWIFIzNgIRAL+xUAG79ZLUlip3l+pzb6MwDQYJ
# YIZIAWUDBAIBBQCgfDAQBgorBgEEAYI3AgEMMQIwADAZBgkqhkiG9w0BCQMxDAYK
# KwYBBAGCNwIBBDAcBgorBgEEAYI3AgELMQ4wDAYKKwYBBAG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