Skip to content
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

Installer updates #656

Merged
merged 27 commits into from
Sep 27, 2023
Merged

Installer updates #656

merged 27 commits into from
Sep 27, 2023

Conversation

day1player
Copy link
Contributor

@day1player day1player commented Sep 4, 2023

Created debloater.vm package

  • Added the following functions to common.vm from recent Commando release:
VM-Remove-Appx-Package
VM-Set-Service-Manual-Start
VM-Disable-Scheduled-Task
VM-Update-Registry-Value
VM-Remove-Path
VM-Execute-Custom-Command
VM-Apply-Configurations
  • Added VM-Get-WindowsVersion function to common.vm to identify Win10, Win11, or Win11ARM installations
  • Created win10, win11, and win11ARM config files
    • Config files for win11 and win11arm are mostly placeholders for now

Created installer.vm package

  • Moved failed_packages.txt to $Env:VM_COMMON_DIR
    • Mostly for aesthetic reasons. Failed packages log is printed to console output if people need it. Plus we know where it will be if we need to troubleshoot
  • Changed background image setting from 6 (fit) to 0 (center)
    • This allows for more customization of the desktop background especially for Commando. Also allows reuse of images from readme.md and the background setting
    • Should still work with flarevm's current background
  • Important: Changed variable/file name config.xml (previously holding package and variables) to packages.xml to avoid confusion with the new custom configs that can be supported
    • Installer script for Mandiant VMs should now place a packages.xml file AND a config.xml file into $Env:VM_COMMON_DIR
    • installer.vm now expects packages to be listed in the packages.xml file
    • installer.vm now expects OS configurations to be listed in the config.xml file
  • Created new prompt dialog box that will force itself to be the top window
    • Added functionality to include a custom .ico file (expected in $Env:VM_COMMON_DIR\vm.ico)
    • Expects a variable $Env:MandiantVM to exist (explained below)
  • Added function to change icon of Desktop Tools folder (using the custom .ico file above)
    • More changes to this folder listed below
  • No longer popping log.txt for cleaner exit of installation
    • log locations are still listed at the close of installation if needed
  • Fixed bug where installed apps were not being logged to log.txt
  • Moved Get-InstalledPackages function to common.vm

Changes/additions to common.vm

  • Added VM-Configure-Prompts function to add "Mandiant VM" and timestamps to PowerShell and cmd
    • Important: Above "Mandiant VM" is a placeholder. Added an environment variable in Commando installer script to set this variable (set to Commando VM). When the script runs on Commando the PS Prompt will now be "Commando VM" but when Flare VM is updated it will read "Flare VM"
    • Expects a variable $Env:MandiantVM to exist
  • Added VM-Configure-PS-Logging function
  • Changed location of Desktop Tools folder to actually be on the desktop
    • This does not affect RAW_TOOLS_DIR as that is different.. This folder is just the folder with all the shortcuts
    • This was originally located in the Start Menu which I believe was a legacy Win7 thing
    • By moving the folder to the desktop itself we can now configure a custom .ico file for the folder for ultimate flexing
  • Removed TOOL_LIST_SHORTCUT because this variable is not referenced by any of our packages or install scripts. This function is also what used to create the shortcut on the desktop, and now that the Tools folder lives on the desktop (Not the RAW_TOOLS_DIR, just the folder that hosts all the other shortcuts) we dont need the shortcut
  • Added all of the functions mentioned above

packages/common.vm/tools/vm.common/vm.common.psm1 Outdated Show resolved Hide resolved
packages/common.vm/tools/vm.common/vm.common.psm1 Outdated Show resolved Hide resolved
packages/common.vm/tools/vm.common/vm.common.psm1 Outdated Show resolved Hide resolved
packages/common.vm/tools/vm.common/vm.common.psm1 Outdated Show resolved Hide resolved
packages/installer.vm/tools/chocolateyinstall.ps1 Outdated Show resolved Hide resolved
packages/installer.vm/tools/chocolateyinstall.ps1 Outdated Show resolved Hide resolved
packages/installer.vm/tools/chocolateyinstall.ps1 Outdated Show resolved Hide resolved
packages/installer.vm/tools/chocolateyinstall.ps1 Outdated Show resolved Hide resolved
Copy link
Contributor

@mr-tz mr-tz left a comment

