Skip to content

Instantly share code, notes, and snippets.

@0xbadjuju
Created February 21, 2020 18:56
Show Gist options
  • Save 0xbadjuju/0a677dcb153f73d9f49a6beb869c2075 to your computer and use it in GitHub Desktop.
Save 0xbadjuju/0a677dcb153f73d9f49a6beb869c2075 to your computer and use it in GitHub Desktop.
Parses the IPs from a Nessus scan file
function Parse-IPsNessus
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True, HelpMessage="File Name")]
[String]$fileName
)
$fileNamePath = Resolve-Path("$fileName")
$document = New-Object System.Xml.XmlDocument
$document.Load($fileNamePath)
$hosts = $document.SelectNodes("NessusClientData_v2/Report/ReportHost")
foreach ($h in $hosts)
{
$tag = $h.SelectNodes("HostProperties/tag")
foreach ($t in $tag)
{
if ("host-ip" -eq $t.Attributes["name"].Value)
{
$t.InnerText
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment