Skip to content

Commit

Permalink
Upload RC15, update Tool List
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalsleuth committed Apr 25, 2023
1 parent 5e96c76 commit 2da1b2a
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 17 deletions.
Binary file modified WIN-FOR-Tool-List.pdf
Binary file not shown.
126 changes: 110 additions & 16 deletions WinFOR-Customizer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public MainWindow()
{
InitializeComponent();
DataContext = this;
Version.Content = $"v{appversion}-rc14";
Version.Content = $"v{appversion}-rc15";
outputter = new TextBoxOutputter(OutputConsole);
Console.SetOut(outputter);
CommandBindings.Add(new CommandBinding(KeyboardShortcuts.LoadFile, (sender, e) => { File_Load(); }, (sender, e) => { e.CanExecute = true; }));
Expand Down Expand Up @@ -270,6 +270,7 @@ private void XWays_Checked(object sender, RoutedEventArgs e)
}
List<CheckBox> list = GetLogicalChildCollection<CheckBox>(AllTools);
CheckBox? xw = list.FirstOrDefault(cb => cb.Name == "standalones_x_ways");
CheckBox? xwt = list.FirstOrDefault(cb => cb.Name == "standalones_x_ways_templates");
XUser.IsEnabled = true;
XPass.IsEnabled = true;
XUserLabel.IsEnabled = true;
Expand All @@ -281,10 +282,12 @@ private void XWays_Checked(object sender, RoutedEventArgs e)
if (cbName == "standalones_x_ways")
{
cbXways.IsChecked = true;
xwt!.IsChecked = true;
}
else if (cbName == "cbXways")
{
xw!.IsChecked = true;
xwt!.IsChecked = true;
}
}
}
Expand All @@ -297,6 +300,7 @@ private void XWays_Unchecked(object sender, RoutedEventArgs e)
}
List<CheckBox> list = GetLogicalChildCollection<CheckBox>(AllTools);
CheckBox? xw = list.FirstOrDefault(cb => cb.Name == "standalones_x_ways");
CheckBox? xwt = list.FirstOrDefault(cb => cb.Name == "standalones_x_ways_templates");
XUser.IsEnabled = false;
XPass.IsEnabled = false;
XUserLabel.IsEnabled = false;
Expand All @@ -308,10 +312,12 @@ private void XWays_Unchecked(object sender, RoutedEventArgs e)
if (cbName == "standalones_x_ways")
{
cbXways.IsChecked = false;
xwt!.IsChecked = false;
}
else
{
xw!.IsChecked = false;
xwt!.IsChecked = false;
}
}
}
Expand Down Expand Up @@ -597,6 +603,34 @@ private async void Install_Click(object sender, RoutedEventArgs e)
{
try
{
(List<string> checked_items, _) = GetCheck_Status();
if (checked_items.Count == 0)
{
MessageBox.Show("No items selected! Choose at least one item to install.", "No items selected!", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
else if ((checked_items.Count == 1) && (checked_items.Contains("themed") || checked_items.Contains("wsl")))
{
string item = char.ToUpper(checked_items[0][0]) + checked_items[0][1..];
if (item == "Wsl")
{
MessageBox.Show($"Only {item} checkbox was selected!\nChoose at least one item from the tool list to install.\nTo install WSL only, use the \"WSL Only\" button on the side.", $"Only {item} checkbox selected!", MessageBoxButton.OK, MessageBoxImage.Error);
}
else
{
MessageBox.Show($"Only {item} checkbox was selected!\nChoose at least one item from the tool list to install.", $"Only {item} checkbox selected!", MessageBoxButton.OK, MessageBoxImage.Error);
}
return;
}
else if ((checked_items.Count == 2) && (checked_items.Contains("themed") && checked_items.Contains("wsl")))
{
(string item0, string item1) = (checked_items[0], checked_items[1]);
item0 = char.ToUpper(item0[0]) + item0[1..];
item1 = char.ToUpper(item1[0]) + item1[1..];
MessageBox.Show($"Only {item0} and {item1} were selected!\nChoose at least one item from the tool list to install.\nTo install WSL only, use the \"WSL Only\" button on the side.",
$"Only {item0} and {item1} checkboxes selected!", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
OutputExpander.IsExpanded = true;
Console_Output($"{appname} {Version.Content}");
string drive_letter = Path.GetPathRoot(path: Environment.GetFolderPath(Environment.SpecialFolder.UserProfile))!;
Expand Down Expand Up @@ -652,6 +686,11 @@ private async void Install_Click(object sender, RoutedEventArgs e)
if (wsl.IsChecked == true)
{
wsl_selected = true;
MessageBoxResult result = MessageBox.Show("WSLv2 installation will require a reboot! Ensure that you save any open documents, then click OK to continue.","WSLv2 requires a reboot!",MessageBoxButton.OKCancel,MessageBoxImage.Warning);
if (result == MessageBoxResult.Cancel)
{
return;
}
}
else
{
Expand Down Expand Up @@ -1188,6 +1227,34 @@ private async void Download_Only(object? sender, RoutedEventArgs e)
{
try
{
(List<string> checked_items, _) = GetCheck_Status();
if (checked_items.Count == 0)
{
MessageBox.Show("No items selected! Choose at least one item to download.", "No items selected!", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
else if ((checked_items.Count == 1) && (checked_items.Contains("themed") || checked_items.Contains("wsl")))
{
string item = char.ToUpper(checked_items[0][0]) + checked_items[0][1..];
if (item == "Wsl")
{
MessageBox.Show($"Only {item} checkbox was selected!\nChoose at least one item from the tool list to download.\nTo install WSL only, use the \"WSL Only\" button on the side.\nWSL is not currently downloadable.", $"Only {item} checkbox selected!", MessageBoxButton.OK, MessageBoxImage.Error);
}
else
{
MessageBox.Show($"Only {item} checkbox was selected!\nChoose at least one item from the tool list to download.\nThe \"Theme\" itself is not downloadable.", $"Only {item} checkbox selected!", MessageBoxButton.OK, MessageBoxImage.Error);
}
return;
}
else if ((checked_items.Count == 2) && (checked_items.Contains("themed") && checked_items.Contains("wsl")))
{
(string item0, string item1) = (checked_items[0], checked_items[1]);
item0 = char.ToUpper(item0[0]) + item0[1..];
item1 = char.ToUpper(item1[0]) + item1[1..];
MessageBox.Show($"Only {item0} and {item1} were selected!\nChoose at least one item from the tool list to download.\nTo install WSL only, use the \"WSL Only\" button on the side.\nWSL is not currently downloadable.\nThe \"Theme\" itself is also not downloadable.",
$"Only {item0} and {item1} checkboxes selected!", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
OutputExpander.IsExpanded = true;
Console_Output($"{appname} v{appversion}");
string drive_letter = Path.GetPathRoot(path: Environment.GetFolderPath(Environment.SpecialFolder.UserProfile))!;
Expand Down Expand Up @@ -1565,6 +1632,11 @@ private async void Install_WslOnly(object sender, RoutedEventArgs e)
{
try
{
MessageBoxResult result = MessageBox.Show("WSLv2 installation will require a reboot! Ensure that you save any open documents, then click OK to continue.", "WSLv2 requires a reboot!", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
if (result == MessageBoxResult.Cancel)
{
return;
}
OutputExpander.IsExpanded = true;
Console_Output($"{appname} v{appversion}");
string drive_letter = Path.GetPathRoot(path: Environment.GetFolderPath(Environment.SpecialFolder.UserProfile))!;
Expand Down Expand Up @@ -1607,17 +1679,7 @@ private async void Install_WslOnly(object sender, RoutedEventArgs e)
string uri_hash = current_release_data[2];
Console_Output($"{temp_dir} is being created for temporary storage of required files");
Create_TempDirectory(temp_dir);
if (!Check_SaltStackInstalled(salt_version))
{
Console_Output($"SaltStack is being downloaded");
await Download_SaltStack(temp_dir, salt_version, salt_hash);
Console_Output("SaltStack is being installed...");
await Install_Saltstack(temp_dir, salt_version);
}
else
{
Console_Output($"SaltStack {salt_version} is already installed");
}

if (!Check_GitInstalled(git_version))
{
Console_Output($"Git is being downloaded.");
Expand All @@ -1629,6 +1691,17 @@ private async void Install_WslOnly(object sender, RoutedEventArgs e)
{
Console_Output($"Git {git_version} is already installed");
}
if (!Check_SaltStackInstalled(salt_version))
{
Console_Output($"SaltStack is being downloaded");
await Download_SaltStack(temp_dir, salt_version, salt_hash);
Console_Output("SaltStack is being installed...");
await Install_Saltstack(temp_dir, salt_version);
}
else
{
Console_Output($"SaltStack {salt_version} is already installed");
}
string release_file = $"{temp_dir}{release_version}.zip";
string provided_hash;
bool hash_match;
Expand Down Expand Up @@ -1836,11 +1909,14 @@ private async void Check_Updates(object sender, RoutedEventArgs e)
string release_version = File.ReadAllText($"{version_file}").TrimEnd();
string log_file = $@"C:\winfor-saltstack-{release_version}.log";
string download_log = $@"C:\winfor-saltstack-downloads-{release_version}.log";
string wsl_prep_log = $@"C:\winfor-saltstack-{release_version}-wsl.log";
string wsl_log = $@"C:\winfor-wsl.log";

List<string> logfiles = new()
{
log_file,
download_log,
wsl_prep_log,
wsl_log
};
try
Expand All @@ -1853,11 +1929,11 @@ private async void Check_Updates(object sender, RoutedEventArgs e)
string[] splits = contents[1].Split('[', ']');
string pid = splits[5];
string error_string = $"[ERROR ][{pid}]";
int log_length = log.Length;
var ignorable = new[] { "return code: 3010", "retcode: 3010", "Can't parse line", "retcode: 12345", "return code: 12345", $"{error_string} output:" };
results.Append(new String('\u2014', 40) + "\r");
results.Append($"\n{log}\r");
results.Append(new String('\u2014', 40) + "\r\n");
string log_results = (Parse_Log(log, "Summary for", 7));
string log_results = Parse_Log(log, "Summary for", 7);
log_results = log_results.Replace("Summary for local\r", "");
log_results = log_results.Replace("------------\r", "");
log_results = log_results.Replace("--Succeeded", "Succeeded");
Expand All @@ -1869,8 +1945,18 @@ private async void Check_Updates(object sender, RoutedEventArgs e)
errors.Append($"\n{log}\r");
errors.Append(new String('\u2014', 40) + "\r\n");
string error = Parse_Log(log, $"{error_string}", 1);
error = error.Replace(@"\r\n", "\n");
errors.Append(error);
foreach (string line in error.Split("\n"))
{
if (ignorable.Any(x => line.Contains(x)))
{
continue;
}
else
{
string new_line = line.Replace(@"\r\n", "\n");
errors.Append(new_line);
}
}
}
}
}
Expand Down Expand Up @@ -2265,6 +2351,14 @@ private async Task Generate_Tree()
cb.Checked += XWays_Checked;
cb.Unchecked += XWays_Unchecked;
}
if (cb.Name == "standalones_x_ways_templates")
{
cb.IsChecked = false;
}
if (cb.Name == "standalones_winfor_customizer")
{
cb.IsChecked = false;
}
newChild.Items.Add(cb);
}
}
Expand Down
2 changes: 1 addition & 1 deletion WinFOR-Customizer/Win-FOR Customizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<RepositoryUrl>https://github.com/digitalsleuth/win-for</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<ApplicationIcon>Images\fp.ico</ApplicationIcon>
<Version>6.0.0-rc14</Version>
<Version>6.0.0-rc15</Version>
<AssemblyVersion>6.0.0</AssemblyVersion>
<FileVersion>6.0.0</FileVersion>
<Authors>Corey Forman (digitalsleuth)</Authors>
Expand Down
9 changes: 9 additions & 0 deletions layout.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@
"DALP": false,
"StartMenu": true,
"ExtraTiles": []
},
"X-Ways Forensics Templates": {
"CbName": "standalones_x_ways_templates",
"CbContent": "X-Ways Forensics Templates",
"DAID": "",
"AUMID": false,
"DALP": false,
"StartMenu": false,
"ExtraTiles": []
}
}
},
Expand Down

0 comments on commit 2da1b2a

Please sign in to comment.