Skip to content

Commit

Permalink
Automatic install of drivers for Arsenal Image Mounter
Browse files Browse the repository at this point in the history
  • Loading branch information
naacbin committed Apr 3, 2024
1 parent 0a185d0 commit bb6a2f1
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
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>arsenalimagemounter.vm</id>
<version>3.11.279.20240226</version>
<version>3.11.279.20240402</version>
<authors>Arsenal Recon</authors>
<description>Mounts the contents of disk images as complete disks in Windows.</description>
<dependencies>
Expand Down
48 changes: 48 additions & 0 deletions packages/arsenalimagemounter.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,54 @@ $ErrorActionPreference = 'Stop'
Import-Module vm.common -Force -DisableNameChecking

try {
###################################
# Install of drivers dependencies #
###################################
$zipCliUrl = 'https://github.com/ArsenalRecon/Arsenal-Image-Mounter/raw/master/Command%20line%20applications/aim_ll.zip'
$zipCliSha256 = '9c2e6041df7d32093da8899e98462767ad8c8cbecaabe1ff6afefeba87f364f3'
$tempCliDownloadDir = Join-Path ${Env:chocolateyPackageFolder} "aim_ll"
$toolCli = "aim_ll.exe"

$zipDriverUrl = 'https://github.com/ArsenalRecon/Arsenal-Image-Mounter/raw/master/DriverSetup/DriverFiles.zip'
$zipDriverSha256 = 'c5de8e5d5a2c0231baf2cdb74fb0b0f4047658c69105bcab28990734b3979ee3'
$tempDriverDownloadDir = Join-Path ${Env:chocolateyPackageFolder} "temp_$([guid]::NewGuid())"

$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
unzipLocation = $tempCliDownloadDir
url = $zipCliUrl
checksum = $zipCliSha256
checksumType = 'sha256'
}
Install-ChocolateyZipPackage @packageArgs
VM-Assert-Path $tempCliDownloadDir

$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
unzipLocation = $tempDriverDownloadDir
url = $zipDriverUrl
checksum = $zipDriverSha256
checksumType = 'sha256'
}
Install-ChocolateyZipPackage @packageArgs | Out-Null
VM-Assert-Path $tempDriverDownloadDir

if (Get-OSArchitectureWidth -Compare 64) {
$toolCliDir = Join-Path $tempCliDownloadDir "x64"
}
else {
$toolCliDir = Join-Path $tempCliDownloadDir "x32"
}
$toolCliPath = Join-Path $toolCliDir $toolCli
# Install drivers messages displayed in stderr even on successful install, bypass by creating an external process
Start-Process -FilePath $toolCliPath -ArgumentList "--install $tempDriverDownloadDir" -Wait

# Remove temp driver folder
VM-Remove-PreviousZipPackage ${Env:chocolateyPackageFolder}

######################
# Install of package #
######################
$toolName = 'ArsenalImageMounter'
$category = 'Forensic'
$shimPath = "\bin\${toolName}.exe"
Expand Down
13 changes: 13 additions & 0 deletions packages/arsenalimagemounter.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@ $toolName = 'ArsenalImageMounter'
$category = 'Forensic'

VM-Remove-Tool-Shortcut $toolName $category

$tempCliDownloadDir = Join-Path ${Env:chocolateyPackageFolder} "aim_ll"
$toolCli = "aim_ll.exe"

if (Get-OSArchitectureWidth -Compare 64) {
$toolCliDir = Join-Path $tempCliDownloadDir "x64"
}
else {
$toolCliDir = Join-Path $tempCliDownloadDir "x32"
}

$toolCliPath = Join-Path $toolCliDir $toolCli
& $toolCliPath "--uninstall"

0 comments on commit bb6a2f1

Please sign in to comment.