Public/Get-MsrcCvrfExploitabilityIndex.ps1

Function Get-MsrcCvrfExploitabilityIndex {
<#
    .SYNOPSIS
        Get the exploitability index of vulnerabilities found in CVRF document
 
    .DESCRIPTION
       This function gathers the Exploitability Index from vulnerabilities in a CVRF document.
 
    .PARAMETER Vulnerability
        A vulnerability object or objects from a CVRF document object
 
    .EXAMPLE
        Get-MsrcCvrfDocument -ID 2016-Nov | Get-MsrcCvrfExploitabilityIndex
 
        Get the exploitability index from a CVRF document using the pipeline.
 
    .EXAMPLE
        $cvrfDocument = Get-MsrcCvrfDocument -ID 2016-Nov
        Get-MsrcCvrfExploitabilityIndex -Vulnerability $cvrfDocument.Vulnerability
 
        Get the exploitability index from a CVRF document using a variable and parameters
#>

[CmdletBinding()]
Param (
    [Parameter(Mandatory,ValueFromPipelineByPropertyName)]
    $Vulnerability
)
Begin {
    $ThreatsExploitStatusType = 1
}
Process {
    $Vulnerability | ForEach-Object {
        $v = $_

        $v.Threats |
        Where-Object { $_.Type -eq $ThreatsExploitStatusType } |
        ForEach-Object {

            $es = Get-MsrcThreatExploitStatus -ExploitStatusString $_.Description.Value
            [PSCustomObject]@{
                CVE = $v.CVE
                Title = $v.Title.Value
                Weakness = $(if ($v.CWE) { '{0} : {1}' -f "$($v.CWE.ID)","$($v.CWE.Value)"})
                PubliclyDisclosed     = $es.PubliclyDisclosed
                Exploited             = $es.Exploited
                LatestSoftwareRelease = $es.LatestSoftwareRelease
                OlderSoftwareRelease  = $es.OlderSoftwareRelease
            }
        }
    }
}
End {}
}