Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/Frontend/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
35 changes: 27 additions & 8 deletions client/Frontend/StartButtons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
Expand All @@ -132,7 +133,8 @@
BorderBrush="#576277"
Margin="2"/>

<CheckBox HorizontalAlignment="Center"
<CheckBox Name="UsernamesCheckbox"
HorizontalAlignment="Center"
VerticalAlignment="Center" Content="Remove Usernames"
Checked="UsernameOn" Unchecked="UsernameOff"
Style="{DynamicResource CheckBoxStyle1}"
Expand Down Expand Up @@ -166,13 +168,13 @@
Margin="2"/>

<CheckBox Name="DebugLogCheckbox"
HorizontalAlignment="Center"
VerticalAlignment="Center" Content=" Enable Debug &#x0a; Logging"
Checked="DebugLogToggleOn" Unchecked="DebugLogToggleOff"
Style="{DynamicResource CheckBoxStyle1}"
Grid.Row="2" Grid.Column="3"
Width="120" Foreground="White"
FontFamily="Consolas"/>
HorizontalAlignment="Center"
VerticalAlignment="Center" Content=" Enable Debug &#x0a; Logging"
Checked="DebugLogToggleOn" Unchecked="DebugLogToggleOff"
Style="{DynamicResource CheckBoxStyle1}"
Grid.Row="2" Grid.Column="3"
Width="120" Foreground="White"
FontFamily="Consolas"/>

</Grid>

Expand All @@ -193,6 +195,23 @@

</Grid>

<Grid Grid.Row="2" Grid.Column="0">

<Border CornerRadius="8"
BorderThickness="2"
BorderBrush="#576277"
Margin="2"/>

<CheckBox Name="NetworkingCheckbox"
HorizontalAlignment="Center"
VerticalAlignment="Center" Content=" Remove Networking"
Checked="RedactNetworkingOn" Unchecked="RedactNetworkingOff"
Style="{DynamicResource CheckBoxStyle1}"
Width="120" Foreground="White"
FontFamily="Consolas" VerticalContentAlignment="Center"/>

</Grid>



</Grid>
Expand Down
10 changes: 10 additions & 0 deletions client/Frontend/StartButtons.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions client/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
58 changes: 38 additions & 20 deletions client/data/Methods/Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Dictionary<string, object>>();
NetAdapters2 = new List<Dictionary<string, object>>();
IPRoutes = new List<Dictionary<string, object>>();
TCPConnections = new List<TCPConnection>();
UDPEndpoints = new List<Dictionary<string, object>>();
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);
Expand All @@ -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);
}
Expand Down
Loading