### Created by Martin ### cls; if(!([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList "-File `"$($MyInvocation.MyCommand.Path)`" `"$($MyInvocation.MyCommand.UnboundArguments)`"" Exit } echo "Current Policy Type:" Get-ExecutionPolicy -Verbose echo "" echo "Setting Policy Type To RemoteSigned" Set-ExecutionPolicy RemoteSigned -Force -Verbose echo "" echo "Updated Policy Type:" Get-ExecutionPolicy -Verbose echo "" # 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_mitre = "https://cve.mitre.org/cgi-bin/cvename.cgi?name=$cve" $url_tenable = "https://www.tenable.com/cve/$cve/plugins" # Fetch the web page content from MITRE echo "Fetching data for $cve" try { $response = Invoke-WebRequest -Uri $url_mitre -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 on MITRE" } # 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 on MITRE" } } catch { $description = "WEB REQUEST ERROR (MITRE)" $cna = "WEB REQUEST ERROR (MITRE)" } # Fetch the web page content from TENABLE try { $response = Invoke-WebRequest -Uri $url_tenable -UseBasicParsing $content = $response.Content # Extract the Name and Product values using a regular expression if ($content -match '.*?<\/a><\/td>(.*?)<\/td>(.*?)<\/td>') { $name = $matches[1].Trim() $product = $matches[2].Trim() } else { $name = "Name not found on TENABLE" $product = "Product not found on TENABLE" } } catch { $name = "WEB REQUEST ERROR (TENABLE)" $product = "WEB REQUEST ERROR (TENABLE)" } # Add the CVE, description, CNA, Name, and Product to the HTML rows $htmlRows += "$cve$description$cna$name$product" } # Construct the HTML content $htmlContent = @" CVE Descriptions v1.2 $($htmlRows -join "`n")
CVE Description Manufacturer Name Product
"@ # Write the HTML content to the output file $htmlContent | Set-Content -Path $outputFilePath