Skip to content

Commit

Permalink
Add pkg-unpacker
Browse files Browse the repository at this point in the history
Add pkg-unpacker, a nodejs tool installed similarly to malware-jail.
  • Loading branch information
Ana06 committed Sep 29, 2023
1 parent 8239d7c commit cf3fe3e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/pkg-unpacker.vm/pkg-unpacker.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>pkg-unpacker.vm</id>
<version>1.0.0</version>
<authors>LockBlock-dev</authors>
<description>Unpacker for pkg applications.</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="nodejs" version="[20.7.0]" />
</dependencies>
</metadata>
</package>
19 changes: 19 additions & 0 deletions packages/pkg-unpacker.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -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 $_
}
7 changes: 7 additions & 0 deletions packages/pkg-unpacker.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$ErrorActionPreference = 'Continue'
Import-Module vm.common -Force -DisableNameChecking

$toolName = 'pkg-unpacker'
$category = 'Packers'

VM-Uninstall $toolName $category

0 comments on commit cf3fe3e

Please sign in to comment.