From 9360f8132259c03964f71689a54b2e48fdb38fcb Mon Sep 17 00:00:00 2001 From: Jasper Metselaar Date: Mon, 8 Jan 2024 16:27:35 +0100 Subject: [PATCH 1/2] New App - Npcap --- Evergreen/Apps/Get-Npcap.ps1 | 41 ++++++++++++++++++++++++++++++++++ Evergreen/Manifests/Npcap.json | 26 +++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 Evergreen/Apps/Get-Npcap.ps1 create mode 100644 Evergreen/Manifests/Npcap.json diff --git a/Evergreen/Apps/Get-Npcap.ps1 b/Evergreen/Apps/Get-Npcap.ps1 new file mode 100644 index 00000000..36e128bc --- /dev/null +++ b/Evergreen/Apps/Get-Npcap.ps1 @@ -0,0 +1,41 @@ +Function Get-Npcap { + <# + .SYNOPSIS + Returns the latest Npcap version number and download. + + .NOTES + Author: Jasper Metselaar + E-mail: jms@du.se + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $False)] + param ( + [Parameter(Mandatory = $False, Position = 0)] + [ValidateNotNull()] + [System.Management.Automation.PSObject] + $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) + ) + + + # Get latest version and download latest release via GitHub API + $params = @{ + Uri = $res.Get.Update.Uri + ContentType = $res.Get.Update.ContentType + ReturnObject = "Content" + } + + # Get only latest version tag from GitHub API + $Content = ((Invoke-EvergreenWebRequest @params | ConvertFrom-Json).name -replace "v",""| ForEach-Object { New-Object -TypeName "System.Version" ($_) } | Sort-Object -Descending | Select-Object -First 1 | ForEach-Object {("{0}.{1}" -f $_.Major,$_.Minor)}) + + if ($null -ne $Content) { + $Content | ForEach-Object { + $PSObject = [PSCustomObject] @{ + Version = $_ + Type = "exe" + URI = $res.Get.Download.Uri -replace $res.Get.Download.ReplaceText, $_ + } + Write-Output -InputObject $PSObject + } + } +} + diff --git a/Evergreen/Manifests/Npcap.json b/Evergreen/Manifests/Npcap.json new file mode 100644 index 00000000..9fc4e0eb --- /dev/null +++ b/Evergreen/Manifests/Npcap.json @@ -0,0 +1,26 @@ +{ + "Name": "Npcap", + "Source": "https://npcap.com/", + "Get": { + "Update": { + "Uri": "https://api.github.com/repos/nmap/npcap/tags", + "ContentType": "application/json; charset=utf-8" + }, + "Download": { + "Uri": "https://npcap.com/dist/npcap-#version.exe", + "ReplaceText": "#version" + } + }, + "Install": { + "Setup": "npcap-*.exe", + "Preinstall": "", + "Physical": { + "Arguments": "/S", + "PostInstall": [] + }, + "Virtual": { + "Arguments": "", + "PostInstall": [] + } + } +} \ No newline at end of file From e4a091f1cce74501bfbc2f316868609017948c03 Mon Sep 17 00:00:00 2001 From: Jasper Metselaar Date: Tue, 9 Jan 2024 08:33:36 +0100 Subject: [PATCH 2/2] Silent install is not supported in the free version. Removed the /S argument. --- Evergreen/Manifests/Npcap.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Evergreen/Manifests/Npcap.json b/Evergreen/Manifests/Npcap.json index 9fc4e0eb..c39f66a0 100644 --- a/Evergreen/Manifests/Npcap.json +++ b/Evergreen/Manifests/Npcap.json @@ -15,7 +15,7 @@ "Setup": "npcap-*.exe", "Preinstall": "", "Physical": { - "Arguments": "/S", + "Arguments": "", "PostInstall": [] }, "Virtual": {