Choose a reason for hiding this comment

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

I didn't review in detail, but looks good. Please consider adding documentation updates to the README and Wiki, where appropriate.

packages/debloat.vm/tools/win10.xml Outdated Show resolved Hide resolved
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.

Thanks for submitting this PR @day1player! 😄

In case you haven't noticed it, the linter is not happy 😬

packages/common.vm/tools/vm.common/vm.common.psm1 Outdated Show resolved Hide resolved
packages/common.vm/tools/vm.common/vm.common.psm1 Outdated Show resolved Hide resolved
# Check if the app is provisioned
$provisionedPackage = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -eq $appName } -ErrorAction SilentlyContinue
if ($provisionedPackage) {
$result = Remove-AppxProvisionedPackage -PackageName $provisionedPackage.PackageName -Online
Copy link
Member

Choose a reason for hiding this comment

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

Similarly as before, you can't use the result ofRemove-AppxProvisionedPackage to text if it succeeded. An example:

Screenshot 2023-09-06 at 13 09 45

packages/common.vm/tools/vm.common/vm.common.psm1 Outdated Show resolved Hide resolved
packages/common.vm/tools/vm.common/vm.common.psm1 Outdated Show resolved Hide resolved
packages/installer.vm/installer.vm.nuspec Outdated Show resolved Hide resolved
@day1player
Copy link
Contributor Author

day1player commented Sep 6, 2023

In case you haven't noticed it, the linter is not happy 😬

I did, and I think I fixed what I could! The remaining errors are that the installer and debloater dont have a category (they shouldnt) and that the erroractionpreference in the installer isnt set to stop (I copied from the other installer)

@Ana06
Copy link
Member

Ana06 commented Sep 7, 2023

I did, and I think I fixed what I could! The remaining errors are that the installer and debloater dont have a category (they shouldnt) and that the erroractionpreference in the installer isnt set to stop (I copied from the other installer)

For things that doesn't make sense to fix, you need to exclude the package in the linter as we do for example here:
https://github.com/mandiant/VM-Packages/blob/main/scripts/test/lint.py#L310

This way we know in future PR what things need to be tested for what package 😉

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.

Thanks for the changes. I think we just need to fix the linter (and ensure the rest of the CI succeeds) and we are good to go! 👍

Can you please squash the commits (to several small commits with related changes removing the half-way work or just a big one) in oder to keep a clean commit history without fix/updates commits? Alternatively, you can use squash and merge when merging that will combine the PR int a single commit.

@day1player
Copy link
Contributor Author

I think we just need to fix the linter

Done! I think we just need the PR approved and I can merge it.

@Ana06
Copy link
Member

Ana06 commented Sep 12, 2023

The tests fail. I think we want to exclude the installer from the tests as we do with the current installer: https://github.com/mandiant/VM-Packages/blob/main/scripts/test/test_install.ps1#L42 It is failing because it doesn't find the config file. But the real issue with testing the installer is that it installs other packages.

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.

Some minor changes plz, then should be gtg

packages/common.vm/tools/vm.common/vm.common.psm1 Outdated Show resolved Hide resolved
packages/common.vm/tools/vm.common/vm.common.psm1 Outdated Show resolved Hide resolved
}
}

# Process the services

This comment was marked as resolved.

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.

🎉

Please remember to use squash and merge 😄

@Ana06 Ana06 merged commit 25cdade into main Sep 27, 2023
6 checks passed
Ana06 added a commit to Ana06/flare-vm that referenced this pull request Sep 29, 2023
`TOOL_LIST_SHORTCUT` has been removed in:
mandiant/VM-Packages#656

Install the tools shortcuts directly into `%UserProfile%\Desktop\Tools`.
Ana06 added a commit to Ana06/flare-vm that referenced this pull request Sep 29, 2023
`TOOL_LIST_SHORTCUT` has been removed in:
mandiant/VM-Packages#656

Install the tools shortcuts directly into `%UserProfile%\Desktop\Tools`.
Ana06 added a commit to Ana06/flare-vm that referenced this pull request Oct 11, 2023
`TOOL_LIST_SHORTCUT` has been removed in:
mandiant/VM-Packages#656.

We removed it from the config in:
mandiant#492
But we didn't remove it from the GUI.
dah4k added a commit to dah4k/DeCrapify-Windows that referenced this pull request Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants