Skip to content

Commit

Permalink
Merge pull request #348 from HotCakeX/Harden-Windows-Security-v0.6.5
Browse files Browse the repository at this point in the history
Harden Windows Security v0.6.5
  • Loading branch information
HotCakeX authored Oct 5, 2024
2 parents 7874378 + 610da15 commit 6efeba1
Show file tree
Hide file tree
Showing 35 changed files with 391 additions and 149 deletions.
7 changes: 5 additions & 2 deletions Harden-Windows-Security Module/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dotnet_diagnostic.CA1310.severity = error
dotnet_diagnostic.CA1401.severity = error

# CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = error
dotnet_diagnostic.CA1303.severity = silent

# CA1309: Use ordinal string comparison
dotnet_diagnostic.CA1309.severity = error
Expand Down Expand Up @@ -196,7 +196,7 @@ dotnet_diagnostic.CA1805.severity = error
dotnet_diagnostic.CA1806.severity = error

# CA1819: Properties should not return arrays
dotnet_diagnostic.CA1819.severity = error
dotnet_diagnostic.CA1819.severity = silent

# CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1834.severity = error
Expand Down Expand Up @@ -269,3 +269,6 @@ dotnet_diagnostic.IDE0120.severity = error

# IDE0110: Remove unnecessary discard
dotnet_diagnostic.IDE0110.severity = error

# CA2101: Specify marshaling for P/Invoke string arguments
dotnet_diagnostic.CA2101.severity = error
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,13 @@
"XDRs",
"Zune"
],
"dotnetAcquisitionExtension.enablePreviewFeatures": true
"dotnetAcquisitionExtension.enablePreviewFeatures": true,
"files.exclude": {
"**/.vs": true,
"**/bin": true,
"**/obj": true,
"**/Properties": true
}
},
"extensions": {
"recommendations": [
Expand Down
Binary file added Harden-Windows-Security Module/ICON-FULLSIZE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions Harden-Windows-Security Module/ICON-SVG-ADVANCED.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Harden-Windows-Security Module/ICON-SVG-SIMPLIFIED.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions Harden-Windows-Security Module/Main files/C#/GUI/Confirm/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,23 +318,23 @@ static private System.Windows.Media.Brush GetCategoryColor(string category)
"MicrosoftDefender" => new System.Windows.Media.BrushConverter().ConvertFromString("#B3E5FC") as System.Windows.Media.Brush,
// Light Pastel Coral
"AttackSurfaceReductionRules" => new System.Windows.Media.BrushConverter().ConvertFromString("#FFDAB9") as System.Windows.Media.Brush,
// Light Pastel Green (unchanged)
// Light Pastel Green
"BitLockerSettings" => new System.Windows.Media.BrushConverter().ConvertFromString("#C3FDB8") as System.Windows.Media.Brush,
// Light Pastel Lemon (unchanged)
// Light Pastel Lemon
"TLSSecurity" => new System.Windows.Media.BrushConverter().ConvertFromString("#FFFACD") as System.Windows.Media.Brush,
// Light Pastel Lavender
"LockScreen" => new System.Windows.Media.BrushConverter().ConvertFromString("#E6E6FA") as System.Windows.Media.Brush,
// Light Pastel Aqua
"UserAccountControl" => new System.Windows.Media.BrushConverter().ConvertFromString("#C1F0F6") as System.Windows.Media.Brush,
// Light Pastel Teal (unchanged)
// Light Pastel Teal
"DeviceGuard" => new System.Windows.Media.BrushConverter().ConvertFromString("#B2DFDB") as System.Windows.Media.Brush,
// Light Pastel Pink
"WindowsFirewall" => new System.Windows.Media.BrushConverter().ConvertFromString("#F8BBD0") as System.Windows.Media.Brush,
// Light Pastel Peach (unchanged)
// Light Pastel Peach
"OptionalWindowsFeatures" => new System.Windows.Media.BrushConverter().ConvertFromString("#FFE4E1") as System.Windows.Media.Brush,
// Light Pastel Mint
"WindowsNetworking" => new System.Windows.Media.BrushConverter().ConvertFromString("#F5FFFA") as System.Windows.Media.Brush,
// Light Pastel Gray (unchanged)
// Light Pastel Gray
_ => new System.Windows.Media.BrushConverter().ConvertFromString("#EDEDED") as System.Windows.Media.Brush,
};
}
Expand Down
21 changes: 21 additions & 0 deletions Harden-Windows-Security Module/Main files/C#/GUI/Log/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ private void Logs(object obj)
HardenWindowsSecurity.GUILogs.MainLoggerTextBox = HardenWindowsSecurity.GUILogs.ParentGrid.FindName("MainLoggerTextBox") as System.Windows.Controls.TextBox ?? throw new InvalidOperationException("MainLoggerTextBox is null.");
HardenWindowsSecurity.GUILogs.scrollerForOutputTextBox = HardenWindowsSecurity.GUILogs.ParentGrid.FindName("ScrollerForOutputTextBox") as System.Windows.Controls.ScrollViewer ?? throw new InvalidOperationException("ScrollerForOutputTextBox is null.");
System.Windows.Controls.Image ExportLogsIcon = GUILogs.ParentGrid.FindName("ExportLogsIcon") as System.Windows.Controls.Image ?? throw new InvalidOperationException("ExportLogsIcon is null.");
System.Windows.Controls.Button ClearLogsButton = HardenWindowsSecurity.GUILogs.ParentGrid.FindName("ClearLogsButton") as System.Windows.Controls.Button ?? throw new InvalidOperationException("ClearLogsButton is null.");
System.Windows.Controls.Image ClearLogsIcon = GUILogs.ParentGrid.FindName("ClearLogsIcon") as System.Windows.Controls.Image ?? throw new InvalidOperationException("ClearLogsIcon is null.");


