diff --git a/packages/common.vm/common.vm.nuspec b/packages/common.vm/common.vm.nuspec index 12e556e06..b2c59ebc9 100755 --- a/packages/common.vm/common.vm.nuspec +++ b/packages/common.vm/common.vm.nuspec @@ -2,7 +2,11 @@ common.vm +<<<<<<< HEAD 0.0.0.20240305 +======= + 0.0.0.20240306 +>>>>>>> 2a718e2 (Package proposal: magika) 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 5844ea6cf..c19297cf2 100755 --- a/packages/common.vm/tools/vm.common/vm.common.psm1 +++ b/packages/common.vm/tools/vm.common/vm.common.psm1 @@ -1451,3 +1451,13 @@ function VM-Add-To-Path { [System.Environment]::SetEnvironmentVariable("Path", $newPath, [System.EnvironmentVariableTarget]::Machine) } } + +function VM-Pip-Install { + param ( + [string]$package + ) + # Create output file to log python module installation details + $outputFile = VM-New-Install-Log ${Env:VM_COMMON_DIR} + + Invoke-Expression "py -3.10 -m pip install $package --disable-pip-version-check 2>&1 >> $outputFile" +} diff --git a/packages/magika.vm/magika.vm.nuspec b/packages/magika.vm/magika.vm.nuspec new file mode 100644 index 000000000..acfc8abaf --- /dev/null +++ b/packages/magika.vm/magika.vm.nuspec @@ -0,0 +1,13 @@ + + + + magika.vm + 0.5.0 + Google + Magika is an AI powered file type detection tool that uses deep learning to provide accurate detection. + + + + + + diff --git a/packages/magika.vm/tools/chocolateyinstall.ps1 b/packages/magika.vm/tools/chocolateyinstall.ps1 new file mode 100644 index 000000000..854049605 --- /dev/null +++ b/packages/magika.vm/tools/chocolateyinstall.ps1 @@ -0,0 +1,16 @@ +$ErrorActionPreference = 'Stop' +Import-Module vm.common -Force -DisableNameChecking + +try { + $toolName = 'magika' + $category = 'File Information' + $executablePath = "$toolName" + $arguments = "-h" + $iconLocation = Join-Path ${Env:WinDir} "system32\cmd.exe" -Resolve + + VM-Pip-Install $toolName + + VM-Install-Shortcut $toolName $category $executablePath -consoleApp $true -arguments $arguments -iconLocation $iconLocation +} catch { + VM-Write-Log-Exception $_ +} diff --git a/packages/magika.vm/tools/chocolateyuninstall.ps1 b/packages/magika.vm/tools/chocolateyuninstall.ps1 new file mode 100644 index 000000000..f75bc5788 --- /dev/null +++ b/packages/magika.vm/tools/chocolateyuninstall.ps1 @@ -0,0 +1,9 @@ +$ErrorActionPreference = 'Continue' +Import-Module vm.common -Force -DisableNameChecking + +$toolName = 'magika' +$category = 'File Information' + +Invoke-Expression "py -3.10 -m pip uninstall $toolName -y" + +VM-Uninstall $toolName $category