From 10178fd87ee1ef763c997045865c204867885df2 Mon Sep 17 00:00:00 2001 From: Elliot Chernofsky Date: Fri, 26 Jul 2024 21:11:31 -0400 Subject: [PATCH] Update .py default app execution --- packages/common.vm/common.vm.nuspec | 2 +- packages/common.vm/tools/vm.common/vm.common.psm1 | 2 +- .../didier-stevens-beta.vm/didier-stevens-beta.vm.nuspec | 6 +++--- .../didier-stevens-suite.vm/didier-stevens-suite.vm.nuspec | 6 +++--- packages/python3.vm/python3.vm.nuspec | 4 ++-- packages/python3.vm/tools/chocolateyinstall.ps1 | 7 ++++++- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/common.vm/common.vm.nuspec b/packages/common.vm/common.vm.nuspec index de4cac64f..57314a3f6 100755 --- a/packages/common.vm/common.vm.nuspec +++ b/packages/common.vm/common.vm.nuspec @@ -2,7 +2,7 @@ common.vm - 0.0.0.20240821 + 0.0.0.20240826 Common libraries for VM-packages Mandiant diff --git a/packages/common.vm/tools/vm.common/vm.common.psm1 b/packages/common.vm/tools/vm.common/vm.common.psm1 index 0ce9a4baf..479520929 100755 --- a/packages/common.vm/tools/vm.common/vm.common.psm1 +++ b/packages/common.vm/tools/vm.common/vm.common.psm1 @@ -954,7 +954,7 @@ function VM-Set-Open-With-Association { # Create the 'command' key and its default value $commandKey = "${hive}\Software\Classes\${exeName}_auto_file\shell\open\command" New-Item -Path $commandKey -Force - New-ItemProperty -Path $commandKey -Name '(Default)' -Value "`"$executablePath`" `"%1`"" + New-ItemProperty -Path $commandKey -Name '(Default)' -Value "`"$executablePath`" `"%1`" %*" # Create/update the file extension key $extKey = "${hive}\Software\Classes\$extension" diff --git a/packages/didier-stevens-beta.vm/didier-stevens-beta.vm.nuspec b/packages/didier-stevens-beta.vm/didier-stevens-beta.vm.nuspec index 8e3acb15a..cc9b043d1 100644 --- a/packages/didier-stevens-beta.vm/didier-stevens-beta.vm.nuspec +++ b/packages/didier-stevens-beta.vm/didier-stevens-beta.vm.nuspec @@ -2,12 +2,12 @@ didier-stevens-beta.vm - 0.0.0.20240226 + 0.0.0.20240726 Didier Stevens Beta versions of Didier Stevens's software - - + + diff --git a/packages/didier-stevens-suite.vm/didier-stevens-suite.vm.nuspec b/packages/didier-stevens-suite.vm/didier-stevens-suite.vm.nuspec index 9253f8ae8..cc2b18504 100644 --- a/packages/didier-stevens-suite.vm/didier-stevens-suite.vm.nuspec +++ b/packages/didier-stevens-suite.vm/didier-stevens-suite.vm.nuspec @@ -2,12 +2,12 @@ didier-stevens-suite.vm - 0.0.0.20240226 + 0.0.0.20240726 Didier Stevens Tools collection by Didier Stevens - - + + diff --git a/packages/python3.vm/python3.vm.nuspec b/packages/python3.vm/python3.vm.nuspec index 3dc670e67..cd6eded00 100644 --- a/packages/python3.vm/python3.vm.nuspec +++ b/packages/python3.vm/python3.vm.nuspec @@ -2,11 +2,11 @@ python3.vm - 0.0.0.20231019 + 0.0.0.20240726 Metapackage for Python 3 to ensure all packages use the same Python version. Mandiant - + diff --git a/packages/python3.vm/tools/chocolateyinstall.ps1 b/packages/python3.vm/tools/chocolateyinstall.ps1 index 44a926c40..f9ee807e5 100644 --- a/packages/python3.vm/tools/chocolateyinstall.ps1 +++ b/packages/python3.vm/tools/chocolateyinstall.ps1 @@ -2,10 +2,15 @@ $ErrorActionPreference = 'Stop' Import-Module vm.common -Force -DisableNameChecking try { + # Remove default python stubs created by Microsoft + Remove-Item $env:USERPROFILE\AppData\Local\Microsoft\WindowsApps\python*.exe + + # Set all python files to use correct python3 install + VM-Set-Open-With-Association (Get-Command python).Source ".py" + # Re-add shim path to the top of the path to ensure it is found before Python libraries $shimPath = Join-Path $Env:ChocolateyInstall "bin" -Resolve [Environment]::SetEnvironmentVariable("Path", "$shimPath;$Env:Path", "Machine") } catch { VM-Write-Log-Exception $_ } -