-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
297f991
commit c710a30
Showing
3 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
$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' | ||
|
||
<<<<<<< HEAD | ||
$unzipLocation = 'C:\' # psnotify has a requirement of being located in 'C:\psnotify' | ||
$toolDir = Join-Path $unzipLocation $toolName | ||
|
||
try { | ||
$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} | ||
|
||
# Snapshot all folders in $toolDir | ||
$oldDirList = @() | ||
if (Test-Path $toolDir) { | ||
$oldDirList = @(Get-ChildItem $toolDir | Where-Object {$_.PSIsContainer}) | ||
} | ||
|
||
# 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 | ||
|
||
# Diff and find new folders in $toolDir | ||
$newDirList = @(Get-ChildItem $toolDir | Where-Object {$_.PSIsContainer}) | ||
$diffDirs = Compare-Object -ReferenceObject $oldDirList -DifferenceObject $newDirList -PassThru | ||
|
||
$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 $_ | ||
} | ||
VM-Assert-Path $toolDir | ||
======= | ||
$executablePath = (VM-Install-From-Zip $toolName $category $zipUrl -zipSha256 $zipSha256 -innerFolder $true) | ||
$innerPath = Join-Path $executablePath[0] "psnotify" -Resolve | ||
Move-Item -Path $innerPath -Destination "C:\" -Force -ea 0 | ||
Remove-Item $executablePath -Force -ea 0 | ||
>>>>>>> 70efef8 (Add psnotify.vm package) | ||
} catch { | ||
VM-Write-Log-Exception $_ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |