Skip to content

Instantly share code, notes, and snippets.

@SevenLayerJedi
Created December 21, 2018 16:57
Show Gist options
  • Save SevenLayerJedi/7b2590c692de0e32d045b501bd1df9bf to your computer and use it in GitHub Desktop.
Save SevenLayerJedi/7b2590c692de0e32d045b501bd1df9bf to your computer and use it in GitHub Desktop.
Scrape-NessusTargets
# 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