Created
December 21, 2018 16:57
-
-
Save SevenLayerJedi/7b2590c692de0e32d045b501bd1df9bf to your computer and use it in GitHub Desktop.
Scrape-NessusTargets
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
# PS Function to parse Nessus Targets | |
function Scrape-NessusTargets{ | |
$nessusFiles = Get-ChildItem -Filter "*.nessus" | |
$allNessusTargets = @() | |
foreach ($file in $nessusFiles){ | |
[xml]$XmlDocument = New-Object System.Xml.XmlDocument | |
[xml]$XmlDocument = Get-Content $file | |
$NessusPreferences = $XmlDocument.NessusClientData_v2.Policy.Preferences.ServerPreferences.preference | |
$targets = $NessusPreferences | ?{$_.name -eq "target"} | %{$_.value} | |
$allNessusTargets += $targets | |
} | |
return $allNessusTargets | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment