Compare commits

...

16 Commits
v1.35 ... v1.45

Author SHA1 Message Date
Pete Batard
0b0643abc8 Remove Windows 7 downloads
* Since Microsoft removed the ISOs from their servers
* Closes #64
2023-04-14 11:42:34 +01:00
Dmitry Nefedov
1d88deac7c Improve code for P/Invoke
* Closes #62
2023-04-14 11:36:33 +01:00
Pete Batard
9025d258e8 Harmonise the use of $true/$false and not operator 2023-04-14 11:29:40 +01:00
Pete Batard
425eb4da24 Prevent Fido from running on non Windows platforms
* Per #58, we consider that letting non-Windows users run Fido is going to become
  too much of liability moving forward, so the script now detects non Windows
  platforms and actively prevent itself from running there.
* Closes #60.
* Also some whitespace cleanup.
2023-03-07 12:16:57 +00:00
Pete Batard
10acbf9f84 Improve error handling
* Simplify regex and fix unconverted characters.
* Also use Start-BitsTransfer for cmdline downloads (Closes #56).
* Also remove -DisableProgress now that we use Start-BitsTransfer.
2023-02-06 01:22:02 +00:00
Pete Batard
4b24ae5795 Fix Windows 7 detection
* Of course, Windows 7's PowerShell is too stupid to actually compare Version objects.
2023-01-27 15:12:02 +00:00
Pete Batard
2ca0f62f53 Fix language regexp and force TLS for Windows 8.x
* Non En locales may still return '<select id="product-languages">' instead of
  '<select id="product-languages" ...>' so make sure we account for that case.
* Addresses pbatard/rufus#2148
* Also force TLS for Windows 8.x to address pbatard/rufus#2133
2023-01-27 13:39:13 +00:00
Pete Batard
448cfa72cf Remove Windows 7 support
* "I'm sorry for your loss. Move on."
2023-01-27 13:28:28 +00:00
Pete Batard
9552df66d5 Update language option regexp to match latest Microsoft HTML fragment
* Addresses pbatard/rufus#2146
* Also update .gitattributes to clean up release archives
2023-01-25 20:04:14 +00:00
Pete Batard
4bafb688da Remove unneeded files
* .whitesource is unneeded because we don't use external dependencies.
* VS project files are unneeded when we just edit the .ps1 in a text editor.
2023-01-11 20:22:13 +00:00
Pete Batard
ad79094c30 Improve error handling and reporting when querying vlscppe.microsoft.com
* Also use a better default icon and add a preemptive localized message for
  future countermeasures from Microsoft.
2023-01-09 17:32:59 +00:00
Pete Batard
8cf4a279ff Work around Microsoft's new ISO download countermeasures
* The Microsoft servers now use session Id whitelisting, so add querying
  of https://vlscppe.microsoft.com/tags with the session Id.
* Closes #52.
* Also harmonize/improve -replace calls
* Also make sure we use POST for the getskuinformationbyproductedition
  query (in case Microsoft add some more countermeasures).
* Also drop 'cmd /c' invocation in sign.sh since the cygwin people can't
  seem to get their act together there...
2023-01-08 22:10:01 +00:00
Pete Batard
84f833b067 Improve error reporting
* Now return the error message from the Microsoft server where possible (See #52)
2023-01-06 21:58:20 +00:00
Pete Batard
c34a41fe3f Add UEFI Shell 2.2 22H2 download 2022-12-15 00:20:19 +00:00
Erik Dansbo
6593585ff3 Add an option to disable progress report for commandline
* Closes #50
2022-12-14 17:11:09 +00:00
Pete Batard
fac4c49262 Add Windows 10 22H2 builds
* And remove Windows 11 22H2 *v0* builds since Microsoft removed the ISOs from their servers
2022-10-19 13:48:03 +01:00
7 changed files with 243 additions and 300 deletions

View File

@@ -2,7 +2,8 @@
root = true root = true
[*] [*]
trim_trailing_whitespace = true
insert_final_newline = true
# Must use a BOM else Unicode strings will not display # Must use a BOM else Unicode strings will not display
charset = utf-8-bom charset = utf-8-bom
insert_final_newline = true
indent_style = tab
trim_trailing_whitespace = true

3
.gitattributes vendored
View File

@@ -1,3 +1,6 @@
* text=auto * text=auto
*.ps1 eol=crlf *.ps1 eol=crlf
*.sh eol=lf *.sh eol=lf
.gitattributes export-ignore
.gitignore export-ignore
sign.sh export-ignore

View File

@@ -1,8 +0,0 @@
{
"checkRunSettings": {
"vulnerableCheckRunConclusionLevel": "failure"
},
"issueSettings": {
"minSeverityLevel": "LOW"
}
}

465
Fido.ps1
View File

@@ -1,6 +1,6 @@
# #
# Fido v1.35 - Feature ISO Downloader, for retail Windows images and UEFI Shell # Fido v1.45 - Feature ISO Downloader, for retail Windows images and UEFI Shell
# Copyright © 2019-2022 Pete Batard <pete@akeo.ie> # Copyright © 2019-2023 Pete Batard <pete@akeo.ie>
# Command line support: Copyright © 2021 flx5 # Command line support: Copyright © 2021 flx5
# ConvertTo-ImageSource: Copyright © 2016 Chris Carter # ConvertTo-ImageSource: Copyright © 2016 Chris Carter
# #
@@ -24,7 +24,7 @@
#region Parameters #region Parameters
param( param(
# (Optional) The title to display on the application window. # (Optional) The title to display on the application window.
[string]$AppTitle = "Fido - Retail Windows ISO Downloader", [string]$AppTitle = "Fido - Feature ISO Downloader",
# (Optional) '|' separated UI localization strings. # (Optional) '|' separated UI localization strings.
[string]$LocData, [string]$LocData,
# (Optional) Path to a file that should be used for the UI icon. # (Optional) Path to a file that should be used for the UI icon.
@@ -43,9 +43,9 @@ param(
# (Optional) Specify Windows architecture [Toggles commandline mode] # (Optional) Specify Windows architecture [Toggles commandline mode]
[string]$Arch, [string]$Arch,
# (Optional) Only display the download URL [Toggles commandline mode] # (Optional) Only display the download URL [Toggles commandline mode]
[switch]$GetUrl = $False, [switch]$GetUrl = $false,
# (Optional) Increase verbosity # (Optional) Increase verbosity
[switch]$Verbose = $False [switch]$Verbose = $false
) )
#endregion #endregion
@@ -53,42 +53,78 @@ try {
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
} catch {} } catch {}
$Cmd = $False $Cmd = $false
if ($Win -or $Rel -or $Ed -or $Lang -or $Arch -or $GetUrl) { if ($Win -or $Rel -or $Ed -or $Lang -or $Arch -or $GetUrl) {
$Cmd = $True $Cmd = $true
}
# Return a decimal Windows version that we can then check for platform support.
# Note that because we don't want to have to support this script on anything
# other than Windows, this call returns 0.0 for PowerShell running on Linux/Mac.
function Get-Platform-Version()
{
$version = 0.0
$platform = [string][System.Environment]::OSVersion.Platform
# This will filter out non Windows platforms
if ($platform.StartsWith("Win")) {
# Craft a decimal numeric version of Windows
$version = [System.Environment]::OSVersion.Version.Major * 1.0 + [System.Environment]::OSVersion.Version.Minor * 0.1
}
return $version
}
$winver = Get-Platform-Version
# The default TLS for Windows 8.x doesn't work with Microsoft's servers so we must force it
if ($winver -lt 10.0) {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
} }
#region Assembly Types #region Assembly Types
$code = @" $Drawing_Assembly = "System.Drawing"
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] # PowerShell 7 altered the name of the Drawing assembly...
internal static extern int ExtractIconEx(string sFile, int iIndex, out IntPtr piLargeVersion, out IntPtr piSmallVersion, int amountIcons); if ($host.version -ge "7.0") {
[DllImport("user32.dll")] $Drawing_Assembly += ".Common"
public static extern bool ShowWindow(IntPtr handle, int state); }
// Extract an icon from a DLL $Signature = @{
public static Icon ExtractIcon(string file, int number, bool largeIcon) Namespace = "WinAPI"
{ Name = "Utils"
IntPtr large, small; Language = "CSharp"
ExtractIconEx(file, number, out large, out small, 1); UsingNamespace = "System.Runtime", "System.IO", "System.Text", "System.Drawing", "System.Globalization"
try { ReferencedAssemblies = $Drawing_Assembly
return Icon.FromHandle(largeIcon ? large : small); ErrorAction = "Stop"
} catch { WarningAction = "Ignore"
return null; 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);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr handle, int state);
// Extract an icon from a DLL
public static Icon ExtractIcon(string file, int number, bool largeIcon) {
IntPtr large, small;
ExtractIconEx(file, number, out large, out small, 1);
try {
return Icon.FromHandle(largeIcon ? large : small);
} catch {
return null;
}
} }
}
"@ "@
}
if (!$Cmd) { if (!$Cmd) {
Write-Host Please Wait... Write-Host Please Wait...
$Drawing_Assembly = "System.Drawing"
# PowerShell 7 altered the name of the Drawing assembly... if (!("WinAPI.Utils" -as [type]))
if ($host.version -ge "7.0") { {
$Drawing_Assembly += ".Common" Add-Type @Signature
} }
Add-Type -ErrorAction Stop -WarningAction Ignore -IgnoreWarnings -MemberDefinition $code -Namespace Gui -UsingNamespace System.Runtime, System.IO, System.Text, System.Drawing, System.Globalization -ReferencedAssemblies $Drawing_Assembly -Name Utils
Add-Type -AssemblyName PresentationFramework Add-Type -AssemblyName PresentationFramework
# Hide the powershell window: https://stackoverflow.com/a/27992426/1069307 # Hide the powershell window: https://stackoverflow.com/a/27992426/1069307
[Gui.Utils]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0) | Out-Null [WinAPI.Utils]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0) | Out-Null
} }
#endregion #endregion
@@ -103,11 +139,6 @@ $WindowsVersions = @(
@("Windows 11 Home/Pro/Edu", 2370), @("Windows 11 Home/Pro/Edu", 2370),
@("Windows 11 Home China ", ($zh + 2371)) @("Windows 11 Home China ", ($zh + 2371))
), ),
@(
"22H2 (Build 22621.382 - 2022.09)",
@("Windows 11 Home/Pro/Edu", 2360),
@("Windows 11 Home China ", ($zh + 2361))
),
@( @(
"21H2 v1 (Build 22000.318 - 2021.11)", "21H2 v1 (Build 22000.318 - 2021.11)",
@("Windows 11 Home/Pro/Edu", 2093), @("Windows 11 Home/Pro/Edu", 2093),
@@ -121,12 +152,11 @@ $WindowsVersions = @(
), ),
@( @(
@("Windows 10", "Windows10ISO"), @("Windows 10", "Windows10ISO"),
# Not yet enabled by Microsoft... @(
# @( "22H2 (Build 19045.2006 - 2022.10)",
# "22H2 (Build 1904?.???? - 2022.10)", @("Windows 10 Home/Pro/Edu", 2377),
# @("Windows 10 Home/Pro/Edu", 2377), @("Windows 10 Home China ", ($zh + 2378))
# @("Windows 10 Home China ", ($zh + 2378)) ),
# ),
@( @(
"21H2 (Build 19044.1288 - 2021.11)", "21H2 (Build 19044.1288 - 2021.11)",
@("Windows 10 Home/Pro/Edu", 2084), @("Windows 10 Home/Pro/Edu", 2084),
@@ -279,17 +309,13 @@ $WindowsVersions = @(
@("Windows 8.1 KN", ($ko + 62)) @("Windows 8.1 KN", ($ko + 62))
) )
), ),
@(
@("Windows 7", "WIN7"),
@(
"with SP1 (build 7601)",
@("Windows 7 Ultimate", 0),
@("Windows 7 Professional", 1),
@("Windows 7 Home Premium", 2)
)
),
@( @(
@("UEFI Shell 2.2", "UEFI_SHELL 2.2"), @("UEFI Shell 2.2", "UEFI_SHELL 2.2"),
@(
"22H2 (edk2-stable202211)",
@("Release", 0),
@("Debug", 1)
),
@( @(
"22H1 (edk2-stable202205)", "22H1 (edk2-stable202205)",
@("Release", 0), @("Release", 0),
@@ -312,49 +338,13 @@ $WindowsVersions = @(
) )
), ),
@( @(
@("UEFI Shell 2.0", "UEFI_SHELL 2.0"), @("UEFI Shell 2.0", "UEFI_SHELL 2.0"),
@( @(
"4.632 [20100426]", "4.632 [20100426]",
@("Release", 0) @("Release", 0)
) )
) )
) )
$Windows7Versions = @(
# 0: Windows 7 Ultimate
@(
# Need a dummy to prevent PS from coalescing single array entries
@(""),
@("English (US)", "en-us",
@(
@("x64", "https://download.microsoft.com/download/5/1/9/5195A765-3A41-4A72-87D8-200D897CBE21/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_ULTIMATE_x64FRE_en-us.iso"),
@("x86", "https://download.microsoft.com/download/1/E/6/1E6B4803-DD2A-49DF-8468-69C0E6E36218/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_ULTIMATE_x86FRE_en-us.iso")
)
)
),
# 1: Windows 7 Profesional
@(
@(""),
@("English (US)", "en-us",
@(
@("x64", "https://download.microsoft.com/download/0/6/3/06365375-C346-4D65-87C7-EE41F55F736B/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_PROFESSIONAL_x64FRE_en-us.iso"),
@("x86", "https://download.microsoft.com/download/C/0/6/C067D0CD-3785-4727-898E-60DC3120BB14/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_PROFESSIONAL_x86FRE_en-us.iso")
)
)
),
# 2: Windows 7 Home Premium
@(
@(""),
@("English (US)", "en-us",
@(
@("x64", "https://download.microsoft.com/download/E/A/8/EA804D86-C3DF-4719-9966-6A66C9306598/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_HOMEPREMIUM_x64FRE_en-us.iso"),
@("x86", "https://download.microsoft.com/download/E/D/A/EDA6B508-7663-4E30-86F9-949932F443D0/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_HOMEPREMIUM_x86FRE_en-us.iso")
)
)
)
)
#endregion #endregion
#region Functions #region Functions
@@ -404,9 +394,9 @@ function Select-Language([string]$LangName)
($SysLocale.StartsWith("tr") -and $LangName -like "*Turk*") -or ` ($SysLocale.StartsWith("tr") -and $LangName -like "*Turk*") -or `
($SysLocale.StartsWith("uk") -and $LangName -like "*Ukrain*") -or ` ($SysLocale.StartsWith("uk") -and $LangName -like "*Ukrain*") -or `
($SysLocale.StartsWith("vi") -and $LangName -like "*Vietnam*")) { ($SysLocale.StartsWith("vi") -and $LangName -like "*Vietnam*")) {
return $True return $true
} }
return $False return $false
} }
function Add-Entry([int]$pos, [string]$Name, [array]$Items, [string]$DisplayName) function Add-Entry([int]$pos, [string]$Name, [array]$Items, [string]$DisplayName)
@@ -498,8 +488,8 @@ function ConvertTo-ImageSource
function Throw-Error([object]$Req, [string]$Alt) function Throw-Error([object]$Req, [string]$Alt)
{ {
$Err = $(GetElementById -Request $r -Id "errorModalMessage").innerText $Err = $(GetElementById -Request $Req -Id "errorModalMessage").innerText -replace "<[^>]+>" -replace "\s+", " "
if (-not $Err) { if (!$Err) {
$Err = $Alt $Err = $Alt
} else { } else {
$Err = [System.Text.Encoding]::UTF8.GetString([byte[]][char[]]$Err) $Err = [System.Text.Encoding]::UTF8.GetString([byte[]][char[]]$Err)
@@ -510,7 +500,7 @@ function Throw-Error([object]$Req, [string]$Alt)
# Translate a message string # Translate a message string
function Get-Translation([string]$Text) function Get-Translation([string]$Text)
{ {
if (-not $English -contains $Text) { if (!($English -contains $Text)) {
Write-Host "Error: '$Text' is not a translatable string" Write-Host "Error: '$Text' is not a translatable string"
return "(Untranslated)" return "(Untranslated)"
} }
@@ -548,7 +538,7 @@ function Error([string]$ErrorMessage)
if (!$Cmd) { if (!$Cmd) {
$XMLForm.Title = $(Get-Translation("Error")) + ": " + $ErrorMessage $XMLForm.Title = $(Get-Translation("Error")) + ": " + $ErrorMessage
Refresh-Control($XMLForm) Refresh-Control($XMLForm)
$XMLGrid.Children[2 * $script:Stage + 1].IsEnabled = $True $XMLGrid.Children[2 * $script:Stage + 1].IsEnabled = $true
$UserInput = [System.Windows.MessageBox]::Show($XMLForm.Title, $(Get-Translation("Error")), "OK", "Error") $UserInput = [System.Windows.MessageBox]::Show($XMLForm.Title, $(Get-Translation("Error")), "OK", "Error")
$script:ExitCode = $script:Stage-- $script:ExitCode = $script:Stage--
} else { } else {
@@ -601,7 +591,7 @@ $RequestData["GetLangs"] = @("a8f8f489-4c7f-463a-9ca6-5cff94d8d041", "getskuinfo
# This GUID applies to visitors of the en-US download page. Other locales may get a different GUID. # This GUID applies to visitors of the en-US download page. Other locales may get a different GUID.
$RequestData["GetLinks"] = @("6e2a1789-ef16-4f27-a296-74ef7ef5d96b", "GetProductDownloadLinksBySku" ) $RequestData["GetLinks"] = @("6e2a1789-ef16-4f27-a296-74ef7ef5d96b", "GetProductDownloadLinksBySku" )
# Create a semi-random Linux User-Agent string # Create a semi-random Linux User-Agent string
$FirefoxVersion = Get-Random -Minimum 50 -Maximum 90 $FirefoxVersion = Get-Random -Minimum 90 -Maximum 110
$FirefoxDate = Get-RandomDate $FirefoxDate = Get-RandomDate
$UserAgent = "Mozilla/5.0 (X11; Linux i586; rv:$FirefoxVersion.0) Gecko/$FirefoxDate Firefox/$FirefoxVersion.0" $UserAgent = "Mozilla/5.0 (X11; Linux i586; rv:$FirefoxVersion.0) Gecko/$FirefoxDate Firefox/$FirefoxVersion.0"
$Verbosity = 2 $Verbosity = 2
@@ -616,30 +606,25 @@ if ($Cmd) {
# Localization # Localization
$EnglishMessages = "en-US|Version|Release|Edition|Language|Architecture|Download|Continue|Back|Close|Cancel|Error|Please wait...|" + $EnglishMessages = "en-US|Version|Release|Edition|Language|Architecture|Download|Continue|Back|Close|Cancel|Error|Please wait...|" +
"Download using a browser|Temporarily banned by Microsoft for requesting too many downloads - Please try again later...|" + "Download using a browser|Download of Windows ISOs is unavailable due to Microsoft having altered their website to prevent it.|" +
"PowerShell 3.0 or later is required to run this script.|Do you want to go online and download it?" "PowerShell 3.0 or later is required to run this script.|Do you want to go online and download it?|" +
"This feature is not available on this platform."
[string[]]$English = $EnglishMessages.Split('|') [string[]]$English = $EnglishMessages.Split('|')
[string[]]$Localized = $null [string[]]$Localized = $null
if ($LocData -and (-not $LocData.StartsWith("en-US"))) { if ($LocData -and !$LocData.StartsWith("en-US")) {
$Localized = $LocData.Split('|') $Localized = $LocData.Split('|')
if ($Localized.Length -ne $English.Length) { # Adjust the $Localized array if we have more or fewer strings than in $EnglishMessages
Write-Host "Error: Missing or extra translated messages provided ($($Localized.Length)/$($English.Length))" if ($Localized.Length -lt $English.Length) {
exit 101 while ($Localized.Length -ne $English.Length) {
$Localized += $English[$Localized.Length]
}
} elseif ($Localized.Length -gt $English.Length) {
$Localized = $LocData.Split('|')[0..($English.Length - 1)]
} }
$Locale = $Localized[0] $Locale = $Localized[0]
} }
$QueryLocale = $Locale $QueryLocale = $Locale
# Make sure PowerShell 3.0 or later is used (for Invoke-WebRequest)
if ($PSVersionTable.PSVersion.Major -lt 3) {
Write-Host Error: PowerShell 3.0 or later is required to run this script.
$Msg = "$(Get-Translation($English[15]))`n$(Get-Translation($English[16]))"
if ([System.Windows.MessageBox]::Show($Msg, $(Get-Translation("Error")), "YesNo", "Error") -eq "Yes") {
Start-Process -FilePath https://www.microsoft.com/download/details.aspx?id=34595
}
exit 102
}
# Convert a size in bytes to a human readable string # Convert a size in bytes to a human readable string
function Size-To-Human-Readable([uint64]$size) function Size-To-Human-Readable([uint64]$size)
{ {
@@ -653,7 +638,8 @@ function Size-To-Human-Readable([uint64]$size)
} }
# Check if the locale we want is available - Fall back to en-US otherwise # Check if the locale we want is available - Fall back to en-US otherwise
function Check-Locale { function Check-Locale
{
try { try {
$url = "https://www.microsoft.com/" + $QueryLocale + "/software-download/" $url = "https://www.microsoft.com/" + $QueryLocale + "/software-download/"
if ($Verbosity -ge 2) { if ($Verbosity -ge 2) {
@@ -709,6 +695,17 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition)
} elseif ($WindowsVersions[$SelectedVersion][0][1].StartsWith("UEFI_SHELL")) { } elseif ($WindowsVersions[$SelectedVersion][0][1].StartsWith("UEFI_SHELL")) {
$languages += @(New-Object PsObject -Property @{ DisplayLanguage = "English (US)"; Language = "en-us"; Id = 0 }) $languages += @(New-Object PsObject -Property @{ DisplayLanguage = "English (US)"; Language = "en-us"; Id = 0 })
} else { } else {
# Microsoft download protection now requires the sessionId to be whitelisted through vlscppe.microsoft.com/tags
$url = "https://vlscppe.microsoft.com/tags?org_id=y6jn8c31&session_id=" + $SessionId
if ($Verbosity -ge 2) {
Write-Host Querying $url
}
try {
Invoke-WebRequest -UseBasicParsing -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
} catch {
Error($_.Exception.Message)
return @()
}
$url = "https://www.microsoft.com/" + $QueryLocale + "/api/controls/contentinclude/html" $url = "https://www.microsoft.com/" + $QueryLocale + "/api/controls/contentinclude/html"
$url += "?pageId=" + $RequestData["GetLangs"][0] $url += "?pageId=" + $RequestData["GetLangs"][0]
$url += "&host=www.microsoft.com" $url += "&host=www.microsoft.com"
@@ -723,11 +720,12 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition)
$script:SelectedIndex = 0 $script:SelectedIndex = 0
try { try {
$r = Invoke-WebRequest -UseBasicParsing -UserAgent $UserAgent -SessionVariable "Session" $url $r = Invoke-WebRequest -Method Post -UseBasicParsing -UserAgent $UserAgent -SessionVariable "Session" $url
if ($r -match "errorModalMessage") { if ($r -match "errorModalMessage") {
Throw-Error -Req $r -Alt "Could not retrieve languages from server" Throw-Error -Req $r -Alt "Could not retrieve languages from server"
} }
$pattern = '(?s)<select id="product-languages">(.*)?</select>' $r = $r -replace "`n" -replace "`r"
$pattern = '.*<select id="product-languages"[^>]*>(.*)</select>.*'
$html = [regex]::Match($r, $pattern).Groups[1].Value $html = [regex]::Match($r, $pattern).Groups[1].Value
# Go through an XML conversion to keep all PowerShells happy... # Go through an XML conversion to keep all PowerShells happy...
$html = $html.Replace("selected value", "value") $html = $html.Replace("selected value", "value")
@@ -778,7 +776,7 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
$xml = New-Object System.Xml.XmlDocument $xml = New-Object System.Xml.XmlDocument
if ($Verbosity -ge 2) { if ($Verbosity -ge 2) {
Write-Host Querying $url Write-Host Querying $url
} }
$xml.Load($url) $xml.Load($url)
$sep = "" $sep = ""
$archs = "" $archs = ""
@@ -810,20 +808,17 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
try { try {
$Is64 = [Environment]::Is64BitOperatingSystem $Is64 = [Environment]::Is64BitOperatingSystem
# Must add a referer for POST requests, else Microsoft's servers will deny them # Must add a referer for this request, else Microsoft's servers will deny it
$ref = "https://www.microsoft.com/software-download/windows11" $ref = "https://www.microsoft.com/software-download/windows11"
$wr = [System.Net.WebRequest]::Create($url) $r = Invoke-WebRequest -Method Post -Headers @{ "Referer" = $ref } -UseBasicParsing -UserAgent $UserAgent -WebSession $Session $url
# Windows 7 PowerShell doesn't support 'Invoke-WebRequest -Headers @{"Referer" = $ref}'
# (produces "The 'Referer' header must be modified using the appropriate property or method")
# so we use StreamReader() with GetResponseStream() and do this whole gymkhana instead...
$wr.Method = "POST"
$wr.Referer = $ref
$wr.UserAgent = $UserAgent
$wr.ContentLength = 0
$sr = New-Object System.IO.StreamReader($wr.GetResponse().GetResponseStream())
$r = $sr.ReadToEnd()
if ($r -match "errorModalMessage") { if ($r -match "errorModalMessage") {
Throw-Error -Req $r -Alt "Could not retrieve architectures from server" $Alt = [regex]::Match($r, '<p id="errorModalMessage">(.+?)<\/p>').Groups[1].Value -replace "<[^>]+>" -replace "\s+", " " -replace "\?\?\?", "-"
if (!$Alt) {
$Alt = "Could not retrieve architectures from server"
} else {
$Alt += " " + $SessionId + "."
}
Throw-Error -Req $r -Alt $Alt
} }
$pattern = '(?s)(<input.*?></input>)' $pattern = '(?s)(<input.*?></input>)'
ForEach-Object { [regex]::Matches($r, $pattern) } | ForEach-Object { $html += $_.Groups[1].value } ForEach-Object { [regex]::Matches($r, $pattern) } | ForEach-Object { $html += $_.Groups[1].value }
@@ -838,7 +833,7 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
foreach ($var in $xml.inputs.input) { foreach ($var in $xml.inputs.input) {
$json = $var.value | ConvertFrom-Json; $json = $var.value | ConvertFrom-Json;
if ($json) { if ($json) {
if (($Is64 -and $json.DownloadType -eq "x64") -or (-not $Is64 -and $json.DownloadType -eq "x86")) { if (($Is64 -and $json.DownloadType -eq "x64") -or (!$Is64 -and $json.DownloadType -eq "x86")) {
$script:SelectedIndex = $i $script:SelectedIndex = $i
} }
$links += @(New-Object PsObject -Property @{ Type = $json.DownloadType; Link = $json.Uri }) $links += @(New-Object PsObject -Property @{ Type = $json.DownloadType; Link = $json.Uri })
@@ -860,7 +855,7 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
function Process-Download-Link([string]$Url) function Process-Download-Link([string]$Url)
{ {
try { try {
if ($PipeName -and -not $Check.IsChecked) { if ($PipeName -and !$Check.IsChecked) {
Send-Message -PipeName $PipeName -Message $Url Send-Message -PipeName $PipeName -Message $Url
} else { } else {
if ($Cmd) { if ($Cmd) {
@@ -871,7 +866,7 @@ function Process-Download-Link([string]$Url)
$tmp_size = [uint64]::Parse($str_size) $tmp_size = [uint64]::Parse($str_size)
$Size = Size-To-Human-Readable $tmp_size $Size = Size-To-Human-Readable $tmp_size
Write-Host "Downloading '$File' ($Size)..." Write-Host "Downloading '$File' ($Size)..."
Invoke-WebRequest -UseBasicParsing -Uri $Url -OutFile $File Start-BitsTransfer -Source $Url -Destination $File
} else { } else {
Write-Host Download Link: $Url Write-Host Download Link: $Url
Start-Process -FilePath $Url Start-Process -FilePath $Url
@@ -892,6 +887,12 @@ if ($Cmd) {
$winLanguageName = $null $winLanguageName = $null
$winLink = $null $winLink = $null
# Windows 7 and non Windows platforms are too much of a liability
if ($winver -le 6.1) {
Error(Get-Translation("This feature is not available on this platform."))
exit 403
}
$i = 0 $i = 0
$Selected = "" $Selected = ""
if ($Win -eq "List") { if ($Win -eq "List") {
@@ -952,7 +953,7 @@ if ($Cmd) {
if (!$Ed -and $Verbosity -ge 1) { if (!$Ed -and $Verbosity -ge 1) {
Write-Host "No edition specified (-Ed). Defaulting to '$($edition.Edition)'." Write-Host "No edition specified (-Ed). Defaulting to '$($edition.Edition)'."
} }
$Selected += "," + $edition.Edition -replace "Windows [0-9\.]*", "" $Selected += "," + $edition.Edition -replace "Windows [0-9\.]*"
$winEditionId = $edition.Id $winEditionId = $edition.Id
break; break;
} }
@@ -1050,7 +1051,7 @@ $XMLForm.Title = $AppTitle
if ($Icon) { if ($Icon) {
$XMLForm.Icon = $Icon $XMLForm.Icon = $Icon
} else { } else {
$XMLForm.Icon = [Gui.Utils]::ExtractIcon("shell32.dll", -41, $true) | ConvertTo-ImageSource $XMLForm.Icon = [WinAPI.Utils]::ExtractIcon("imageres.dll", -5205, $true) | ConvertTo-ImageSource
} }
if ($Locale.StartsWith("ar") -or $Locale.StartsWith("fa") -or $Locale.StartsWith("he")) { if ($Locale.StartsWith("ar") -or $Locale.StartsWith("fa") -or $Locale.StartsWith("he")) {
$XMLForm.FlowDirection = "RightToLeft" $XMLForm.FlowDirection = "RightToLeft"
@@ -1059,6 +1060,12 @@ $WindowsVersionTitle.Text = Get-Translation("Version")
$Continue.Content = Get-Translation("Continue") $Continue.Content = Get-Translation("Continue")
$Back.Content = Get-Translation("Close") $Back.Content = Get-Translation("Close")
# Windows 7 and non Windows platforms are too much of a liability
if ($winver -le 6.1) {
Error(Get-Translation("This feature is not available on this platform."))
exit 403
}
# Populate the Windows versions # Populate the Windows versions
$i = 0 $i = 0
$versions = @() $versions = @()
@@ -1072,9 +1079,9 @@ $WindowsVersion.DisplayMemberPath = "Version"
# Button Action # Button Action
$Continue.add_click({ $Continue.add_click({
$script:Stage++ $script:Stage++
$XMLGrid.Children[2 * $Stage + 1].IsEnabled = $False $XMLGrid.Children[2 * $Stage + 1].IsEnabled = $false
$Continue.IsEnabled = $False $Continue.IsEnabled = $false
$Back.IsEnabled = $False $Back.IsEnabled = $false
Refresh-Control($Continue) Refresh-Control($Continue)
Refresh-Control($Back) Refresh-Control($Back)
@@ -1083,7 +1090,7 @@ $Continue.add_click({
1 { # Windows Version selection 1 { # Windows Version selection
$XMLForm.Title = Get-Translation($English[12]) $XMLForm.Title = Get-Translation($English[12])
Refresh-Control($XMLForm) Refresh-Control($XMLForm)
if ($WindowsVersion.SelectedValue.Version.StartsWith("Windows") -and $WindowsVersion.SelectedValue.Version -ne "Windows 7") { if ($WindowsVersion.SelectedValue.Version.StartsWith("Windows")) {
Check-Locale Check-Locale
} }
$releases = Get-Windows-Releases $WindowsVersion.SelectedValue.Index $releases = Get-Windows-Releases $WindowsVersion.SelectedValue.Index
@@ -1142,9 +1149,9 @@ $Continue.add_click({
$XMLForm.Close() $XMLForm.Close()
} }
} }
$Continue.IsEnabled = $True $Continue.IsEnabled = $true
if ($Stage -ge 0) { if ($Stage -ge 0) {
$Back.IsEnabled = $True $Back.IsEnabled = $true
} }
}) })
@@ -1154,7 +1161,7 @@ $Back.add_click({
} else { } else {
$XMLGrid.Children.RemoveAt(2 * $Stage + 3) $XMLGrid.Children.RemoveAt(2 * $Stage + 3)
$XMLGrid.Children.RemoveAt(2 * $Stage + 2) $XMLGrid.Children.RemoveAt(2 * $Stage + 2)
$XMLGrid.Children[2 * $Stage + 1].IsEnabled = $True $XMLGrid.Children[2 * $Stage + 1].IsEnabled = $true
$dh2 = $dh $dh2 = $dh
if ($Stage -eq 4 -and $PipeName) { if ($Stage -eq 4 -and $PipeName) {
$Check.Visibility = "Collapsed" $Check.Visibility = "Collapsed"
@@ -1179,17 +1186,17 @@ $Back.add_click({
}) })
# Display the dialog # Display the dialog
$XMLForm.Add_Loaded( { $XMLForm.Activate() } ) $XMLForm.Add_Loaded({$XMLForm.Activate()})
$XMLForm.ShowDialog() | Out-Null $XMLForm.ShowDialog() | Out-Null
# Clean up & exit # Clean up & exit
exit $ExitCode exit $ExitCode
# SIG # Begin signature block # SIG # Begin signature block
# MIIkWQYJKoZIhvcNAQcCoIIkSjCCJEYCAQExDzANBglghkgBZQMEAgEFADB5Bgor # MIIkWAYJKoZIhvcNAQcCoIIkSTCCJEUCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBY/5IAG/GViBcd # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCMJv431qiE9xy1
# 1JTY1vmyD3aBIuP9LO6GCK/ojLlAlKCCElkwggVvMIIEV6ADAgECAhBI/JO0YFWU # 2Km7MvT+QN0u+/w5ek1xMY9QLEDXQqCCElkwggVvMIIEV6ADAgECAhBI/JO0YFWU
# jTanyYqJ1pQWMA0GCSqGSIb3DQEBDAUAMHsxCzAJBgNVBAYTAkdCMRswGQYDVQQI # jTanyYqJ1pQWMA0GCSqGSIb3DQEBDAUAMHsxCzAJBgNVBAYTAkdCMRswGQYDVQQI
# DBJHcmVhdGVyI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RKmh2NBkSJOJn+5gNfINmhJ8LtKvuRhuW+7NvpBoKqsepBz
# LgWGsxXn040/9cei5szi4Z4ltGUYI7gdNTYafRS/mCRbgfITpfzlpAzk07II # E8lsh852z2vlN1kD7XAw1yDw4hTaJJrtA5V3q593/svRL5j9N+stc2dY2C0=
# SIG # End signature block # SIG # End signature block

View File

@@ -1,35 +0,0 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>6CAFC0C6-A428-4d30-A9F9-700E829FEA51</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Fido</RootNamespace>
<AssemblyName>Fido</AssemblyName>
<Name>Frida</Name>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup />
<ItemGroup>
<Compile Include="Fido.ps1" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Target Name="Build" />
<Import Project="$(MSBuildExtensionsPath)\PowerShell Tools for Visual Studio\PowerShellTools.targets" Condition="Exists('$(MSBuildExtensionsPath)\PowerShell Tools for Visual Studio\PowerShellTools.targets')" />
</Project>

View File

@@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.271
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F5034706-568F-408A-B7B3-4D38C6DB8A32}") = "Fido", "Fido.pssproj", "{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AD54CEAE-0992-4213-BEDB-8F1CF98A9F22}
EndGlobalSection
EndGlobal

View File

@@ -21,7 +21,7 @@ sign_file() {
} }
# Update the Authenticode signature # Update the Authenticode signature
cmd.exe /c '"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64\signtool" sign /v /sha1 3dbc3a2a0e9ce8803b422cfdbc60acd33164965d /fd SHA256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 Fido.ps1' MSYS2_ARG_CONV_EXCL='*' "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64\signtool" sign /v /sha1 3dbc3a2a0e9ce8803b422cfdbc60acd33164965d /fd SHA256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 Fido.ps1
read -s -p "Enter pass phrase for `realpath $PRIVATE_KEY`: " PASSWORD read -s -p "Enter pass phrase for `realpath $PRIVATE_KEY`: " PASSWORD
echo echo
# Confirm that the pass phrase is valid by trying to sign a dummy file # Confirm that the pass phrase is valid by trying to sign a dummy file