Skip to content

Commit

Permalink
Add psnotify.vm package
Browse files Browse the repository at this point in the history
  • Loading branch information
vm-packages authored and emtuls committed Oct 21, 2023
1 parent 297f991 commit bd6a585
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/psnotify.vm/psnotify.vm.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>psnotify.vm</id>
<version>0.2.4</version>
<authors>alphillips-lab</authors>
<description>A POC tool to fight .NET anti-dumping tricks.</description>
<dependencies>
<dependency id="common.vm" />
</dependencies>
</metadata>
</package>
41 changes: 41 additions & 0 deletions packages/psnotify.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
$ErrorActionPreference = 'Stop'
Import-Module vm.common -Force -DisableNameChecking

try {
$toolName = 'psnotify'
$category = 'dotNet'

$zipUrl = 'https://github.com/WithSecureLabs/GarbageMan/releases/download/v0.2.4/psnotify.zip'
$zipSha256 = '255633da6e61bf30a67bce995ef72b7f9d8c85c75c8c5ee0aedb48709f7e6454'

$unzipLocation = 'C:\' # psnotify has a requirement of being located in 'C:\psnotify'
$toolDir = Join-Path $unzipLocation $toolName
$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category

# Remove files from previous zips for upgrade
VM-Remove-PreviousZipPackage ${Env:chocolateyPackageFolder}

# Download and unzip
$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
unzipLocation = $unzipLocation
url = $zipUrl
checksum = $zipSha256
checksumType = 'sha256'
url64bit = $zipUrl_64
checksum64 = $zipSha256_64
}
Install-ChocolateyZipPackage @packageArgs
VM-Assert-Path $toolDir
$executablePath = Join-Path $toolDir "$toolName.exe" -Resolve
$shortcut = Join-Path $shortcutDir "$toolName.lnk"

$executableDir = $toolDir
Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executablePath -WorkingDirectory $executableDir
VM-Assert-Path $shortcut

Install-BinFile -Name $toolName -Path $executablePath
return $executablePath
} catch {
VM-Write-Log-Exception $_
}
15 changes: 15 additions & 0 deletions packages/psnotify.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$ErrorActionPreference = 'Continue'
Import-Module vm.common -Force -DisableNameChecking

$toolName = 'psnotify'
$category = 'dotNet'
$toolDir = 'C:\psnotify'

# Remove tool files
Remove-Item $toolDir -Recurse -Force -ea 0 | Out-Null

# Remove tool shortcut
VM-Remove-Tool-Shortcut $toolName $category

# Uninstall binary
Uninstall-BinFile -Name $toolName

0 comments on commit bd6a585

Please sign in to comment.