// Add image to the ExportLogsIcon
var ExportLogsIconBitmapImage = new System.Windows.Media.Imaging.BitmapImage();
Expand All @@ -61,6 +64,16 @@ private void Logs(object obj)
ExportLogsIconBitmapImage.EndInit();
ExportLogsIcon.Source = ExportLogsIconBitmapImage;


// Add image to the ClearLogsIcon
var ClearLogsIconBitmapImage = new System.Windows.Media.Imaging.BitmapImage();
ClearLogsIconBitmapImage.BeginInit();
ClearLogsIconBitmapImage.UriSource = new System.Uri(System.IO.Path.Combine(HardenWindowsSecurity.GlobalVars.path!, "Resources", "Media", "ClearLogsIcon.png"));
ClearLogsIconBitmapImage.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad; // Load the image data into memory
ClearLogsIconBitmapImage.EndInit();
ClearLogsIcon.Source = ClearLogsIconBitmapImage;


// Need to apply the template before we can set the toggle button to true
_ = AutoScrollToggleButton.ApplyTemplate();

Expand Down Expand Up @@ -103,6 +116,14 @@ private void Logs(object obj)
};


// Event handler for ClearLogsButton
ClearLogsButton.Click += (sender, e) =>
{
// Set the logs text box to an empty string, clearing all the logs from the GUI logger
GUILogs.MainLoggerTextBox.Text = string.Empty;
};


// Cache the view before setting it as the CurrentView
_viewCache["LogsView"] = HardenWindowsSecurity.GUILogs.View;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,11 @@ await Task.Run(() =>
HardenWindowsSecurity.BitLockerSettings.Invoke();
break;
}
case "DeviceGuard":
{
HardenWindowsSecurity.DeviceGuard.Invoke();
break;
}
case "TLSSecurity":
{
HardenWindowsSecurity.TLSSecurity.Invoke();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,21 @@ public partial class GUIProtectWinSecurity
{
"preset: basic", new System.Collections.Generic.Dictionary<string, List<string>>
{
{ "Categories", new List<string> { "MicrosoftSecurityBaselines", "Microsoft365AppsSecurityBaselines", "MicrosoftDefender", "OptionalWindowsFeatures" } },
{ "Categories", new List<string> { "MicrosoftSecurityBaselines", "Microsoft365AppsSecurityBaselines", "MicrosoftDefender", "DeviceGuard", "OptionalWindowsFeatures" } },
{ "SubCategories", new List<string> {} }
}
},
{
"preset: recommended", new System.Collections.Generic.Dictionary<string, List<string>>
{
{ "Categories", new List<string> { "MicrosoftSecurityBaselines", "Microsoft365AppsSecurityBaselines", "MicrosoftDefender", "AttackSurfaceReductionRules", "BitLockerSettings", "TLSSecurity", "LockScreen", "UserAccountControl", "WindowsFirewall", "OptionalWindowsFeatures", "WindowsNetworking", "MiscellaneousConfigurations", "WindowsUpdateConfigurations", "EdgeBrowserConfigurations", "DownloadsDefenseMeasures", "NonAdminCommands" } },
{ "Categories", new List<string> { "MicrosoftSecurityBaselines", "Microsoft365AppsSecurityBaselines", "MicrosoftDefender", "AttackSurfaceReductionRules", "BitLockerSettings", "DeviceGuard", "TLSSecurity", "LockScreen", "UserAccountControl", "WindowsFirewall", "OptionalWindowsFeatures", "WindowsNetworking", "MiscellaneousConfigurations", "WindowsUpdateConfigurations", "EdgeBrowserConfigurations", "DownloadsDefenseMeasures", "NonAdminCommands" } },
{ "SubCategories", new List<string> { "DangerousScriptHostsBlocking" } }
}
},
{
"preset: complete", new System.Collections.Generic.Dictionary<string, List<string>>
{
{ "Categories", new List<string> { "MicrosoftSecurityBaselines", "Microsoft365AppsSecurityBaselines", "MicrosoftDefender", "AttackSurfaceReductionRules", "BitLockerSettings", "TLSSecurity", "LockScreen", "UserAccountControl", "WindowsFirewall", "OptionalWindowsFeatures", "WindowsNetworking", "MiscellaneousConfigurations", "WindowsUpdateConfigurations", "EdgeBrowserConfigurations", "CountryIPBlocking", "DownloadsDefenseMeasures", "NonAdminCommands" } },
{ "Categories", new List<string> { "MicrosoftSecurityBaselines", "Microsoft365AppsSecurityBaselines", "MicrosoftDefender", "AttackSurfaceReductionRules", "BitLockerSettings", "DeviceGuard", "TLSSecurity", "LockScreen", "UserAccountControl", "WindowsFirewall", "OptionalWindowsFeatures", "WindowsNetworking", "MiscellaneousConfigurations", "WindowsUpdateConfigurations", "EdgeBrowserConfigurations", "CountryIPBlocking", "DownloadsDefenseMeasures", "NonAdminCommands" } },
{ "SubCategories", new List<string> { "MSFTDefender_SAC", "UAC_OnlyElevateSigned", "CountryIPBlocking_OFAC", "DangerousScriptHostsBlocking" } }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ private void Protect(object obj)
// Defining the initial directory where the file picker GUI will be opened for the user
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
Filter = "Text files (*.txt)|*.txt",
Title = "Choose where to save the log file"
Title = "Choose where to save the log file",
FileName = $"Harden Windows Security App Logs Export At {DateTime.Now:yyyy-MM-dd HH-mm-ss}.txt" // Default file name
};
// Show the dialog and process the result
Expand Down
Loading

0 comments on commit 6efeba1

Please sign in to comment.