public/Get-NexposeVulnerabilityMalwareKit.ps1

Function Get-NexposeVulnerabilityMalwareKit {
<#
    .SYNOPSIS
        Returns the details for a malware kit.
 
    .DESCRIPTION
        Returns the details for a malware kit.
 
    .PARAMETER Id
        The identifier of the malware kit
 
    .PARAMETER IncludeVulnerabilities
        Include the list of vulnerabilities contained within the selected malware kit
 
    .EXAMPLE
        Get-NexposeVulnerabilityMalwareKit -Id 123
 
    .NOTES
        For additional information please see my GitHub wiki page
 
    .FUNCTIONALITY
        GET: malware_kits
        GET: malware_kits/{id}
        GET: malware_kits/{id}/vulnerabilities
 
    .LINK
        https://github.com/My-Random-Thoughts/Rapid7Nexpose
#>


    [CmdletBinding()]
    Param (
        [string]$Id = 0,

        [switch]$IncludeVulnerabilities
    )

    If ($Id -gt 0) {
        $vulnMal = (Invoke-NexposeQuery -UrlFunction "malware_kits/$Id" -RestMethod Get)
        If ($IncludeVulnerabilities.IsPresent) {
            $vulns = @(Invoke-NexposeQuery -UrlFunction "malware_kits/$Id/vulnerabilities" -RestMethod Get)
            $vulnMal | Add-Member -Name 'vulnerabilities' -Value $vulns -MemberType NoteProperty
        }
        Write-Output $vulnMal
    }
    Else {
        Write-Output @(Invoke-NexposeQuery -UrlFunction 'malware_kits' -RestMethod Get)    # Return All
    }
}