Skip to content

Update installer to organize packages by categories #672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 15, 2025

Conversation

sara-rn
Copy link
Contributor

@sara-rn sara-rn commented Mar 14, 2025

Update installer so that after the initial form to set up the environmental variables a new window displays all the packages grouped by category.

  • The packages from config.xml need to be selected by default.
  • The option to select all the packages from a specific category, for example if the category is a checkbox, doesn't work well as the checkboxes need to be generated dynamically. Currently each category is displayed in a label.

Closes #578
Closes #546
Closes #432

@sara-rn sara-rn self-assigned this Mar 14, 2025
@sara-rn sara-rn marked this pull request as draft March 14, 2025 17:51
@sara-rn sara-rn force-pushed the update-installer-categories branch 2 times, most recently from 65d91a5 to f316eb6 Compare March 14, 2025 18:03
@Ana06 Ana06 added the 💎 enhancement It is working, but it could be better label Mar 17, 2025
Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sara-rn the installer here is broken because #671 broke the installer. Please rebase after #675 is merged so that the code works.

The fist UI window (install customization) is missing a next button, so I couldn't test the categories page:
image
Please address this issue so that I can review the new window as well.

Remember adding labels to PRs (in this case enhacement is appropriate) and to add the issue the PR closes to the PR description (this PR should address #578).

@sara-rn sara-rn force-pushed the update-installer-categories branch from f7c4e94 to 3100f2b Compare March 17, 2025 10:57
After the initial form to set up the environmental variables a new
window will display all the packages grouped by category.
The packages from `config.xml` will be selected by default.
@sara-rn sara-rn force-pushed the update-installer-categories branch 5 times, most recently from 6caf0ca to 8aa429c Compare March 17, 2025 23:47
@sara-rn
Copy link
Contributor Author

sara-rn commented Mar 17, 2025

@Ana06 there is no need to use Find-Package, therefore the installation of nuget or download categories.txt is not necessary. At the end of the feed from https://www.myget.org/F/vm-packages/Packages there is a <link rel="next" with the URL for the next packages.
The packages are selected and the Continue button adds the selected items to the config.xml

Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sara-rn I was not able to review the installer UI as the installer does not run correctly:

Get-Packages-Categories : The term 'Get-Packages-Categories' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\Users\flare\Desktop\install.ps1:491 char:27
+     $packagesByCategory = Get-Packages-Categories
+                           ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-Packages-Categories:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

I think is because you have placed the code of Get-Packages-Categories after the use of the function (it needs to be defined before). Please ensure the code works as it otherwise make it the review difficult.

I also recommend you to add some screenshots when making UI changes.

@sara-rn
Copy link
Contributor Author

sara-rn commented Mar 18, 2025

@sara-rn I was not able to review the installer UI as the installer does not run correctly:

Get-Packages-Categories : The term 'Get-Packages-Categories' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\Users\flare\Desktop\install.ps1:491 char:27
+     $packagesByCategory = Get-Packages-Categories
+                           ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-Packages-Categories:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

I think is because you have placed the code of Get-Packages-Categories after the use of the function (it needs to be defined before). Please ensure the code works as it otherwise make it the review difficult.

I also recommend you to add some screenshots when making UI changes.

I executed it without any issues, but when I switched to a different snapshot with Powershell version 5.1 I had the same error

@sara-rn sara-rn force-pushed the update-installer-categories branch 2 times, most recently from 84595c3 to 8d8d15e Compare March 18, 2025 16:00
@sara-rn
Copy link
Contributor Author

sara-rn commented Mar 18, 2025

Screenshot From 2025-03-18 16-59-44

@sara-rn sara-rn force-pushed the update-installer-categories branch 9 times, most recently from 2ad68c8 to 94db0a1 Compare March 20, 2025 12:50
@sara-rn sara-rn force-pushed the update-installer-categories branch from 94db0a1 to 092be02 Compare March 31, 2025 08:02
Retrieve packages from the APIurl `https://www.myget.org/F/vm-packages`
instead of using `Find-Package` that required the installation of nuget
@jstrosch
Copy link
Collaborator

jstrosch commented Apr 8, 2025

Going through the PR now - really nice work! I think this will make customization very smooth. I didn't notice any issues and the installation appears to have kicked off without any problems. Just a few thoughts/observations:

  • The package selection screen says "continue", when I clicked it I was expecting a confirmation or summary page, instead it jumped right into the installation. Maybe the button could say something along the lines of "Install" or there is one more page before installing. I wasn't quite ready to start the installation - there could have been text that warned me, but I missed it if so.
  • I'm sure this is non-trivial, but would be helpful to see package size/total install size if possible - could be a summary page after selecting packages even :)
  • I could see this going one step further and offering a "profile" that pre-selects packages. Say I want an Android profile, it would pre-select all of the common Android tools (in their appropriate categories) and ignore the rest - of course, the package selection screen could provide customization but would allow for users to get a pre-selected baseline easier. Other profiles could be Windows Malware, Office Malware, etc. Just thinking out loud a bit :) These profiles could serve the non-GUI install, as well as reduce clicks during GUI install.

