### Created By Martin ###
# Define the input file and output file paths
$cveFilePath = "C:\golive\CVE.txt"
$outputFilePath = "C:\golive\CVE_OUTPUT.html"
# Read the CVE list from the file
$cveList = Get-Content -Path $cveFilePath -Raw
$cveArray = $cveList -split ",\s*"
# Initialize an array to hold the HTML rows
$htmlRows = @()
# Loop through each CVE in the list
foreach ($cve in $cveArray) {
# Trim any leading/trailing whitespace
$cve = $cve.Trim()
# Construct the URL for the CVE
$url = "https://cve.mitre.org/cgi-bin/cvename.cgi?name=$cve"
# Fetch the web page content
try
{
$response = Invoke-WebRequest -Uri $url -UseBasicParsing
$content = $response.Content
# Extract the description using a regular expression
if ($content -match '
Description<\/th>\s*<\/tr>\s* | \s*| \s*(.*?)\s*<\/td>')
{
$description = $matches[1].Trim()
$description = $description -replace '\s+', ' ' # Normalize whitespace
}
else
{
$description = "Description not found"
}
# Extract the AssigningCNA using a regular expression
if ($content -match ' | Assigning CNA<\/th>\s*<\/tr>\s* |
\s*| \s*(.*?)\s*<\/td>')
{
$cna = $matches[1].Trim()
$cna = $cna -replace '\s+', ' ' # Normalize whitespace
}
else
{
$cna = "Assigning CNA not found"
}
# Add the CVE and description to the HTML rows
$htmlRows += " |
| $cve | $description | $cna |
"
}
catch
{
# Handle any errors during the web request
$htmlRows += "| $cve | WEB REQUEST ERROR |
"
}
}
# Construct the HTML content
$htmlContent = @"
CVE Descriptions v1.1
| CVE |
Description |
Manufacturer |
$(foreach ($row in $htmlRows) { $row })
"@
# Write the HTML content to the output file
$htmlContent | Set-Content -Path $outputFilePath