Created
February 21, 2020 18:56
-
-
Save 0xbadjuju/0a677dcb153f73d9f49a6beb869c2075 to your computer and use it in GitHub Desktop.
Parses the IPs from a Nessus scan file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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