Skip to content

Commit

Permalink
Merge pull request #935 from mandiant/package-magika
Browse files Browse the repository at this point in the history
Package proposal: magika
  • Loading branch information
Ana06 authored Apr 10, 2024
2 parents 9fe5557 + 3ec1e77 commit 5dcdd11
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/common.vm/common.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>common.vm</id>
<version>0.0.0.20240404</version>
<version>0.0.0.20240409</version>
<description>Common libraries for VM-packages</description>
<authors>Mandiant</authors>
</metadata>
Expand Down
10 changes: 10 additions & 0 deletions packages/common.vm/tools/vm.common/vm.common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
13 changes: 13 additions & 0 deletions packages/magika.vm/magika.vm.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>magika.vm</id>
<version>0.5.1</version>
<authors>Yanick Fratantonio, Luca Invernizzi, Marina Zhang, Giancarlo Metitieri, Thomas Kurt, Francois Galilee, Alexandre Petit-Bianco, Loua Farah, Ange Albertini, Elie Bursztein</authors>
<description>Magika is an AI powered file type detection tool that uses deep learning to provide accurate detection.</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="python3.vm" />
</dependencies>
</metadata>
</package>
16 changes: 16 additions & 0 deletions packages/magika.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -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 $_
}
9 changes: 9 additions & 0 deletions packages/magika.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5dcdd11

Please sign in to comment.