Skip to content

Commit

Permalink
Add npcap.vm
Browse files Browse the repository at this point in the history
Closes #950.
  • Loading branch information
vm-packages committed Mar 7, 2024
1 parent 45790b3 commit 1a756ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 30 deletions.
8 changes: 3 additions & 5 deletions packages/npcap.vm/npcap.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>npcap.vm</id>
<version>1.73</version>
<authors>Nmap Project</authors>
<description>Npcap is an architecture for packet capture and network analysis for Windows operating systems, consisting of a software library and a network driver.</description>
<version>1.79</version>
<authors>NMap</authors>
<description>Npcap is the Nmap Project's packet capture (and sending) library for Microsoft Windows</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="autohotkey" version="[1.1.37.1]" />
</dependencies>
</metadata>
</package>

29 changes: 5 additions & 24 deletions packages/npcap.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
$ErrorActionPreference = 'Stop'
Import-Module vm.common -Force -DisableNameChecking

try {
$exeUrl = 'https://npcap.com/dist/npcap-1.73.exe'
$exeSha256 = 'd5b309f7bd628712b3327212d76c631fbfc8f78a4f1ff3d0254f23552329c35d'
$installerName = Split-Path -Path $exeUrl -Leaf
$toolName = 'npcap'
$category = 'Networking'

$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
url = $exeUrl
checksum = $exeSha256
checksumType = "sha256"
fileFullPath = Join-Path ${Env:TEMP} $installerName
}
Get-ChocolateyWebFile @packageArgs
VM-Assert-Path $packageArgs.fileFullPath

$ahkInstaller = Join-Path $(Split-Path $MyInvocation.MyCommand.Definition) "install.ahk" -Resolve
$rc = (Start-Process -FilePath $ahkInstaller -ArgumentList $packageArgs.fileFullPath -PassThru -Wait).ExitCode
if ($rc -eq 1) {
throw "AutoHotKey returned a failure exit code ($rc) for: ${Env:ChocolateyPackageName}"
} else {
VM-Assert-Path $(Join-Path ${Env:PROGRAMFILES} "Npcap\npcap.cat")
}
} catch {
VM-Write-Log-Exception $_
}
$exeUrl = 'https://npcap.com/dist/npcap-1.79.exe'
$exeSha256 = 'a95577ebbc67fc45b319e2ef3a55f4e9b211fe82ed4cb9d8be6b1a9e2425ce53'

VM-Install-Single-Exe $toolName $category $exeUrl -exeSha256 $exeSha256 -consoleApp $false
4 changes: 3 additions & 1 deletion packages/npcap.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
$ErrorActionPreference = 'Continue'
Import-Module vm.common -Force -DisableNameChecking

VM-Uninstall-With-Uninstaller "Npcap*" "EXE" "/S"
$toolName = 'npcap'
$category = 'Networking'

VM-Uninstall $toolName $category

0 comments on commit 1a756ac

Please sign in to comment.