From 84168ff3589aeeab5680e3f76f4d179a8d400345 Mon Sep 17 00:00:00 2001 From: vm-packages Date: Thu, 9 Nov 2023 16:09:26 +0000 Subject: [PATCH] Add netcat.vm Closes https://github.com/mandiant/VM-Packages/issues/735. --- packages/netcat.vm/netcat.vm.nuspec | 13 +++++++++++++ packages/netcat.vm/tools/chocolateyinstall.ps1 | 16 ++++++++++++++++ packages/netcat.vm/tools/chocolateyuninstall.ps1 | 7 +++++++ 3 files changed, 36 insertions(+) create mode 100644 packages/netcat.vm/netcat.vm.nuspec create mode 100644 packages/netcat.vm/tools/chocolateyinstall.ps1 create mode 100644 packages/netcat.vm/tools/chocolateyuninstall.ps1 diff --git a/packages/netcat.vm/netcat.vm.nuspec b/packages/netcat.vm/netcat.vm.nuspec new file mode 100644 index 000000000..446a569d0 --- /dev/null +++ b/packages/netcat.vm/netcat.vm.nuspec @@ -0,0 +1,13 @@ + + + + netcat.vm + 1.12 + Hobbit + Netcat is a networking utility for reading from and writing to network connections using TCP or UDP. + + + + + + diff --git a/packages/netcat.vm/tools/chocolateyinstall.ps1 b/packages/netcat.vm/tools/chocolateyinstall.ps1 new file mode 100644 index 000000000..48f289173 --- /dev/null +++ b/packages/netcat.vm/tools/chocolateyinstall.ps1 @@ -0,0 +1,16 @@ +$ErrorActionPreference = 'Stop' +Import-Module vm.common -Force -DisableNameChecking + +try { + $toolName = 'nc' + $category = 'Networking' + $shimPath = '%ProgramData%\chocolatey\bin\nc.exe' + + $shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category + $shortcut = Join-Path $shortcutDir "$toolName.lnk" + $executablePath = Join-Path ${Env:ChocolateyInstall} $shimPath -Resolve + Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executablePath -RunAsAdmin + VM-Assert-Path $shortcut +} catch { + VM-Write-Log-Exception $_ +} diff --git a/packages/netcat.vm/tools/chocolateyuninstall.ps1 b/packages/netcat.vm/tools/chocolateyuninstall.ps1 new file mode 100644 index 000000000..2f8610a43 --- /dev/null +++ b/packages/netcat.vm/tools/chocolateyuninstall.ps1 @@ -0,0 +1,7 @@ +$ErrorActionPreference = 'Continue' +Import-Module vm.common -Force -DisableNameChecking + +$toolName = 'nc' +$category = 'Networking' + +VM-Remove-Tool-Shortcut $toolName $category