Again, just some thoughts and no issues to report - can't wait to see this PR go live!

@Ana06
Copy link
Member

Ana06 commented Apr 8, 2025

Thanks for taking a look @jstrosch, great feedback!

The package selection screen says "continue", when I clicked it I was expecting a confirmation or summary page, instead it jumped right into the installation. Maybe the button could say something along the lines of "Install" or there is one more page before installing. I wasn't quite ready to start the installation - there could have been text that warned me, but I missed it if so.

I agree, Install instead of Continue in the second UI would be clearer 👍 @sara-rn can you please address this in this PR?

I'm sure this is non-trivial, but would be helpful to see package size/total install size if possible - could be a summary page after selecting packages even :)

This is a good idea, but I think it is not possible (or at least difficult) to implement. Our packages normally don't contain the tool, just a download link to use to install it. What is useful is to know the installed tool size, but there is no way to know without installing the tool. One thing that we could easily do is to add this information in the description for packages like visualstudio.vm and pdbresym.vm, that we know increase the size of the VM significantly (reason why they are not in the default configuration). For example: Requires Substantial Disk Space of Requires X Gb of Disk Space. We can create an issue for this.

I could see this going one step further and offering a "profile" that pre-selects packages. Say I want an Android profile, it would pre-select all of the common Android tools (in their appropriate categories) and ignore the rest - of course, the package selection screen could provide customization but would allow for users to get a pre-selected baseline easier. Other profiles could be Windows Malware, Office Malware, etc. Just thinking out loud a bit :) These profiles could serve the non-GUI install, as well as reduce clicks during GUI install.

This is more or less already possible providing a configuration file. We could store more than one configuration file in this repository and display them in the UI (for example in the first UI). The issue with this is that we have to maintain all the configuration files adding new tools to several of them (and we already forget to add tools now and we have only one config 😓). At the moment we have just one configuration file that contains what FLARE think is required to do malware analysis efficiently without an important size increase (mostly what FLARE uses internally). This is related to #668.

Copy link
Collaborator

@MalwareMechanic MalwareMechanic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nitpicks here, PR overall looks great 😃

Please check that the "Cancel" buttons are working as intended. I ran the script from an elevated PowerShell console and when I cancelled the GUI disappeared, but I was stuck at the PowerShell console. I didn't see any exit messages and ctrl+c didn't work to exit it. However, when I debugged it in PowerShell ISE it seemed to work fine and also print the exit message. 🤷

@sara-rn sara-rn force-pushed the update-installer-categories branch 4 times, most recently from e9e633a to 58d7cc9 Compare April 9, 2025 10:28
@sara-rn
Copy link
Contributor Author

sara-rn commented Apr 9, 2025

Mostly nitpicks here, PR overall looks great 😃

Please check that the "Cancel" buttons are working as intended. I ran the script from an elevated PowerShell console and when I cancelled the GUI disappeared, but I was stuck at the PowerShell console. I didn't see any exit messages and ctrl+c didn't work to exit it. However, when I debugged it in PowerShell ISE it seemed to work fine and also print the exit message. 🤷

@MalwareMechanic I cannot reproduce the scenario you mention, both cancel buttons are expected to exit and print the message. I am not sure how to address this.

@sara-rn sara-rn force-pushed the update-installer-categories branch 2 times, most recently from 27624cd to 686d498 Compare April 9, 2025 10:38
@sara-rn
Copy link
Contributor Author

sara-rn commented Apr 9, 2025

Thanks @Ana06 @MalwareMechanic and @jstrosch for the feedback, much appreciated! I have addressed the proposed changes. I believe the overall look and feel can be improved such as the usage of icons or the background.png that we don't use. @jstrosch I like your idea regarding the usage of profiles, this is what commando-vm has, but I agree with Ana we would need to maintain it, no issues if everyone finds it useful. An idea for another PR would be to save the selected packages into a custom config for example so next time you can provide it as a command-line. Just some random thoughts. Thanks again all!!

@sara-rn
Copy link
Contributor Author

sara-rn commented Apr 9, 2025

@sara-rn thanks for adding documentation, I find the code much easy to read now! 💐 I really like how this how turned out, it is going to make it much easier for our users to packages to install! 💘

[nitpick] I think reducing the first window a bit more in size (to have the same size on the right and the left sides and to keep the buttons part consistent with the next window, which is more narrow) would look better.

Also, what about adding a Back button in the second window? This could be addressed in a different PR too.

image image

I reduced the height of the first Window, not sure if I should also move the Install and Cancel buttons to the right in the second Window or its already fine.

@sara-rn sara-rn requested a review from Ana06 April 9, 2025 10:49
$resetButton.Add_Click({Set-InitialPackages})#it doesn't work

$allPackagesButton = New-Object system.Windows.Forms.Button
$allPackagesButton.text = "Select All"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get an expection when pressing the button:
image

@Ana06
Copy link
Member

Ana06 commented Apr 11, 2025

@MalwareMechanic

Please check that the "Cancel" buttons are working as intended. I ran the script from an elevated PowerShell console and when I cancelled the GUI disappeared, but I was stuck at the PowerShell console. I didn't see any exit messages and ctrl+c didn't work to exit it. However, when I debugged it in PowerShell ISE it seemed to work fine and also print the exit message

I think the exit message not being rendered is caused by #541 (confusing but unrelated to the changes here).

I can't reproduce the stuck after exist on the PowerShell console, but the way to exit hasn't been changed in this PR. So if there is an issue, I think it is not caused by these changes. @MalwareMechanic can you double-check that this happens consistently and open an issue if so? Then we can investigate the issue after this has been merged.

@Ana06
Copy link
Member

Ana06 commented Apr 11, 2025

@sara-rn

I reduced the height of the first Window, not sure if I should also move the Install and Cancel buttons to the right in the second Window or its already fine.

I think it is better to keep the windows as consistent and similar as possible.

Make the font bigger of packages
Add extra space at the end of the checkboxes
Add documentation in the function Get-Packages-Categories
Apply suggestions from code review
@sara-rn sara-rn force-pushed the update-installer-categories branch from 686d498 to 0d8d211 Compare April 14, 2025 10:40
@sara-rn sara-rn requested a review from Ana06 April 14, 2025 10:43
Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sara-rn I have tested again and everything looks as expected. This is a great improvement, thanks for all the work! 🚀

[nitpick] I think it would be nice to add a Back button in the second window (to go back to the first one).

@sara-rn sara-rn requested a review from MalwareMechanic April 15, 2025 09:09
@mandiant mandiant deleted a comment from sara-rn Apr 15, 2025
@Ana06 Ana06 dismissed MalwareMechanic’s stale review April 15, 2025 09:16

Changes addressed! Thanks for the review

@Ana06 Ana06 merged commit a5ca6e3 into mandiant:main Apr 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💎 enhancement It is working, but it could be better
Projects
None yet
4 participants