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
19 changes: 18 additions & 1 deletion client/Frontend/StartButtons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
Expand Down Expand Up @@ -178,6 +178,23 @@

</Grid>

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

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

<CheckBox Name="RedactHostsCheckbox"
HorizontalAlignment="Center"
VerticalAlignment="Center" Content=" Remove hosts file"
Checked="RedactHostsFileOn" Unchecked="RedactHostsFileOff"
Style="{DynamicResource CheckBoxStyle1}"
Width="120" Foreground="White"
FontFamily="Consolas" VerticalContentAlignment="Center"/>

</Grid>

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

<Border CornerRadius="8"
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 @@ -71,6 +71,16 @@ private void RedactNetworkingOff(object sender, RoutedEventArgs e)
Settings.RedactNetworking = false;
}

private void RedactHostsFileOn(object sender, RoutedEventArgs e)
{
Settings.RedactHostsFile = true;
}

private void RedactHostsFileOff(object sender, RoutedEventArgs e)
{
Settings.RedactHostsFile = 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 @@ -6,6 +6,7 @@ public static class Settings
public static bool RedactSerialNumber { get; set; } = false;
public static bool RedactOneDriveCommercial { get; set; } = false;
public static bool RedactNetworking { get; set; } = false;
public static bool RedactHostsFile { 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
15 changes: 11 additions & 4 deletions client/data/Methods/Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ public static async Task MakeNetworkData()
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);
await DebugLog.LogEventAsync("Networking redaction enabled. NICs, routes, and network connections were skipped.", region);
}
else
{
Expand Down Expand Up @@ -60,12 +58,21 @@ public static async Task MakeNetworkData()

AutoTuningLevelLocal = GetAutoTuningLevels();

if (!Settings.RedactNetworking)
if (Settings.RedactHostsFile)
{
HostsFile = "[REDACTED]";
HostsFileHash = "[REDACTED]";
await DebugLog.LogEventAsync("Hosts file redaction enabled.", region);
}
else
{
HostsFile = GetHostsFile();
HostsFileHash = GetHostsFileHash();
await DebugLog.LogEventAsync("Hosts file retrieved.", region);
}

if (!Settings.RedactNetworking)
{
TCPConnections = GetTCPConnections();
UDPEndpoints = Utils.GetWmi("MSFT_NetUDPEndpoint", "LocalAddress,LocalPort,OwningProcess",
@"root\standardcimv2");
Expand Down