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..c39f66a0 --- /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": "", + "PostInstall": [] + }, + "Virtual": { + "Arguments": "", + "PostInstall": [] + } + } +} \ No newline at end of file