mandiant / flare-vm

A collection of software installations scripts for Windows systems that allows you to easily setup and maintain a reverse engineering environment on a VM.
Apache License 2.0
6.45k stars 906 forks source link

Add run flag to package config entries #585

Closed stevemk14ebr closed 4 months ago

stevemk14ebr commented 5 months ago

Details

Some packages (such as PDBReSym - https://github.com/mandiant/VM-Packages/pull/986#issuecomment-2051987881) have installer.ps1 files that not only install the tool, but run it. This is not ideal, there is a difference between installation of a tool and executing it. For this package in particular, we always want it to be installed, but do NOT always want it to be run because it can bloat the VM. I suggest we extend the installer.ps1 scripts to accept a run argument to indicate if the package should be run after installation. The config.xml files can have the flag present like this <package name="PDBReSym.vm" run=false/>. This way packages can be included in the default configuration always, but only run in FULL configurations sometimes.

emtuls commented 5 months ago

This seems fairly possible to do if we used this: https://docs.chocolatey.org/en-us/create/functions/get-packageparameters Note the part: choco install <pkg_id> --params "'/LICENSE:value;". We would use something like run instead, then inside of packages we could test for this to determine if it should be run or not.

Example 2:
# see https://docs.chocolatey.org/en-us/guides/create/parse-packageparameters-argument
# command line call: `choco install <pkg_id> --params "'/LICENSE:value'"`
$pp = Get-PackageParameters
# Read-Host, PromptForChoice, etc are not blocking calls with Chocolatey.
# Chocolatey has a custom PowerShell host that will time these calls
# after 30 seconds, allowing headless operation to continue but offer
# prompts to users to ask questions during installation.
if (!$pp['LICENSE']) { $pp['LICENSE'] = Read-Host 'License key?' }
# set a default if not passed
if (!$pp['LICENSE']) { $pp['LICENSE'] = '1234' }

That being said, I think https://github.com/mandiant/VM-Packages/issues/991 might be the way to go for now, but this may be something to consider down the road.

Ana06 commented 4 months ago

https://github.com/mandiant/VM-Packages/issues/991 fixed this issue. I think splitting packages is a better approach as it uses the current structure. At the moment the packages do not receive arguments from the installer to run and It that would imply complicating the installer and the packages code.