From cf3fe3e468775ec260bf61ad409d814d004ed789 Mon Sep 17 00:00:00 2001 From: Ana Maria Martinez Gomez Date: Fri, 29 Sep 2023 12:06:36 +0200 Subject: [PATCH] Add pkg-unpacker Add pkg-unpacker, a nodejs tool installed similarly to malware-jail. --- .../pkg-unpacker.vm/pkg-unpacker.vm.nuspec | 13 +++++++++++++ .../tools/chocolateyinstall.ps1 | 19 +++++++++++++++++++ .../tools/chocolateyuninstall.ps1 | 7 +++++++ 3 files changed, 39 insertions(+) create mode 100644 packages/pkg-unpacker.vm/pkg-unpacker.vm.nuspec create mode 100644 packages/pkg-unpacker.vm/tools/chocolateyinstall.ps1 create mode 100644 packages/pkg-unpacker.vm/tools/chocolateyuninstall.ps1 diff --git a/packages/pkg-unpacker.vm/pkg-unpacker.vm.nuspec b/packages/pkg-unpacker.vm/pkg-unpacker.vm.nuspec new file mode 100644 index 000000000..b39ac1d5c --- /dev/null +++ b/packages/pkg-unpacker.vm/pkg-unpacker.vm.nuspec @@ -0,0 +1,13 @@ + + + + pkg-unpacker.vm + 1.0.0 + LockBlock-dev + Unpacker for pkg applications. + + + + + + diff --git a/packages/pkg-unpacker.vm/tools/chocolateyinstall.ps1 b/packages/pkg-unpacker.vm/tools/chocolateyinstall.ps1 new file mode 100644 index 000000000..2cc736110 --- /dev/null +++ b/packages/pkg-unpacker.vm/tools/chocolateyinstall.ps1 @@ -0,0 +1,19 @@ +$ErrorActionPreference = 'Stop' +Import-Module vm.common -Force -DisableNameChecking + +try { + $toolName = 'pkg-unpacker' + $category = 'Packers' + $zipUrl = 'https://github.com/LockBlock-dev/pkg-unpacker/archive/b1fd5200e1bf656dedef6817c177c8bb2dc38028.zip' + $zipSha256 = '6eed1d492d37ca3934a3bc838c2256719a3e78ccf72ce1b1ca07684519ace16c' + $powershellCommand = "Write-Output '> node unpack.js'; node unpack.js" + + $toolDir = VM-Install-Raw-GitHub-Repo $toolName $category $zipUrl $zipSha256 -powershellCommand $powershellCommand + + # Get absolute path as npm is not in path until Powershell is restarted + $npmPath = Join-Path ${Env:ProgramFiles} "\nodejs\npm.cmd" -Resolve + # Install tool dependencies with npm + Set-Location $toolDir; & "$npmPath" install | Out-Null +} catch { + VM-Write-Log-Exception $_ +} diff --git a/packages/pkg-unpacker.vm/tools/chocolateyuninstall.ps1 b/packages/pkg-unpacker.vm/tools/chocolateyuninstall.ps1 new file mode 100644 index 000000000..6bb7b577f --- /dev/null +++ b/packages/pkg-unpacker.vm/tools/chocolateyuninstall.ps1 @@ -0,0 +1,7 @@ +$ErrorActionPreference = 'Continue' +Import-Module vm.common -Force -DisableNameChecking + +$toolName = 'pkg-unpacker' +$category = 'Packers' + +VM-Uninstall $toolName $category