Modernize MrTrust GUI
All checks were successful
Build MrTrust / build (push) Successful in 5m57s

This commit is contained in:
MrSphay
2026-05-16 13:43:52 +02:00
parent a1819900b1
commit f5303fc536
2 changed files with 262 additions and 122 deletions

View File

@@ -59,7 +59,7 @@ jobs:
path: dist/MrTrust-${{ env.MRTRUST_VERSION }}.zip path: dist/MrTrust-${{ env.MRTRUST_VERSION }}.zip
- name: Attach ZIP to Gitea release - name: Attach ZIP to Gitea release
if: github.event_name == 'push' && github.ref == 'refs/heads/main' if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
shell: bash shell: bash
env: env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -14,16 +14,20 @@ $script:SelectedFilePath = $null
$script:CurrentAccent = 0 $script:CurrentAccent = 0
$colors = @{ $colors = @{
Background = [Drawing.Color]::FromArgb(18, 23, 26) Background = [Drawing.Color]::FromArgb(15, 20, 20)
Panel = [Drawing.Color]::FromArgb(27, 33, 36) Shell = [Drawing.Color]::FromArgb(20, 27, 27)
PanelAlt = [Drawing.Color]::FromArgb(35, 43, 47) Panel = [Drawing.Color]::FromArgb(27, 36, 35)
Border = [Drawing.Color]::FromArgb(61, 73, 79) PanelAlt = [Drawing.Color]::FromArgb(34, 45, 43)
Text = [Drawing.Color]::FromArgb(234, 239, 236) PanelSelected = [Drawing.Color]::FromArgb(31, 64, 49)
Muted = [Drawing.Color]::FromArgb(165, 180, 172) Border = [Drawing.Color]::FromArgb(53, 66, 64)
Green = [Drawing.Color]::FromArgb(28, 185, 111) Text = [Drawing.Color]::FromArgb(239, 244, 241)
GreenHover = [Drawing.Color]::FromArgb(38, 205, 130) Muted = [Drawing.Color]::FromArgb(157, 172, 166)
Green = [Drawing.Color]::FromArgb(0, 175, 91)
GreenHover = [Drawing.Color]::FromArgb(0, 199, 104)
GreenSoft = [Drawing.Color]::FromArgb(34, 76, 52)
Orange = [Drawing.Color]::FromArgb(242, 153, 74) Orange = [Drawing.Color]::FromArgb(242, 153, 74)
Red = [Drawing.Color]::FromArgb(235, 87, 87) Red = [Drawing.Color]::FromArgb(235, 87, 87)
Blue = [Drawing.Color]::FromArgb(82, 166, 255)
} }
function Test-IsAdministrator { function Test-IsAdministrator {
@@ -127,6 +131,89 @@ function New-Label {
$label $label
} }
function New-Card {
param(
[int]$X,
[int]$Y,
[int]$Width,
[int]$Height,
[Drawing.Color]$BackColor = $colors.Panel
)
$panel = [Windows.Forms.Panel]::new()
$panel.Location = [Drawing.Point]::new($X, $Y)
$panel.Size = [Drawing.Size]::new($Width, $Height)
$panel.BackColor = $BackColor
$panel.BorderStyle = "FixedSingle"
$panel.Anchor = "Top,Left,Right"
$panel
}
function New-PageTitle {
param(
[string]$Title,
[string]$Description
)
$titleLabel = New-Label -Text $Title -X 0 -Y 0 -Width 760 -Height 34 -Color $colors.Text -Font ([Drawing.Font]::new("Segoe UI", 15, [Drawing.FontStyle]::Bold))
$descriptionLabel = New-Label -Text $Description -X 1 -Y 38 -Width 850 -Height 24 -Color $colors.Muted
[pscustomobject]@{
Title = $titleLabel
Description = $descriptionLabel
}
}
function New-NavButton {
param(
[Parameter(Mandatory)][string]$Key,
[Parameter(Mandatory)][string]$Text,
[Parameter(Mandatory)][int]$Y
)
$button = [Windows.Forms.Button]::new()
$button.Text = $Text
$button.Tag = $Key
$button.Size = [Drawing.Size]::new(174, 44)
$button.Location = [Drawing.Point]::new(22, $Y)
$button.TextAlign = "MiddleLeft"
$button.Padding = [Windows.Forms.Padding]::new(14, 0, 0, 0)
$button.Font = [Drawing.Font]::new("Segoe UI", 10, [Drawing.FontStyle]::Bold)
$button.FlatStyle = "Flat"
$button.FlatAppearance.BorderSize = 1
$button.FlatAppearance.BorderColor = $colors.Shell
$button.BackColor = $colors.Shell
$button.ForeColor = $colors.Muted
$button.Cursor = [Windows.Forms.Cursors]::Hand
$button.Add_MouseEnter({ param($sender, $eventArgs) if ($script:ActivePage -ne $sender.Tag) { $sender.BackColor = $colors.PanelAlt } }.GetNewClosure())
$button.Add_MouseLeave({ param($sender, $eventArgs) if ($script:ActivePage -ne $sender.Tag) { $sender.BackColor = $colors.Shell } }.GetNewClosure())
$button.Add_Click({ param($sender, $eventArgs) Show-MrTrustPage -Key $sender.Tag })
$button
}
function Show-MrTrustPage {
param([Parameter(Mandatory)][string]$Key)
$script:ActivePage = $Key
foreach ($pageKey in $script:Pages.Keys) {
$script:Pages[$pageKey].Visible = $pageKey -eq $Key
}
foreach ($buttonKey in $script:NavButtons.Keys) {
$button = $script:NavButtons[$buttonKey]
if ($buttonKey -eq $Key) {
$button.BackColor = $colors.PanelSelected
$button.FlatAppearance.BorderColor = $colors.Green
$button.ForeColor = $colors.Text
}
else {
$button.BackColor = $colors.Shell
$button.FlatAppearance.BorderColor = $colors.Shell
$button.ForeColor = $colors.Muted
}
}
}
function Update-TrustStatus { function Update-TrustStatus {
try { try {
Set-Busy $true Set-Busy $true
@@ -291,8 +378,8 @@ function Test-SelectedFile {
$form = [Windows.Forms.Form]::new() $form = [Windows.Forms.Form]::new()
$form.Text = "MrTrust" $form.Text = "MrTrust"
$form.StartPosition = "CenterScreen" $form.StartPosition = "CenterScreen"
$form.ClientSize = [Drawing.Size]::new(980, 660) $form.ClientSize = [Drawing.Size]::new(1120, 720)
$form.MinimumSize = [Drawing.Size]::new(920, 620) $form.MinimumSize = [Drawing.Size]::new(1040, 680)
$form.BackColor = $colors.Background $form.BackColor = $colors.Background
$form.Font = [Drawing.Font]::new("Segoe UI", 10) $form.Font = [Drawing.Font]::new("Segoe UI", 10)
if (Test-Path -LiteralPath $script:IconPath) { if (Test-Path -LiteralPath $script:IconPath) {
@@ -301,187 +388,235 @@ if (Test-Path -LiteralPath $script:IconPath) {
$header = [Windows.Forms.Panel]::new() $header = [Windows.Forms.Panel]::new()
$header.Dock = "Top" $header.Dock = "Top"
$header.Height = 126 $header.Height = 96
$header.BackColor = $colors.Panel $header.BackColor = $colors.Background
$form.Controls.Add($header) $form.Controls.Add($header)
$accent = [Windows.Forms.Panel]::new() $brandLine = [Windows.Forms.Panel]::new()
$accent.Dock = "Left" $brandLine.Dock = "Bottom"
$accent.Width = 8 $brandLine.Height = 1
$accent.BackColor = $colors.Green $brandLine.BackColor = $colors.Border
$header.Controls.Add($accent) $header.Controls.Add($brandLine)
$logoBox = [Windows.Forms.PictureBox]::new() $logoBox = [Windows.Forms.PictureBox]::new()
$logoBox.Size = [Drawing.Size]::new(46, 46) $logoBox.Size = [Drawing.Size]::new(42, 42)
$logoBox.Location = [Drawing.Point]::new(34, 30) $logoBox.Location = [Drawing.Point]::new(28, 26)
$logoBox.SizeMode = "StretchImage" $logoBox.SizeMode = "StretchImage"
if (Test-Path -LiteralPath $script:IconPath) { if (Test-Path -LiteralPath $script:IconPath) {
$logoBox.Image = [Drawing.Icon]::new($script:IconPath).ToBitmap() $logoBox.Image = [Drawing.Icon]::new($script:IconPath).ToBitmap()
} }
$header.Controls.Add($logoBox) $header.Controls.Add($logoBox)
$title = New-Label -Text "MrTrust" -X 96 -Y 22 -Width 260 -Height 48 -Color $colors.Text -Font ([Drawing.Font]::new("Segoe UI", 25, [Drawing.FontStyle]::Bold)) $title = New-Label -Text "MrTrust" -X 86 -Y 20 -Width 260 -Height 36 -Color $colors.Text -Font ([Drawing.Font]::new("Segoe UI", 18, [Drawing.FontStyle]::Bold))
$header.Controls.Add($title) $header.Controls.Add($title)
$subtitle = New-Label -Text "Trust diagnostics for MrSphay signed Windows apps" -X 100 -Y 76 -Width 520 -Height 24 -Color $colors.Muted $subtitle = New-Label -Text "Local certificate trust for MrSphay signed Windows apps" -X 88 -Y 56 -Width 520 -Height 24 -Color $colors.Muted
$header.Controls.Add($subtitle) $header.Controls.Add($subtitle)
$statusText = New-Label -Text "Status" -X 720 -Y 31 -Width 180 -Height 22 $statusCard = [Windows.Forms.Panel]::new()
$header.Controls.Add($statusText) $statusCard.Anchor = "Top,Right"
$statusCard.Location = [Drawing.Point]::new(780, 20)
$statusCard.Size = [Drawing.Size]::new(300, 56)
$statusCard.BackColor = $colors.Panel
$statusCard.BorderStyle = "FixedSingle"
$header.Controls.Add($statusCard)
$statusText = New-Label -Text "Trust status" -X 18 -Y 7 -Width 130 -Height 20 -Color $colors.Muted -Font ([Drawing.Font]::new("Segoe UI", 8.5))
$statusCard.Controls.Add($statusText)
$script:StatusPill = [Windows.Forms.Panel]::new() $script:StatusPill = [Windows.Forms.Panel]::new()
$script:StatusPill.Size = [Drawing.Size]::new(16, 16) $script:StatusPill.Size = [Drawing.Size]::new(14, 14)
$script:StatusPill.Location = [Drawing.Point]::new(720, 63) $script:StatusPill.Location = [Drawing.Point]::new(18, 31)
$script:StatusPill.BackColor = $colors.Orange $script:StatusPill.BackColor = $colors.Orange
$header.Controls.Add($script:StatusPill) $statusCard.Controls.Add($script:StatusPill)
$script:StatusLabel = New-Label -Text "Checking..." -X 748 -Y 58 -Width 190 -Height 28 -Color $colors.Text $script:StatusLabel = New-Label -Text "Checking..." -X 40 -Y 26 -Width 210 -Height 24 -Color $colors.Text -Font ([Drawing.Font]::new("Segoe UI", 10, [Drawing.FontStyle]::Bold))
$script:StatusLabel.AutoEllipsis = $true $script:StatusLabel.AutoEllipsis = $true
$header.Controls.Add($script:StatusLabel) $statusCard.Controls.Add($script:StatusLabel)
$script:ProgressBar = [Windows.Forms.ProgressBar]::new() $script:ProgressBar = [Windows.Forms.ProgressBar]::new()
$script:ProgressBar.Location = [Drawing.Point]::new(100, 108) $script:ProgressBar.Anchor = "Top,Left,Right"
$script:ProgressBar.Size = [Drawing.Size]::new(820, 5) $script:ProgressBar.Location = [Drawing.Point]::new(28, 86)
$script:ProgressBar.Size = [Drawing.Size]::new(1052, 4)
$script:ProgressBar.Visible = $false $script:ProgressBar.Visible = $false
$header.Controls.Add($script:ProgressBar) $header.Controls.Add($script:ProgressBar)
$tabControl = [Windows.Forms.TabControl]::new() $shell = [Windows.Forms.Panel]::new()
$tabControl.Dock = "Fill" $shell.Dock = "Fill"
$tabControl.Appearance = "Normal" $shell.BackColor = $colors.Background
$tabControl.BackColor = $colors.Background $form.Controls.Add($shell)
$tabControl.ForeColor = $colors.Text
$form.Controls.Add($tabControl)
$trustTab = [Windows.Forms.TabPage]::new() $sidebar = [Windows.Forms.Panel]::new()
$trustTab.Text = "Trust" $sidebar.Dock = "Left"
$trustTab.BackColor = $colors.Background $sidebar.Width = 220
$tabControl.TabPages.Add($trustTab) $sidebar.BackColor = $colors.Shell
$shell.Controls.Add($sidebar)
$diagnosticsTab = [Windows.Forms.TabPage]::new() $sideAccent = [Windows.Forms.Panel]::new()
$diagnosticsTab.Text = "Diagnostics" $sideAccent.Dock = "Left"
$diagnosticsTab.BackColor = $colors.Background $sideAccent.Width = 4
$tabControl.TabPages.Add($diagnosticsTab) $sideAccent.BackColor = $colors.Green
$sidebar.Controls.Add($sideAccent)
$helpTab = [Windows.Forms.TabPage]::new() $navTitle = New-Label -Text "Navigation" -X 24 -Y 26 -Width 160 -Height 22 -Color $colors.Muted -Font ([Drawing.Font]::new("Segoe UI", 8.5, [Drawing.FontStyle]::Bold))
$helpTab.Text = "SmartScreen" $sidebar.Controls.Add($navTitle)
$helpTab.BackColor = $colors.Background
$tabControl.TabPages.Add($helpTab)
$trustPanel = [Windows.Forms.Panel]::new() $script:NavButtons = @{}
$trustPanel.BackColor = $colors.Panel $script:NavButtons.Trust = New-NavButton -Key "Trust" -Text "Trust" -Y 58
$trustPanel.Size = [Drawing.Size]::new(880, 245) $script:NavButtons.Diagnostics = New-NavButton -Key "Diagnostics" -Text "File scan" -Y 110
$trustPanel.Location = [Drawing.Point]::new(36, 34) $script:NavButtons.SmartScreen = New-NavButton -Key "SmartScreen" -Text "SmartScreen" -Y 162
$trustTab.Controls.Add($trustPanel) foreach ($navButton in $script:NavButtons.Values) {
$sidebar.Controls.Add($navButton)
}
$scopeLabel = New-Label -Text "Scope" -X 26 -Y 24 $sideNote = New-Label -Text "Installs public certificates only. No Defender, SmartScreen, UAC, firewall, or policy bypasses." -X 24 -Y 510 -Width 164 -Height 96 -Color $colors.Muted -Font ([Drawing.Font]::new("Segoe UI", 8.5))
$sideNote.Anchor = "Left,Bottom"
$sidebar.Controls.Add($sideNote)
$contentHost = [Windows.Forms.Panel]::new()
$contentHost.Dock = "Fill"
$contentHost.BackColor = $colors.Background
$contentHost.Padding = [Windows.Forms.Padding]::new(34, 30, 34, 30)
$shell.Controls.Add($contentHost)
$script:Pages = @{}
$trustPage = [Windows.Forms.Panel]::new()
$trustPage.Dock = "Fill"
$trustPage.BackColor = $colors.Background
$contentHost.Controls.Add($trustPage)
$script:Pages.Trust = $trustPage
$trustTitle = New-PageTitle -Title "Trust" -Description "Install, remove, and verify the MrSphay public trust certificates."
$trustPage.Controls.Add($trustTitle.Title)
$trustPage.Controls.Add($trustTitle.Description)
$trustPanel = New-Card -X 0 -Y 82 -Width 820 -Height 236
$trustPage.Controls.Add($trustPanel)
$scopeLabel = New-Label -Text "Scope" -X 24 -Y 22 -Width 160 -Height 22 -Color $colors.Muted -Font ([Drawing.Font]::new("Segoe UI", 8.5, [Drawing.FontStyle]::Bold))
$trustPanel.Controls.Add($scopeLabel) $trustPanel.Controls.Add($scopeLabel)
$script:AllUsersCheckBox = [Windows.Forms.CheckBox]::new() $script:AllUsersCheckBox = [Windows.Forms.CheckBox]::new()
$script:AllUsersCheckBox.Text = "Install for all users (requires Administrator)" $script:AllUsersCheckBox.Text = "All users (LocalMachine, requires Administrator)"
$script:AllUsersCheckBox.ForeColor = $colors.Text $script:AllUsersCheckBox.ForeColor = $colors.Text
$script:AllUsersCheckBox.Location = [Drawing.Point]::new(26, 50) $script:AllUsersCheckBox.Location = [Drawing.Point]::new(24, 46)
$script:AllUsersCheckBox.AutoSize = $true $script:AllUsersCheckBox.AutoSize = $true
$script:AllUsersCheckBox.FlatStyle = "Flat" $script:AllUsersCheckBox.FlatStyle = "Flat"
$script:AllUsersCheckBox.Add_CheckedChanged({ Update-TrustStatus }) $script:AllUsersCheckBox.Add_CheckedChanged({ Update-TrustStatus })
$trustPanel.Controls.Add($script:AllUsersCheckBox) $trustPanel.Controls.Add($script:AllUsersCheckBox)
$trustPanel.Controls.Add((New-Label -Text "Root thumbprint" -X 26 -Y 92)) $trustPanel.Controls.Add((New-Label -Text "Root thumbprint" -X 24 -Y 90 -Width 170 -Height 24))
$script:RootThumbprintLabel = New-Label -Text "-" -X 205 -Y 92 -Width 580 -Height 24 -Color $colors.Text -Font ([Drawing.Font]::new("Consolas", 9)) $script:RootThumbprintLabel = New-Label -Text "-" -X 210 -Y 90 -Width 560 -Height 24 -Color $colors.Text -Font ([Drawing.Font]::new("Consolas", 9))
$script:RootThumbprintLabel.AutoEllipsis = $true
$trustPanel.Controls.Add($script:RootThumbprintLabel) $trustPanel.Controls.Add($script:RootThumbprintLabel)
$trustPanel.Controls.Add((New-Label -Text "Publisher thumbprint" -X 26 -Y 126)) $trustPanel.Controls.Add((New-Label -Text "Publisher thumbprint" -X 24 -Y 124 -Width 170 -Height 24))
$script:PublisherThumbprintLabel = New-Label -Text "-" -X 205 -Y 126 -Width 580 -Height 24 -Color $colors.Text -Font ([Drawing.Font]::new("Consolas", 9)) $script:PublisherThumbprintLabel = New-Label -Text "-" -X 210 -Y 124 -Width 560 -Height 24 -Color $colors.Text -Font ([Drawing.Font]::new("Consolas", 9))
$script:PublisherThumbprintLabel.AutoEllipsis = $true
$trustPanel.Controls.Add($script:PublisherThumbprintLabel) $trustPanel.Controls.Add($script:PublisherThumbprintLabel)
$trustPanel.Controls.Add((New-Label -Text "Expires" -X 26 -Y 160)) $trustPanel.Controls.Add((New-Label -Text "Expires" -X 24 -Y 158 -Width 170 -Height 24))
$script:ExpiryLabel = New-Label -Text "-" -X 205 -Y 160 -Width 200 -Height 24 -Color $colors.Text $script:ExpiryLabel = New-Label -Text "-" -X 210 -Y 158 -Width 180 -Height 24 -Color $colors.Text
$trustPanel.Controls.Add($script:ExpiryLabel) $trustPanel.Controls.Add($script:ExpiryLabel)
$trustPanel.Controls.Add((New-Label -Text "Active scope" -X 26 -Y 194)) $trustPanel.Controls.Add((New-Label -Text "Active scope" -X 24 -Y 192 -Width 170 -Height 24))
$script:ScopeValueLabel = New-Label -Text "-" -X 205 -Y 194 -Width 200 -Height 24 -Color $colors.Text $script:ScopeValueLabel = New-Label -Text "-" -X 210 -Y 192 -Width 200 -Height 24 -Color $colors.Text
$trustPanel.Controls.Add($script:ScopeValueLabel) $trustPanel.Controls.Add($script:ScopeValueLabel)
$script:TrustSummaryLabel = New-Label -Text "Checking trust state..." -X 36 -Y 306 -Width 860 -Height 42 -Color $colors.Muted $summaryPanel = New-Card -X 0 -Y 338 -Width 820 -Height 76 -BackColor $colors.PanelAlt
$trustTab.Controls.Add($script:TrustSummaryLabel) $trustPage.Controls.Add($summaryPanel)
$script:TrustSummaryLabel = New-Label -Text "Checking trust state..." -X 22 -Y 18 -Width 760 -Height 34 -Color $colors.Text -Font ([Drawing.Font]::new("Segoe UI", 10, [Drawing.FontStyle]::Bold))
$summaryPanel.Controls.Add($script:TrustSummaryLabel)
$installButton = [Windows.Forms.Button]::new() $installButton = [Windows.Forms.Button]::new()
$installButton.Text = "Install trust" $installButton.Text = "Install trust"
$installButton.Size = [Drawing.Size]::new(180, 48) $installButton.Size = [Drawing.Size]::new(160, 44)
$installButton.Location = [Drawing.Point]::new(36, 372) $installButton.Location = [Drawing.Point]::new(0, 438)
Add-AnimatedButton -Button $installButton -Normal $colors.Green -Hover $colors.GreenHover Add-AnimatedButton -Button $installButton -Normal $colors.Green -Hover $colors.GreenHover
$installButton.Add_Click({ Install-MrTrustCertificates }) $installButton.Add_Click({ Install-MrTrustCertificates })
$trustTab.Controls.Add($installButton) $trustPage.Controls.Add($installButton)
$removeButton = [Windows.Forms.Button]::new() $removeButton = [Windows.Forms.Button]::new()
$removeButton.Text = "Remove trust" $removeButton.Text = "Remove trust"
$removeButton.Size = [Drawing.Size]::new(180, 48) $removeButton.Size = [Drawing.Size]::new(160, 44)
$removeButton.Location = [Drawing.Point]::new(238, 372) $removeButton.Location = [Drawing.Point]::new(176, 438)
Add-AnimatedButton -Button $removeButton -Normal $colors.PanelAlt -Hover $colors.Border Add-AnimatedButton -Button $removeButton -Normal $colors.PanelAlt -Hover $colors.Border
$removeButton.Add_Click({ Remove-MrTrustCertificates }) $removeButton.Add_Click({ Remove-MrTrustCertificates })
$trustTab.Controls.Add($removeButton) $trustPage.Controls.Add($removeButton)
$refreshButton = [Windows.Forms.Button]::new() $refreshButton = [Windows.Forms.Button]::new()
$refreshButton.Text = "Refresh" $refreshButton.Text = "Refresh"
$refreshButton.Size = [Drawing.Size]::new(140, 48) $refreshButton.Size = [Drawing.Size]::new(124, 44)
$refreshButton.Location = [Drawing.Point]::new(440, 372) $refreshButton.Location = [Drawing.Point]::new(352, 438)
Add-AnimatedButton -Button $refreshButton -Normal $colors.PanelAlt -Hover $colors.Border Add-AnimatedButton -Button $refreshButton -Normal $colors.PanelAlt -Hover $colors.Border
$refreshButton.Add_Click({ Update-TrustStatus }) $refreshButton.Add_Click({ Update-TrustStatus })
$trustTab.Controls.Add($refreshButton) $trustPage.Controls.Add($refreshButton)
$note = New-Label -Text "MrTrust installs public certificates only. It does not disable Defender, SmartScreen, UAC, or enterprise policies." -X 36 -Y 456 -Width 880 -Height 46 -Color $colors.Muted $note = New-Label -Text "Trust actions are reversible and scoped to the selected Windows certificate store." -X 0 -Y 508 -Width 820 -Height 26 -Color $colors.Muted
$trustTab.Controls.Add($note) $trustPage.Controls.Add($note)
$filePanel = [Windows.Forms.Panel]::new() $diagnosticsPage = [Windows.Forms.Panel]::new()
$filePanel.BackColor = $colors.Panel $diagnosticsPage.Dock = "Fill"
$filePanel.Size = [Drawing.Size]::new(880, 420) $diagnosticsPage.BackColor = $colors.Background
$filePanel.Location = [Drawing.Point]::new(36, 34) $diagnosticsPage.Visible = $false
$diagnosticsTab.Controls.Add($filePanel) $contentHost.Controls.Add($diagnosticsPage)
$script:Pages.Diagnostics = $diagnosticsPage
$diagnosticsTitle = New-PageTitle -Title "File scan" -Description "Inspect a Windows executable, installer, catalog, or DLL for signature and origin signals."
$diagnosticsPage.Controls.Add($diagnosticsTitle.Title)
$diagnosticsPage.Controls.Add($diagnosticsTitle.Description)
$filePanel = New-Card -X 0 -Y 82 -Width 820 -Height 420
$diagnosticsPage.Controls.Add($filePanel)
$chooseButton = [Windows.Forms.Button]::new() $chooseButton = [Windows.Forms.Button]::new()
$chooseButton.Text = "Choose .exe or .msi" $chooseButton.Text = "Choose file"
$chooseButton.Size = [Drawing.Size]::new(190, 44) $chooseButton.Size = [Drawing.Size]::new(150, 42)
$chooseButton.Location = [Drawing.Point]::new(24, 24) $chooseButton.Location = [Drawing.Point]::new(24, 24)
Add-AnimatedButton -Button $chooseButton -Normal $colors.Green -Hover $colors.GreenHover Add-AnimatedButton -Button $chooseButton -Normal $colors.Green -Hover $colors.GreenHover
$filePanel.Controls.Add($chooseButton) $filePanel.Controls.Add($chooseButton)
$scanButton = [Windows.Forms.Button]::new() $scanButton = [Windows.Forms.Button]::new()
$scanButton.Text = "Scan file" $scanButton.Text = "Scan again"
$scanButton.Size = [Drawing.Size]::new(130, 44) $scanButton.Size = [Drawing.Size]::new(130, 42)
$scanButton.Location = [Drawing.Point]::new(232, 24) $scanButton.Location = [Drawing.Point]::new(190, 24)
Add-AnimatedButton -Button $scanButton -Normal $colors.PanelAlt -Hover $colors.Border Add-AnimatedButton -Button $scanButton -Normal $colors.PanelAlt -Hover $colors.Border
$filePanel.Controls.Add($scanButton) $filePanel.Controls.Add($scanButton)
$script:FileVerdictLabel = New-Label -Text "Choose a Windows installer or executable to inspect." -X 24 -Y 88 -Width 820 -Height 30 -Color $colors.Muted -Font ([Drawing.Font]::new("Segoe UI", 11, [Drawing.FontStyle]::Bold)) $script:FileVerdictLabel = New-Label -Text "Choose a Windows app or installer to inspect." -X 24 -Y 88 -Width 760 -Height 30 -Color $colors.Muted -Font ([Drawing.Font]::new("Segoe UI", 11, [Drawing.FontStyle]::Bold))
$filePanel.Controls.Add($script:FileVerdictLabel) $filePanel.Controls.Add($script:FileVerdictLabel)
$filePanel.Controls.Add((New-Label -Text "File" -X 24 -Y 136)) $filePanel.Controls.Add((New-Label -Text "File" -X 24 -Y 136 -Width 170 -Height 24))
$script:FileNameLabel = New-Label -Text "-" -X 210 -Y 136 -Width 620 -Height 24 -Color $colors.Text $script:FileNameLabel = New-Label -Text "-" -X 210 -Y 136 -Width 560 -Height 24 -Color $colors.Text
$script:FileNameLabel.AutoEllipsis = $true
$filePanel.Controls.Add($script:FileNameLabel) $filePanel.Controls.Add($script:FileNameLabel)
$filePanel.Controls.Add((New-Label -Text "Path" -X 24 -Y 170)) $filePanel.Controls.Add((New-Label -Text "Path" -X 24 -Y 170 -Width 170 -Height 24))
$script:FilePathLabel = New-Label -Text "-" -X 210 -Y 170 -Width 620 -Height 40 -Color $colors.Text $script:FilePathLabel = New-Label -Text "-" -X 210 -Y 170 -Width 560 -Height 40 -Color $colors.Text
$script:FilePathLabel.AutoEllipsis = $true $script:FilePathLabel.AutoEllipsis = $true
$filePanel.Controls.Add($script:FilePathLabel) $filePanel.Controls.Add($script:FilePathLabel)
$filePanel.Controls.Add((New-Label -Text "Signature status" -X 24 -Y 222)) $filePanel.Controls.Add((New-Label -Text "Signature status" -X 24 -Y 222 -Width 170 -Height 24))
$script:SignatureStatusLabel = New-Label -Text "-" -X 210 -Y 222 -Width 620 -Height 24 -Color $colors.Text $script:SignatureStatusLabel = New-Label -Text "-" -X 210 -Y 222 -Width 560 -Height 24 -Color $colors.Text
$filePanel.Controls.Add($script:SignatureStatusLabel) $filePanel.Controls.Add($script:SignatureStatusLabel)
$filePanel.Controls.Add((New-Label -Text "Signer" -X 24 -Y 256)) $filePanel.Controls.Add((New-Label -Text "Signer" -X 24 -Y 256 -Width 170 -Height 24))
$script:SignerLabel = New-Label -Text "-" -X 210 -Y 256 -Width 620 -Height 36 -Color $colors.Text $script:SignerLabel = New-Label -Text "-" -X 210 -Y 256 -Width 560 -Height 36 -Color $colors.Text
$script:SignerLabel.AutoEllipsis = $true $script:SignerLabel.AutoEllipsis = $true
$filePanel.Controls.Add($script:SignerLabel) $filePanel.Controls.Add($script:SignerLabel)
$filePanel.Controls.Add((New-Label -Text "MrSphay match" -X 24 -Y 306)) $filePanel.Controls.Add((New-Label -Text "MrSphay match" -X 24 -Y 306 -Width 170 -Height 24))
$script:MrSphayMatchLabel = New-Label -Text "-" -X 210 -Y 306 -Width 180 -Height 24 -Color $colors.Text $script:MrSphayMatchLabel = New-Label -Text "-" -X 210 -Y 306 -Width 160 -Height 24 -Color $colors.Text
$filePanel.Controls.Add($script:MrSphayMatchLabel) $filePanel.Controls.Add($script:MrSphayMatchLabel)
$filePanel.Controls.Add((New-Label -Text "Mark-of-the-Web" -X 24 -Y 340)) $filePanel.Controls.Add((New-Label -Text "Mark-of-the-Web" -X 390 -Y 306 -Width 160 -Height 24))
$script:MotwLabel = New-Label -Text "-" -X 210 -Y 340 -Width 180 -Height 24 -Color $colors.Text $script:MotwLabel = New-Label -Text "-" -X 560 -Y 306 -Width 160 -Height 24 -Color $colors.Text
$filePanel.Controls.Add($script:MotwLabel) $filePanel.Controls.Add($script:MotwLabel)
$filePanel.Controls.Add((New-Label -Text "SmartScreen note" -X 24 -Y 374)) $filePanel.Controls.Add((New-Label -Text "SmartScreen note" -X 24 -Y 352 -Width 170 -Height 24))
$script:SmartScreenLabel = New-Label -Text "-" -X 210 -Y 374 -Width 620 -Height 40 -Color $colors.Muted $script:SmartScreenLabel = New-Label -Text "-" -X 210 -Y 352 -Width 560 -Height 48 -Color $colors.Muted
$filePanel.Controls.Add($script:SmartScreenLabel) $filePanel.Controls.Add($script:SmartScreenLabel)
$chooseButton.Add_Click({ $chooseButton.Add_Click({
@@ -498,35 +633,40 @@ $scanButton.Add_Click({
} }
}) })
$helpPanel = [Windows.Forms.Panel]::new() $helpPage = [Windows.Forms.Panel]::new()
$helpPanel.BackColor = $colors.Panel $helpPage.Dock = "Fill"
$helpPanel.Size = [Drawing.Size]::new(880, 420) $helpPage.BackColor = $colors.Background
$helpPanel.Location = [Drawing.Point]::new(36, 34) $helpPage.Visible = $false
$helpTab.Controls.Add($helpPanel) $contentHost.Controls.Add($helpPage)
$script:Pages.SmartScreen = $helpPage
$helpTitle = New-Label -Text "Why SmartScreen can still appear" -X 24 -Y 24 -Width 780 -Height 34 -Color $colors.Text -Font ([Drawing.Font]::new("Segoe UI", 14, [Drawing.FontStyle]::Bold)) $helpTitle = New-PageTitle -Title "SmartScreen" -Description "Understand what MrTrust can verify and what Windows reputation still controls."
$helpPanel.Controls.Add($helpTitle) $helpPage.Controls.Add($helpTitle.Title)
$helpPage.Controls.Add($helpTitle.Description)
$helpText = @" $helpPanel = New-Card -X 0 -Y 82 -Width 820 -Height 330
MrTrust handles local certificate trust. SmartScreen also uses Microsoft reputation. $helpPage.Controls.Add($helpPanel)
If Windows shows "Publisher: MrSphay Code Signing", the signature identity is being recognized. $helpPanel.Controls.Add((New-Label -Text "Local trust" -X 24 -Y 24 -Width 180 -Height 24 -Color $colors.Text -Font ([Drawing.Font]::new("Segoe UI", 11, [Drawing.FontStyle]::Bold))))
$helpPanel.Controls.Add((New-Label -Text "MrTrust installs the public MrSphay root and publisher certificates into the selected Windows certificate stores." -X 24 -Y 54 -Width 740 -Height 42 -Color $colors.Muted))
A red SmartScreen dialog can still appear when a file is new, downloaded from the Internet, rarely seen, or has not built enough Microsoft reputation yet. $helpPanel.Controls.Add((New-Label -Text "Windows reputation" -X 24 -Y 118 -Width 220 -Height 24 -Color $colors.Text -Font ([Drawing.Font]::new("Segoe UI", 11, [Drawing.FontStyle]::Bold))))
$helpPanel.Controls.Add((New-Label -Text "SmartScreen can still warn for a new or rarely downloaded file, even when the signature is valid and the publisher is recognized." -X 24 -Y 148 -Width 740 -Height 42 -Color $colors.Muted))
MrTrust will not disable SmartScreen. It can show whether a file is signed, whether it matches MrSphay, and whether Mark-of-the-Web is present. $helpPanel.Controls.Add((New-Label -Text "What to check" -X 24 -Y 212 -Width 180 -Height 24 -Color $colors.Text -Font ([Drawing.Font]::new("Segoe UI", 11, [Drawing.FontStyle]::Bold))))
"@ $helpPanel.Controls.Add((New-Label -Text "Use File scan to verify signature status, MrSphay signer matching, and Mark-of-the-Web. MrTrust never disables SmartScreen." -X 24 -Y 242 -Width 740 -Height 46 -Color $colors.Muted))
$helpBody = New-Label -Text $helpText -X 24 -Y 78 -Width 820 -Height 250 -Color $colors.Muted
$helpPanel.Controls.Add($helpBody)
$pulseTimer = [Windows.Forms.Timer]::new() $pulseTimer = [Windows.Forms.Timer]::new()
$pulseTimer.Interval = 80 $pulseTimer.Interval = 100
$pulseTimer.Add_Tick({ $pulseTimer.Add_Tick({
$script:CurrentAccent = ($script:CurrentAccent + 1) % 40 $script:CurrentAccent = ($script:CurrentAccent + 1) % 40
$value = 150 + [Math]::Abs(20 - $script:CurrentAccent) * 3 $value = 130 + [Math]::Abs(20 - $script:CurrentAccent) * 4
$accent.BackColor = [Drawing.Color]::FromArgb(28, [Math]::Min(220, $value), 111) $sideAccent.BackColor = [Drawing.Color]::FromArgb(0, [Math]::Min(205, $value), 91)
}) })
$pulseTimer.Start() $pulseTimer.Start()
$form.Add_Shown({ Update-TrustStatus }) $form.Add_Shown({
Show-MrTrustPage -Key "Trust"
Update-TrustStatus
})
[Windows.Forms.Application]::Run($form) [Windows.Forms.Application]::Run($form)