Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add npcap package and update wireshark package #196

Merged
merged 3 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/npcap.vm/npcap.vm.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>npcap.vm</id>
<version>1.72</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>
<dependencies>
<dependency id="common.vm" />
<dependency id="autohotkey" version="[1.1.36.02]" />
</dependencies>
</metadata>
</package>

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

try {
$exeUrl = 'https://npcap.com/dist/npcap-1.72.exe'
$exeSha256 = 'b0efd269d32e581da747e5050ef98d2eb91e6de9080e0918f5af85b485a4bdd1'
$installerName = Split-Path -Path $exeUrl -Leaf

$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 $_
}

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

VM-Uninstall-With-Uninstaller "Npcap*" "EXE" "/S"

56 changes: 56 additions & 0 deletions packages/npcap.vm/tools/install.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance, force ; Ensure a single instance of this script
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, RegEx ; Enable regular expressions in title matches

; Handle installation
installer = %1%
Run, %installer% /loopback_support=no
installerTitle := "i)npcap .* setup"
WinWait, %installerTitle%,,20
WinActivate

exitCode := 1
loop, 20
{
if WinExist(installerTitle, "i).*license agreement.*")
{
BlockInput, On
WinActivate
Sleep, 500
ControlSend,, {Enter}
Sleep, 500
ControlSend,, {Enter}
BlockInput, Off
}
if WinExist(installerTitle, "i).*installing.*")
{
Sleep, 5000
}
if WinExist(installerTitle, "i).*installation complete.*")
{
BlockInput, On
WinActivate
Sleep, 500
ControlSend,, {Enter}
Sleep, 500
ControlSend,, {Enter}
BlockInput, Off
exitCode := 0
break
}
if WinExist(installerTitle, "i).*already installed.*")
{
BlockInput, On
WinActivate
Sleep, 500
ControlSend,, {Enter}
BlockInput, Off
exitCode := 0
break
}
Sleep 1000
}
ExitApp %exitCode%
3 changes: 2 additions & 1 deletion packages/wireshark.vm/wireshark.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>wireshark.vm</id>
<version>4.0.2</version>
<version>4.0.2.20221221</version>
<description>Wireshark lets you capture and interactively browse the traffic running on a computer network.</description>
<authors>Gerald Combs, Wireshark team</authors>
<dependencies>
<dependency id="common.vm" />
<dependency id="npcap.vm" />
<dependency id="wireshark" version="[4.0.2]" />
</dependencies>
</metadata>
Expand Down