diff --git a/client/Frontend/App.xaml.cs b/client/Frontend/App.xaml.cs index 74a3798..cbedd5b 100644 --- a/client/Frontend/App.xaml.cs +++ b/client/Frontend/App.xaml.cs @@ -64,6 +64,10 @@ private async void Application_Startup(object sender, StartupEventArgs e) Settings.RedactOneDriveCommercial = true; break; + case "-redact-networking": + Settings.RedactNetworking = true; + break; + case "-dont-upload": Settings.DontUpload = true; break; diff --git a/client/Frontend/StartButtons.xaml b/client/Frontend/StartButtons.xaml index 6e56226..1b1d218 100644 --- a/client/Frontend/StartButtons.xaml +++ b/client/Frontend/StartButtons.xaml @@ -118,6 +118,7 @@ + @@ -132,7 +133,8 @@ BorderBrush="#576277" Margin="2"/> - + HorizontalAlignment="Center" + VerticalAlignment="Center" Content=" Enable Debug Logging" + Checked="DebugLogToggleOn" Unchecked="DebugLogToggleOff" + Style="{DynamicResource CheckBoxStyle1}" + Grid.Row="2" Grid.Column="3" + Width="120" Foreground="White" + FontFamily="Consolas"/> @@ -193,6 +195,23 @@ + + + + + + + + diff --git a/client/Frontend/StartButtons.xaml.cs b/client/Frontend/StartButtons.xaml.cs index 3af711a..e5489fb 100644 --- a/client/Frontend/StartButtons.xaml.cs +++ b/client/Frontend/StartButtons.xaml.cs @@ -61,6 +61,16 @@ private void SerialNumberOff(object sender, RoutedEventArgs e) Settings.RedactSerialNumber = false; } + private void RedactNetworkingOn(object sender, RoutedEventArgs e) + { + Settings.RedactNetworking = true; + } + + private void RedactNetworkingOff(object sender, RoutedEventArgs e) + { + Settings.RedactNetworking = false; + } + private void DebugLogToggleOn(object sender, RoutedEventArgs e) { Settings.EnableDebug = true; diff --git a/client/Settings.cs b/client/Settings.cs index 913ac23..8f98f19 100644 --- a/client/Settings.cs +++ b/client/Settings.cs @@ -5,6 +5,7 @@ public static class Settings public static bool RedactUsername { get; set; } = false; public static bool RedactSerialNumber { get; set; } = false; public static bool RedactOneDriveCommercial { get; set; } = false; + public static bool RedactNetworking { get; set; } = false; public static bool DontUpload { get; set; } = false; public static bool Headless { get; set; } = false; public static bool LocalCulture { get; set; } = false; diff --git a/client/data/Methods/Network.cs b/client/data/Methods/Network.cs index 7faba8d..396afea 100644 --- a/client/data/Methods/Network.cs +++ b/client/data/Methods/Network.cs @@ -20,21 +20,36 @@ public static async Task MakeNetworkData() { DebugLog.Region region = DebugLog.Region.Networking; await DebugLog.StartRegion(region); - NetAdapters = Utils.GetWmi("Win32_NetworkAdapterConfiguration", - "Description, DHCPEnabled, DHCPServer, DNSDomain, DNSDomainSuffixSearchOrder, DNSHostName, " - + "DNSServerSearchOrder, IPEnabled, IPAddress, IPSubnet, DHCPLeaseObtained, DHCPLeaseExpires, " - + "DefaultIPGateway, MACAddress, InterfaceIndex"); + if (Settings.RedactNetworking) + { + NetAdapters = new List>(); + NetAdapters2 = new List>(); + IPRoutes = new List>(); + TCPConnections = new List(); + UDPEndpoints = new List>(); + HostsFile = ""; + HostsFileHash = ""; + + await DebugLog.LogEventAsync("Networking redaction enabled. NICs, routes, hosts file, and network connections were skipped.", region); + } + else + { + NetAdapters = Utils.GetWmi("Win32_NetworkAdapterConfiguration", + "Description, DHCPEnabled, DHCPServer, DNSDomain, DNSDomainSuffixSearchOrder, DNSHostName, " + + "DNSServerSearchOrder, IPEnabled, IPAddress, IPSubnet, DHCPLeaseObtained, DHCPLeaseExpires, " + + "DefaultIPGateway, MACAddress, InterfaceIndex"); - NetAdapters2 = Utils.GetWmi("MSFT_NetAdapter", - "*", - @"root\standardcimv2"); - IPRoutes = Utils.GetWmi("Win32_IP4RouteTable", - "Description, Destination, Mask, NextHop, Metric1, InterfaceIndex"); + NetAdapters2 = Utils.GetWmi("MSFT_NetAdapter", + "*", + @"root\standardcimv2"); + IPRoutes = Utils.GetWmi("Win32_IP4RouteTable", + "Description, Destination, Mask, NextHop, Metric1, InterfaceIndex"); - await DebugLog.LogEventAsync("Networking WMI Information Retrieved.", region); + await DebugLog.LogEventAsync("Networking WMI Information Retrieved.", region); - GetAdapterProperties(); - CombineAdapterInformation(); + GetAdapterProperties(); + CombineAdapterInformation(); + } var rssWmi = Utils.GetWmi("MSFT_NetOffloadGlobalSetting", "ReceiveSideScaling", "root\\standardcimv2").FirstOrDefault(); rssWmi.TryWmiRead("ReceiveSideScaling", out byte? rcvSideScaling); @@ -45,14 +60,17 @@ public static async Task MakeNetworkData() AutoTuningLevelLocal = GetAutoTuningLevels(); - HostsFile = GetHostsFile(); - HostsFileHash = GetHostsFileHash(); - await DebugLog.LogEventAsync("Hosts file retrieved.", region); - - TCPConnections = GetTCPConnections(); - UDPEndpoints = Utils.GetWmi("MSFT_NetUDPEndpoint", "LocalAddress,LocalPort,OwningProcess", - @"root\standardcimv2"); - await DebugLog.LogEventAsync("Network Connections Information retrieved.", region); + if (!Settings.RedactNetworking) + { + HostsFile = GetHostsFile(); + HostsFileHash = GetHostsFileHash(); + await DebugLog.LogEventAsync("Hosts file retrieved.", region); + + TCPConnections = GetTCPConnections(); + UDPEndpoints = Utils.GetWmi("MSFT_NetUDPEndpoint", "LocalAddress,LocalPort,OwningProcess", + @"root\standardcimv2"); + await DebugLog.LogEventAsync("Network Connections Information retrieved.", region); + } await DebugLog.EndRegion(DebugLog.Region.Networking); }