Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Try
{
# Conditional logic to determine if the switch to retrieve information from the Microsoft Security Bulletin RSS feed has been specified.
If ($Microsoft)
{
# Retrieves content from the Microsoft Security Bulletin RSS feed.
[xml]$WebRequest = Invoke-WebRequest -Uri https://technet.microsoft.com/en-us/security/rss/bulletin
# Selects objects retrieved where the published date is greater or equal to the timespan speficied.
$Items = $WebRequest.rss.channel.item | Where-Object {$_.pubDate -ge "$Date"}
# Performs action on each item returned to calculate expressions for output object.
ForEach ($Item in $Items)
{
"" | Select-Object @{N="Title";E={(($Item.title -split ": ")[1] -split " - ")[0]}},@{N="PublishedDate";E={Get-Date ($Item.pubDate) -Format d}},@{N="Source";E={"Microsoft Security Bulletin"}},
@{N="Description";E={($Item.InnerText -split "Summary: ")[1]}}, @{N="Link";E={$Item.link}},@{N="Severity";E={(($Item.title -split " - ") -split ":")[1]}}
} # ForEach
} # If
# Conditional logic to determine if the switch to retrieve information from the National Vulnerability RSS feed has been specified.
If ($NVD)
{
# Retrieves content from the National Vulnerability Database RSS Feed.
[xml]$WebRequest = Invoke-WebRequest -Uri https://nvd.nist.gov/download/nvd-rss.xml
# Selects objects retrieved where the published date is greater or equal to the timespan speficied.
$Items = $WebRequest.rdf.item | Where-Object {$_.Date -ge "$Date"}
# Performs action on each item returned to calculate expressions for output object.
ForEach ($Item in $Items)
{
# Conditional logic to determine if the item returned matches one of the keyword values.
If ($Item.InnerText -match $Keywords)
{
"" | Select-Object @{N="Title";E={$Item.title}},@{N="PublishedDate";E={Get-Date ($Item.Date) -Format d}},@{N="Source";E={"National Vulnerability Database "}},@{N="Description";E={$Item.description}},@{N="Link";E={$Item.link}},
@{N="Severity";E={""}}
} # If
} # ForEach
} # If
} # Try
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment