Skip to content

Commit

Permalink
Merge pull request #609 from jms-du-se/New-App-Npcap
Browse files Browse the repository at this point in the history
New App - Npcap
  • Loading branch information
aaronparker authored Jan 13, 2024
2 parents 95a0de1 + e4a091f commit e60fb48
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Evergreen/Apps/Get-Npcap.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Function Get-Npcap {
<#
.SYNOPSIS
Returns the latest Npcap version number and download.
.NOTES
Author: Jasper Metselaar
E-mail: [email protected]
#>
[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
}
}
}

26 changes: 26 additions & 0 deletions Evergreen/Manifests/Npcap.json
Original file line number Diff line number Diff line change
@@ -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": []
}
}
}

0 comments on commit e60fb48

Please sign in to comment.