From 3ec1e773246c1399077b50dd49a8373a07f52133 Mon Sep 17 00:00:00 2001 From: emtuls Date: Mon, 4 Mar 2024 16:09:17 -0500 Subject: [PATCH] Package proposal: magika --- packages/common.vm/common.vm.nuspec | 2 +- .../common.vm/tools/vm.common/vm.common.psm1 | 10 ++++++++++ packages/magika.vm/magika.vm.nuspec | 13 +++++++++++++ packages/magika.vm/tools/chocolateyinstall.ps1 | 16 ++++++++++++++++ packages/magika.vm/tools/chocolateyuninstall.ps1 | 9 +++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 packages/magika.vm/magika.vm.nuspec create mode 100644 packages/magika.vm/tools/chocolateyinstall.ps1 create mode 100644 packages/magika.vm/tools/chocolateyuninstall.ps1 diff --git a/packages/common.vm/common.vm.nuspec b/packages/common.vm/common.vm.nuspec index 359f47aea..4528a77d2 100755 --- a/packages/common.vm/common.vm.nuspec +++ b/packages/common.vm/common.vm.nuspec @@ -2,7 +2,7 @@ common.vm - 0.0.0.20240404 + 0.0.0.20240409 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 a65cff493..b117b6d54 100755 --- a/packages/common.vm/tools/vm.common/vm.common.psm1 +++ b/packages/common.vm/tools/vm.common/vm.common.psm1 @@ -1550,3 +1550,13 @@ function VM-Get-MSIInstallerPathByProductName { VM-Write-Log-Exception $_ "An error occurred: $_" } } + +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..15334d52a --- /dev/null +++ b/packages/magika.vm/magika.vm.nuspec @@ -0,0 +1,13 @@ + + + + magika.vm + 0.5.1 + Yanick Fratantonio, Luca Invernizzi, Marina Zhang, Giancarlo Metitieri, Thomas Kurt, Francois Galilee, Alexandre Petit-Bianco, Loua Farah, Ange Albertini, Elie Bursztein + 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..a6102f63a --- /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' + + VM-Pip-Install $toolName + + $executablePath = "$(where.exe $toolName)" + $arguments = "--help" + + 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